diff options
author | Release Engineers <releng@openoffice.org> | 2009-07-03 10:14:57 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-07-03 10:14:57 +0000 |
commit | b37f665758a8eebc1cbeb0155d7d24787ca3401e (patch) | |
tree | b864924e5b8d77a106fe477881de7ccdc10bc91a /qadevOOo/runner/complexlib/ComplexTestCase.java | |
parent | 6a64591a8774d2cb7057fff5af1af21c6e6c01b2 (diff) |
CWS-TOOLING: integrate CWS perftest08
2009-07-02 10:03:16 +0200 lla r273621 : #159516# support systems with no JAVA_HOME
2009-07-02 10:00:25 +0200 lla r273620 : #159516# if path is null this not an error
2009-07-01 14:36:05 +0200 lla r273583 : #159516# add check for wrong cygwin path
2009-06-22 13:18:14 +0200 lla r273223 : #159516# add PipeConnectionString
2009-06-18 21:44:59 +0200 lla r273137 : #159516# cleanups
2009-06-18 21:44:17 +0200 lla r273136 : #159516# handle null
2009-06-18 21:42:56 +0200 lla r273135 : #159516# add getElementCount() function
2009-06-15 10:40:05 +0200 lla r272966 : CWS-TOOLING: rebase CWS perftest08 to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:06:22 +0200 lla r272480 : CWS-TOOLING: rebase CWS perftest08 to trunk@272291 (milestone: DEV300:m49)
2009-05-08 11:40:22 +0200 mib r271710 : #159717#: File name info for performance test (added void to hasLogFile() parameter list)
2009-05-05 14:14:25 +0200 mib r271514 : #159717#: File name info for performance test
2009-05-04 15:23:01 +0200 mib r271466 : #159717#: File name infor for performance test
2009-05-04 15:22:27 +0200 mib r271465 : #159717#: File name infor for performance test
2009-05-04 15:21:56 +0200 mib r271464 : #159717#: File name infor for performance test
2009-05-04 15:21:18 +0200 mib r271462 : #159717#: File name infor for performance test
2009-04-29 16:23:40 +0200 lla r271383 : #159516# cleanups
2009-04-29 16:23:20 +0200 lla r271382 : #159516# cleanups
2009-04-08 12:23:01 +0200 lla r270631 : #159516# typo
2009-04-07 10:30:35 +0200 lla r270580 : #159516# add prototype
2009-04-07 10:21:15 +0200 lla r270579 : #159516# cleanup
2009-04-03 09:05:26 +0200 lla r270448 : #159516# small cleanups
2009-03-30 13:22:26 +0200 lla r270221 : #159517# merge perftest07
Diffstat (limited to 'qadevOOo/runner/complexlib/ComplexTestCase.java')
-rw-r--r-- | qadevOOo/runner/complexlib/ComplexTestCase.java | 131 |
1 files changed, 87 insertions, 44 deletions
diff --git a/qadevOOo/runner/complexlib/ComplexTestCase.java b/qadevOOo/runner/complexlib/ComplexTestCase.java index 4fb5d757fb0e..f31cf1810106 100644 --- a/qadevOOo/runner/complexlib/ComplexTestCase.java +++ b/qadevOOo/runner/complexlib/ComplexTestCase.java @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package complexlib; import java.lang.reflect.Method; @@ -38,11 +37,11 @@ import share.LogWriter; import share.ComplexTest; import java.io.PrintWriter; - /** * Base class for all complex tests. */ -public abstract class ComplexTestCase extends Assurance implements ComplexTest { +public abstract class ComplexTestCase extends Assurance implements ComplexTest +{ /** The test parameters **/ protected static TestParameters param = null; @@ -70,31 +69,42 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { * @param entry The name of the test method that should be called. * @param environment The environment for the test. */ - public void executeMethods(DescEntry entry, TestParameters environment) { + public void executeMethods(DescEntry entry, TestParameters environment) + { // get the environment param = environment; log = entry.Logger; mThreadTimeOut = param.getInt("ThreadTimeOut"); - if (mThreadTimeOut == 0) { + if (mThreadTimeOut == 0) + { mThreadTimeOut = 300000; } // start with the before() method boolean beforeWorked = true; - try { - Method before = this.getClass().getMethod("before", new Class[]{}); - before.invoke(this, new Object[]{}); - } catch (java.lang.NoSuchMethodException e) { + try + { + Method before = this.getClass().getMethod("before", new Class[] {} ); + before.invoke(this, new Object[] {} ); + } + catch (java.lang.NoSuchMethodException e) + { // simply ignore - } catch (java.lang.IllegalAccessException e) { + } + catch (java.lang.IllegalAccessException e) + { log.println("Cannot access the 'before()' method, although it" + " is there. Is this ok?"); - } catch (java.lang.reflect.InvocationTargetException e) { + } + catch (java.lang.reflect.InvocationTargetException e) + { beforeWorked = false; Throwable t = e.getTargetException(); - if (!(t instanceof RuntimeException) || state) { + if (!(t instanceof RuntimeException) || state) + { log.println(t.toString()); - if (message == null) { + if (message == null) + { message = "Exception in before() method.\n\r" + t.getMessage(); } state = false; @@ -104,12 +114,16 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { //executeMethodTests - for (int i = 0; i < entry.SubEntries.length; i++) { + for (int i = 0; i < entry.SubEntries.length; i++) + { subEntry = entry.SubEntries[i]; - if (beforeWorked) { + if (beforeWorked) + { state = true; message = ""; - } else { + } + else + { // set all test methods on failed, if 'before()' did not work. subEntry.State = message; subEntry.hasErrorMsg = true; @@ -117,18 +131,25 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { continue; } Method testMethod = null; - try { + try + { String entryName = subEntry.entryName; Object[] parameter = null; - if (entryName.indexOf("(") != -1) { - String sParameter = (entryName.substring(entryName.indexOf("(") +1 , entryName.indexOf(")"))); + if (entryName.indexOf("(") != -1) + { + String sParameter = (entryName.substring(entryName.indexOf("(") + 1, entryName.indexOf(")"))); mTestMethodName = entryName; - parameter = new String[] {sParameter}; + parameter = new String[] + { + sParameter + }; entryName = entryName.substring(0, entryName.indexOf("(")); - testMethod = this.getClass().getMethod(entryName, new Class[]{String.class }); - } else { - testMethod = this.getClass().getMethod(entryName, new Class[]{}); + testMethod = this.getClass().getMethod(entryName, new Class[] { String.class }); + } + else + { + testMethod = this.getClass().getMethod(entryName, new Class[] {} ); mTestMethodName = entryName; } @@ -136,7 +157,8 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { log.println("Starting " + mTestMethodName); th.start(); - try { + try + { // some tests are very dynamic in its exceution time so that // a threadTimeOut fials. In this cases the logging mechanisim // is a usefull way to detect that a office respective a test @@ -150,38 +172,48 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { int sleepingStep = 1000; int factor = 0; - while (th.isAlive() && (lastPing != newPing || factor * sleepingStep < mThreadTimeOut)) { + while (th.isAlive() && (lastPing != newPing || factor * sleepingStep < mThreadTimeOut)) + { Thread.sleep(sleepingStep); factor++; // if a test starts the office itself it the watcher is a // new one. share.Watcher ow = (share.Watcher) param.get("Watcher"); - if (ow != null) { + if (ow != null) + { lastPing = newPing; newPing = ow.getPing(); //System.out.println("lastPing: '" + lastPing + "' newPing '" + newPing + "'"); factor = 0; } } - } catch (InterruptedException e) { } - if (th.isAlive()) { + catch (InterruptedException e) + { + } + if (th.isAlive()) + { log.println("Destroy " + mTestMethodName); th.destroy(); subEntry.State = "Test did sleep for " + (mThreadTimeOut / 1000) + " seconds and has been killed!"; subEntry.hasErrorMsg = true; subEntry.ErrorMsg = subEntry.State; continue; - } else { + } + else + { log.println("Finished " + mTestMethodName); - if (th.hasErrorMessage()) { + if (th.hasErrorMessage()) + { subEntry.State = th.getErrorMessage(); subEntry.hasErrorMsg = true; subEntry.ErrorMsg = subEntry.State; continue; } } - } catch (java.lang.Exception e) { + } + catch (java.lang.Exception e) + { log.println(e.getClass().getName()); String msg = e.getMessage(); log.println("Message: " + msg); @@ -196,22 +228,34 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { subEntry.ErrorMsg = message; } - if (beforeWorked) { + if (beforeWorked) + { // the after() method - try { - Method after = this.getClass().getMethod("after", new Class[]{}); - after.invoke(this, new Object[]{}); - } catch (java.lang.NoSuchMethodException e) { + try + { + Method after = this.getClass().getMethod("after", new Class[] {}); + after.invoke(this, new Object[] {} ); + } + catch (java.lang.NoSuchMethodException e) + { // simply ignore - } catch (java.lang.IllegalAccessException e) { + } + catch (java.lang.IllegalAccessException e) + { // simply ignore - } catch (java.lang.reflect.InvocationTargetException e) { + } + catch (java.lang.reflect.InvocationTargetException e) + { Throwable t = e.getTargetException(); - if (!(t instanceof StatusException)) { + if (!(t instanceof StatusException)) + { log.println(t.toString()); - if (message == null) { + if (message == null) + { message = "Exception in after() method.\n\r" + t.getMessage(); - } else { + } + else + { message += "Exception in \'after()\' method.\n\r" + t.getMessage(); } log.println("Message: " + message); @@ -232,9 +276,8 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { * Override to give an own name. * @return As default, the name of this class. */ - public String getTestObjectName() { + public String getTestObjectName() + { return this.getClass().getName(); } - - }
\ No newline at end of file |