Changeset 4199
- Timestamp:
- 04/18/08 13:45:30 (8 months ago)
- Location:
- ToolkitAutomatedTesting
- Files:
-
- 6 modified
-
config.xml (modified) (2 diffs)
-
src/com/itmill/toolkit/automatedtests/client/Email.java (modified) (1 diff)
-
src/com/itmill/toolkit/automatedtests/client/LaunchToolkitTests.java (modified) (6 diffs)
-
src/com/itmill/toolkit/automatedtests/client/TestResult.java (modified) (3 diffs)
-
src/com/itmill/toolkit/automatedtests/client/TestRun.java (modified) (1 diff)
-
src/com/itmill/toolkit/automatedtests/client/Util.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ToolkitAutomatedTesting/config.xml
r4174 r4199 24 24 <!-- Define alerts, what triggers email sending --> 25 25 <alert> 26 <!-- alert if memory consumption for subsequent testruns changes more than 5% -->27 <memconsumptionchangepercent>0. 05</memconsumptionchangepercent>28 <!-- alert if execution time for subsequent testcases changes more than 5% -->29 <exectimechangepercent>0. 05</exectimechangepercent>26 <!-- alert if memory consumption for subsequent testruns changes more than 10% --> 27 <memconsumptionchangepercent>0.1</memconsumptionchangepercent> 28 <!-- alert if execution time for subsequent testcases changes more than 10% --> 29 <exectimechangepercent>0.1</exectimechangepercent> 30 30 </alert> 31 31 … … 157 157 <testcase> 158 158 <script>robustness-complex.txt</script> 159 <timeout> 300</timeout>159 <timeout>200</timeout> 160 160 <target>3</target> 161 161 <host>0</host> -
ToolkitAutomatedTesting/src/com/itmill/toolkit/automatedtests/client/Email.java
r4161 r4199 39 39 40 40 // send the email 41 email.send(); 42 41 try { 42 email.send(); 43 } catch (org.apache.commons.mail.EmailException e) { 44 System.err.println("Could not send email, reason: " 45 + e.getMessage()); 46 } 43 47 } 44 48 } -
ToolkitAutomatedTesting/src/com/itmill/toolkit/automatedtests/client/LaunchToolkitTests.java
r4170 r4199 153 153 private void executeTestcases(HierarchicalConfiguration testRun) 154 154 throws Exception { 155 // Get testrun name 155 156 String name = testRun.getString("name"); 156 157 … … 164 165 165 166 // Get used memory before testrun 166 Long memoryUsedBefore = ToolkitStatus.getMemoryUsage(1 20);167 Long memoryUsedBefore = ToolkitStatus.getMemoryUsage(180); 167 168 168 169 TestRun run = new TestRun(name); … … 233 234 234 235 // wait task to finish 235 Thread.sleep( 8000);236 int pollCount = (timeout - 8) * 4;236 Thread.sleep(6000); 237 int pollCount = (timeout - 6) * 2; 237 238 TaskStatus taskStatus = TaskStatus.NOT_STARTED; 238 239 while (pollCount > 0) { 239 240 pollCount--; 240 // poll every 250ms241 Thread.sleep( 250);241 // poll every 500ms 242 Thread.sleep(500); 242 243 taskStatus = api.getTaskStatus(taskId); 243 244 if (taskStatus != TaskStatus.RUNNING) … … 248 249 // Store test result 249 250 if (taskStatus == TaskStatus.FINISHED) { 250 String testCaseHtmlRaport = api.getTaskResults(taskId).get(0); 251 // Modify test result: 252 // open "Details" and "Script" divs by default 253 // also makes backbutton to work correctly 254 testCaseHtmlRaport = testCaseHtmlRaport.replaceAll( 255 "\\<div style=\"display:none\"\\>", "<div style=\"\">"); 256 if (testCaseHtmlRaport.contains("<title>Passed:")) { 251 String testReport = api.getTaskResults(taskId).get(0); 252 // Open raport divs, which are normally hidden 253 testReport = TestResult.openDivs(testReport); 254 // Update started end ended from testresult 255 try { 256 String started = TestResult.getId(testReport, "started"); 257 if (started != null) 258 result.setStart(Util.dfTestResult.parse(started)); 259 String ended = TestResult.getId(testReport, "ended"); 260 if (ended != null) 261 result.setEnd(Util.dfTestResult.parse(ended)); 262 } catch (Exception ignored) { 263 } 264 // Get status 265 if (testReport.contains("<title>Passed:")) { 257 266 status = Status.PASSED; 258 267 } else { … … 262 271 + testcaseName + ".html"; 263 272 Util.writeFile("results" + File.separator + filename, 264 test CaseHtmlRaport);273 testReport); 265 274 result.setTestresultLink(filename); 266 275 } else { … … 303 312 304 313 LaunchToolkitTests client = new LaunchToolkitTests(); 305 // test locally: for (int i = 0; i < 1000; i++) 306 client.executeTestRuns(); 314 // test locally: 315 for (int i = 0; i < 1000; i++) 316 client.executeTestRuns(); 307 317 308 318 } catch (Exception e) { -
ToolkitAutomatedTesting/src/com/itmill/toolkit/automatedtests/client/TestResult.java
r4161 r4199 4 4 import java.math.BigDecimal; 5 5 import java.util.Date; 6 import java.util.regex.Matcher; 7 import java.util.regex.Pattern; 6 8 7 9 /** … … 76 78 float f = (float) (end.getTime() - start.getTime()) / 1000; 77 79 BigDecimal dec = new BigDecimal(f); 78 dec = dec.setScale( 2, BigDecimal.ROUND_HALF_UP);80 dec = dec.setScale(1, BigDecimal.ROUND_HALF_UP); 79 81 return dec.toString(); 80 82 } … … 88 90 } 89 91 92 /** 93 * Modify test result: open "Details" and "Script" divs by default also 94 * makes backbutton to work correctly. 95 * 96 * @param testResult 97 * @return 98 */ 99 public static String openDivs(String testResult) { 100 return testResult.replaceAll("\\<div style=\"display:none\"\\>", 101 "<div style=\"\">"); 102 } 103 104 public static String getId(String testResult, String id) { 105 Pattern pattern = Pattern.compile("<td id=\"" + id + "\">(.*)</td>"); 106 Matcher matcher = pattern.matcher(testResult); 107 if (matcher.find()) 108 return matcher.group(1); 109 else 110 return null; 111 } 112 90 113 } -
ToolkitAutomatedTesting/src/com/itmill/toolkit/automatedtests/client/TestRun.java
r4170 r4199 121 121 float f = (float) (end.getTime() - start.getTime()) / 1000; 122 122 BigDecimal dec = new BigDecimal(f); 123 dec = dec.setScale( 2, BigDecimal.ROUND_HALF_UP);123 dec = dec.setScale(1, BigDecimal.ROUND_HALF_UP); 124 124 return dec.toString(); 125 125 } -
ToolkitAutomatedTesting/src/com/itmill/toolkit/automatedtests/client/Util.java
r4161 r4199 15 15 16 16 public static DateFormat dfHuman = new SimpleDateFormat("yyyy-MM-dd HH:mm"); 17 18 public static DateFormat dfTestResult = new SimpleDateFormat( 19 "yyyy-MM-dd HH:mm:ss.S"); 17 20 18 21 // read file to String
