Thread: [Jameleon-cvscommits] SF.net SVN: jameleon: [1450] trunk/jameleon-core (Page 2)
Brought to you by:
engrean
From: <se...@us...> - 2007-02-26 05:25:41
|
Revision: 1450 http://svn.sourceforge.net/jameleon/?rev=1450&view=rev Author: selie Date: 2007-02-25 21:25:39 -0800 (Sun, 25 Feb 2007) Log Message: ----------- Modified results for error message/stacktrace display. Added auto expand to error messages Added icons/stacktrace.gif to expand stacktrace Added link from failures summary to error message Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsTemplate.txt trunk/jameleon-core/res/testCaseDocs.css trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java Added Paths: ----------- trunk/jameleon-core/res/icons/stacktrace.gif Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-02-26 05:21:12 UTC (rev 1449) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-02-26 05:25:39 UTC (rev 1450) @@ -1,9 +1,9 @@ <div> - <img src="../../res/icons/${results.getOutcome()}.gif"> + <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_$results.getRowNum()_data')"><i>i</i></a> <img onclick="showBranch('$results.hashCode()_$results.getRowNum()');swapIcon('$results.hashCode()_$results.getRowNum()','$results.hashCode()_$results.getRowNum()_img')" - src="../../res/icons/plus.gif" border="0" id="$results.hashCode()_$results.getRowNum()_img"> + src="${results_res_dir}/icons/plus.gif" border="0" id="$results.hashCode()_$results.getRowNum()_img"> $shortDesc - row $results.getRowNum() </div> @@ -46,7 +46,12 @@ </td></tr></table> </blockquote> </span> -<span id="$results.hashCode()_$results.getRowNum()" class="branch"> +#if ($results.failed()) + #set( $class = "branch_displayed") +#else + #set( $class = "branch") +#end +<span id="$results.hashCode()_$results.getRowNum()" class="$class"> #parse("TestCaseResultsChildTemplate.txt") </span> Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-02-26 05:21:12 UTC (rev 1449) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-02-26 05:25:39 UTC (rev 1450) @@ -1,23 +1,26 @@ -<img src="../../res/icons/bullet.gif"> -<img src="../../res/icons/${results.getOutcome()}.gif"> +<img src="${results_res_dir}/icons/bullet.gif"> +<img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_data')"><i>i</i></a> <img onclick="showBranch('$results.hashCode()');swapIcon('$results.hashCode()','$results.hashCode()_img')" - src="../../res/icons/plus.gif" border="0" id="$results.hashCode()_img"> + src="${results_res_dir}/icons/plus.gif" border="0" id="$results.hashCode()_img"> #if ( $results.errorFile ) -<a href="$results.errorFile.name"><img src="../../res/icons/snapShot.gif"></a> +<a href="$results.errorFile.name"><img src="${results_res_dir}/icons/snapShot.gif"></a> #end -$shortDesc<br/> - +<a name="$results.hashCode()">$shortDesc</a><br/> #if ( $results.failed() ) -<br/> -<pre> -#if ($results.errorMsg) -$results.errorMsg -#end + <span id="$results.hashCode()_errMsg" class="errMsg"> + <img onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> + #if ($results.errorMsg) + $results.errorMsg + #else + See stacktrace for details + #end + </span> + <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> #foreach ( $st in $results.error.stackTrace ) -$st + $st<br/> #end -</pre> + </span> #end <span id="$results.hashCode()_data" class="branch"> @@ -49,4 +52,4 @@ #end </ol> </blockquote> -</span> \ No newline at end of file +</span> Modified: trunk/jameleon-core/res/TestCaseResultsTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-02-26 05:21:12 UTC (rev 1449) +++ trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-02-26 05:25:39 UTC (rev 1450) @@ -2,8 +2,8 @@ <head> <title>$!tc.name Documentation</title> - <style type="text/css" media="all">@import url("../../res/testCaseDocs.css");</style> - <script language="JavaScript" src="../../res/testCaseDocs.js"></script> + <style type="text/css" media="all">@import url("${results_res_dir}/testCaseDocs.css");</style> + <script language="JavaScript" src="${results_res_dir}/testCaseDocs.js"></script> </head> <body> <table width="100%" cellspacing="0" class="fields"> @@ -61,18 +61,11 @@ <td>$results.getCountableResults().size()</td> <td>$results.getFailedCountableResults().size()</td> <td>To Be Calculated</td> - <td> - #foreach ( $failedResult in $results.getFailedCountableResults() ) - #if ( $failedResult.isParent() ) - ## This has to be recursive - #foreach ( $failedResult2 in $failedResult.getChildrenResults() ) - $failedResult2.getErrorMsg() <br/> - #end - #else - $failedResult.getErrorMsg() - #end + <td class="failures"> + #foreach ( $result in $results.getAllFailedLeafChildrenResults() ) + <a href="#$result.hashCode()">$result.errorMsg</a> <br/> #end - </td> + </td> </tr> </table> <hr> Added: trunk/jameleon-core/res/icons/stacktrace.gif =================================================================== (Binary files differ) Property changes on: trunk/jameleon-core/res/icons/stacktrace.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/jameleon-core/res/testCaseDocs.css =================================================================== --- trunk/jameleon-core/res/testCaseDocs.css 2007-02-26 05:21:12 UTC (rev 1449) +++ trunk/jameleon-core/res/testCaseDocs.css 2007-02-26 05:25:39 UTC (rev 1450) @@ -44,6 +44,12 @@ font-weight: bold; white-space: nowrap; } +td.failures { + font-weight: bold; + white-space: nowrap; + font-weight: bold; + color: #ff0000; ; +} body{ font: 10pt Verdana,sans-serif; color: navy; @@ -53,5 +59,21 @@ margin-left: 16px; } .branch_displayed{ + display: block; margin-left: 16px; } +.errMsg{ + font: 10pt Verdana,sans-serif; + font-weight: bold; + color: #ff0000; ; + margin-left: 16px; +} +.stacktrace{ + font: 8pt Verdana,sans-serif; + color: #ff0000; ; + margin-left: 32px; +} +ol.steps_value{ + font: 8pt Verdana,sans-serif; + font-style: italic; +} \ No newline at end of file Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-02-26 05:21:12 UTC (rev 1449) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-02-26 05:25:39 UTC (rev 1450) @@ -98,6 +98,7 @@ protected boolean executeTestCase = true; protected String genTestCaseDocsTemplate = GEN_TEST_CASE_DOCS_TEMPLATE_DEFAULT; public static final String GEN_TEST_CASE_DOCS_TEMPLATE_DEFAULT = "TestCaseResultsTemplate.txt"; + private static final String RESULTS_RES_DIR = "../../res"; protected TestCaseEventHandler eventHandler = TestCaseEventHandler.getInstance(); protected long startTime; protected File resultsFile; @@ -117,7 +118,8 @@ protected TestCaseResult results; //TODO: Remove this. This is a workaround to get correct failed and passed results - protected DataDrivableResult ddResult; + protected DataDrivableResult ddResult; + //TODO: Remove this also. Additional getter required to get row number in session tag if useCSV=true public DataDrivableResult getDdResult() { return ddResult; @@ -911,6 +913,7 @@ vars.put("tc", getTestCase()); vars.put("results", getResults()); vars.put("printFileName", Boolean.TRUE); + vars.put("results_res_dir", RESULTS_RES_DIR); xfrmr.transform(htmlFile, vars); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-02-26 17:00:56
|
Revision: 1452 http://svn.sourceforge.net/jameleon/?rev=1452&view=rev Author: engrean Date: 2007-02-26 09:00:54 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added support for displaying the attribute value in a more human-readable format. For now, String, Lists and Expressions are supported Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/bean/Attribute.java trunk/jameleon-core/tst/java/net/sf/jameleon/bean/AttributeTest.java Property Changed: ---------------- trunk/jameleon-core/ Property changes on: trunk/jameleon-core ___________________________________________________________________ Name: svn:ignore - .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders + .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders velocity.log.1 Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-02-26 14:02:51 UTC (rev 1451) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-02-26 17:00:54 UTC (rev 1452) @@ -19,10 +19,10 @@ <th>value</th> </tr> #foreach ( $attr in $results.getTag().getAttributes() ) - #if ( $attr.isValueSet() ) + #if ( $attr.isValueSet() && !$attr.name.equals('functionId') ) <tr> <td>$attr.getName()</td> - <td>$attr.getValue()</td> + <td>$attr.getDisplayedValue()</td> </tr> #end #end Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-02-26 14:02:51 UTC (rev 1451) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-02-26 17:00:54 UTC (rev 1452) @@ -34,10 +34,10 @@ <th>value</th> </tr> #foreach ( $attr in $results.tag.attributes ) - #if ( $attr.valueSet ) + #if ( $attr.valueSet && !$attr.name.equals('functionId')) <tr> <td>$attr.name</td> - <td>$attr.value</td> + <td>$attr.displayedValue</td> </tr> #end #end Modified: trunk/jameleon-core/src/java/net/sf/jameleon/bean/Attribute.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/bean/Attribute.java 2007-02-26 14:02:51 UTC (rev 1451) +++ trunk/jameleon-core/src/java/net/sf/jameleon/bean/Attribute.java 2007-02-26 17:00:54 UTC (rev 1452) @@ -18,6 +18,8 @@ import net.sf.jameleon.XMLable; +import org.apache.commons.jelly.expression.Expression; + public class Attribute implements XMLable, Cloneable{ private static final long serialVersionUID = 1L; /** @@ -172,6 +174,17 @@ } /** + * @return The displayable value of the attribute + */ + public String getDisplayedValue(){ + String returnValue = value.toString(); + if (value instanceof Expression && value != null){ + returnValue = ((Expression)value).getExpressionText(); + } + return returnValue; + } + + /** * Gets the name of the context variable that the value of the this attribute will be bound to * @return The name of context variable that the value of this attribute will be bound to */ Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/bean/AttributeTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/bean/AttributeTest.java 2007-02-26 14:02:51 UTC (rev 1451) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/bean/AttributeTest.java 2007-02-26 17:00:54 UTC (rev 1452) @@ -25,6 +25,10 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.jelly.expression.CompositeExpression; +import org.apache.commons.jelly.expression.Expression; +import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory; + public class AttributeTest extends TestCase{ private Attribute attr = null; @@ -54,6 +58,19 @@ } //End JUnit Methods + public void testGetDisplayedValue() throws Exception{ + attr.setValue(A_NAME); + assertEquals("value with string", A_NAME, attr.getDisplayedValue()); + VALUE.add(A_NAME); + VALUE.add(C_NAME); + VALUE.add(D_VALUE); + attr.setValue(VALUE); + assertEquals("["+A_NAME+", "+C_NAME+", "+ D_VALUE+"]", attr.getDisplayedValue()); + final Expression exp = CompositeExpression.parse("${some} text", new JexlExpressionFactory()); + attr.setValue(exp); + assertEquals(exp.getExpressionText(), attr.getDisplayedValue()); + } + public void testClone(){ attr.setContextName(C_NAME); attr.setDefaultValue(D_VALUE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2007-03-09 04:50:04
|
Revision: 1459 http://svn.sourceforge.net/jameleon/?rev=1459&view=rev Author: selie Date: 2007-03-08 20:50:01 -0800 (Thu, 08 Mar 2007) Log Message: ----------- Fixed Bugs item #1676944 Spaces are now ignored for the variable names row. If quotes are used, the spaces within the quotes will stay but the spaces outside the quotes are ignored. Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/data/CsvDataDriver.java trunk/jameleon-core/tst/java/net/sf/jameleon/data/CsvDataDriverTest.java Added Paths: ----------- trunk/jameleon-core/etc/test/csvSpacesInVarNames.csv trunk/jameleon-core/tst/xml/acceptance/csvSpacesInVarNames.xml Added: trunk/jameleon-core/etc/test/csvSpacesInVarNames.csv =================================================================== --- trunk/jameleon-core/etc/test/csvSpacesInVarNames.csv (rev 0) +++ trunk/jameleon-core/etc/test/csvSpacesInVarNames.csv 2007-03-09 04:50:01 UTC (rev 1459) @@ -0,0 +1,2 @@ +varname1,varname2 , varname3, varname4 , varname5 +value1,value2,value3,value4,value5 Property changes on: trunk/jameleon-core/etc/test/csvSpacesInVarNames.csv ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/src/java/net/sf/jameleon/data/CsvDataDriver.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/data/CsvDataDriver.java 2007-03-09 01:42:23 UTC (rev 1458) +++ trunk/jameleon-core/src/java/net/sf/jameleon/data/CsvDataDriver.java 2007-03-09 04:50:01 UTC (rev 1459) @@ -150,7 +150,7 @@ } if (line != null) { vars = new HashMap(); - List values = parseLine(line); + List values = parseLine(line, false); if (values.size() > keys.size()) { throw new IllegalStateException(csvFile.getPath() + " has more values than keys!"); } @@ -192,7 +192,7 @@ if (keys.size() == 0) { getNextUcommentedLine(); if (line != null) { - keys = parseLine(line); + keys = parseLine(line, true); line = null; } } @@ -213,67 +213,26 @@ return moreRows; } - /** - * Puts the string between the delimeter in sb - * and returns the next position of the cursor. - */ - protected int advancePlain(String s, StringBuffer sb, int i) { - int j = s.indexOf(delimiter, i); // look for separator - int index = 0; - if ( j == -1 ) { // none found - sb.append(s.substring(i)); - index = s.length(); - } else { - sb.append(s.substring(i, j)); - index = j; - } - return index; - } + protected List parseLine(String line, boolean keysLine){ - /** - * Puts the string between the quotes in sb - * and returns the next position of the cursor. - */ - protected int advanceQuoted(String s, StringBuffer sb, int i) { - int j; - int len= s.length(); - for (j=i; j<len; j++) { - if (s.charAt(j) == '"' && j+1 < len) { - if (s.charAt(j+1) == '"') { - j++; // skip escape char - } else if (s.charAt(j+1) == delimiter) { //next delimeter - j++; // skip end quotes - break; - } - } else if ( s.charAt(j) == '"' && j+1 == len ){ // end quotes at end of line - break; //done - } - sb.append(s.charAt(j)); // regular character. - } - return j; - } - - protected List parseLine(String line){ - - StringBuffer sb = new StringBuffer(); List list = new ArrayList(); - int i = 0; + if (isLineCommented(line)) { return list; } - if (line.length() > 0 && !isLineCommented(line)) { - do { - sb.setLength(0); - if (i < line.length() && line.charAt(i) == '"'){ - i = advanceQuoted(line, sb, ++i); // skip quote - }else{ - i = advancePlain(line, sb, i); + String[] values = line.split( "\\"+String.valueOf(delimiter), -1 ); + for (int i = 0; i < values.length; i++) { + String value = values[i]; + String trimmedValue = value.trim(); + if ( trimmedValue.startsWith("\"") && trimmedValue.endsWith("\"") ) { + list.add( trimmedValue.subSequence(1, trimmedValue.length()-1) ); + } else { + if (keysLine) { + list.add(trimmedValue); + } else { + list.add(value); } - list.add(sb.toString()); - if (i == line.length() - 1 && line.charAt(i) == ',') { - list.add(""); - } - i++; - } while (i < line.length()); + } } + return list; } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/data/CsvDataDriverTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/data/CsvDataDriverTest.java 2007-03-09 01:42:23 UTC (rev 1458) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/data/CsvDataDriverTest.java 2007-03-09 04:50:01 UTC (rev 1459) @@ -19,16 +19,16 @@ */ package net.sf.jameleon.data; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; import java.util.Map; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - public class CsvDataDriverTest extends TestCase { protected DataExecuter dd; @@ -135,76 +135,89 @@ assertNull("Data row should be null when read from invalid file",vars); } - public void testAdvancePlain(){ - StringBuffer b = new StringBuffer(); - String str = "some,values"; - int index = csvD.advancePlain(str,b,0); - assertEquals("index of next delimeter",4,index); - assertEquals("String that should be in the buffer","some",b.toString()); - b.setLength(0); - index = csvD.advancePlain(str,b,5); - assertEquals("index of next delimeter",str.length(), index); - assertEquals("String that should be in the buffer","values",b.toString()); - str = ",someval1,someval2,"; - b.setLength(0); - index = csvD.advancePlain(str,b,0); - assertEquals("index of next delimeter",0, index); - assertEquals("String that should be in the buffer","",b.toString()); - b.setLength(0); - index = csvD.advancePlain(str,b,1); - assertEquals("index of next delimeter",9, index); - assertEquals("String that should be in the buffer","someval1",b.toString()); - b.setLength(0); - index = csvD.advancePlain(str, b, index+1); - assertEquals("index of next delimeter",18, index); - assertEquals("String that should be in the buffer","someval2",b.toString()); - b.setLength(0); - index = csvD.advancePlain(str, b, index+1); - assertEquals("index of next delimeter",19, index); - assertEquals("String that should be in the buffer","",b.toString()); - } - - public void testAdvanceQuoted(){ - StringBuffer b = new StringBuffer(); - String str = "\"some\",\"values\""; - int index = csvD.advanceQuoted(str,b,1); - assertEquals("index of next delimeter",6,index); - assertEquals("1st String that should be in the buffer","some",b.toString()); - b.setLength(0); - index = csvD.advanceQuoted(str,b,8); - assertEquals("index of next delimeter",str.length()-1, index); - assertEquals("2nd String that should be in the buffer","values",b.toString()); - } - - public void testParseLine(){ + public void testParseValueLine(){ String str = "var1,var2"; - doLineTest(csvD.parseLine(str)); + doLineTest(csvD.parseLine(str,false)); str = "\"var1\",\"var2\""; - doLineTest(csvD.parseLine(str)); + doLineTest(csvD.parseLine(str,false)); str = "var1,\"var2\""; - doLineTest(csvD.parseLine(str)); + doLineTest(csvD.parseLine(str,false)); str = "\"var1\",var2"; - doLineTest(csvD.parseLine(str)); + doLineTest(csvD.parseLine(str,false)); str = "var1,"; - List values = csvD.parseLine(str); + List values = csvD.parseLine(str,false); assertEquals("Number of values in line", 2, values.size()); assertEquals("var1",(String)values.get(0)); assertEquals("",(String)values.get(1)); str = ",,,"; - values = csvD.parseLine(str); + values = csvD.parseLine(str,false); assertEquals("Number of values in line", 4, values.size()); assertEquals("",(String)values.get(0)); assertEquals("",(String)values.get(1)); assertEquals("",(String)values.get(2)); assertEquals("",(String)values.get(3)); + str = " var1,var2 "; + values = csvD.parseLine(str,false); + assertEquals("Number of values in line", 2, values.size()); + assertEquals(" var1",(String)values.get(0)); + assertEquals("var2 ",(String)values.get(1)); + str = "var1 , var2"; + values = csvD.parseLine(str,false); + assertEquals("Number of values in line", 2, values.size()); + assertEquals("var1 ",(String)values.get(0)); + assertEquals(" var2",(String)values.get(1)); + str = " var1 , var2 "; + values = csvD.parseLine(str,false); + assertEquals("Number of values in line", 2, values.size()); + assertEquals(" var1 ",(String)values.get(0)); + assertEquals(" var2 ",(String)values.get(1)); + str = " \" var1 \", \" var2 \" "; + values = csvD.parseLine(str,false); + assertEquals("Number of values in line", 2, values.size()); + assertEquals(" var1 ",(String)values.get(0)); + assertEquals(" var2 ",(String)values.get(1)); } + public void testParseKeyLine(){ + String str = "var1 , var2"; + doLineTest(csvD.parseLine(str,true)); + str = " var1,var2 "; + doLineTest(csvD.parseLine(str,true)); + str = " var1 , var2 "; + doLineTest(csvD.parseLine(str,true)); + str = " \"var1\",\"var2\" "; + doLineTest(csvD.parseLine(str,true)); + str = "\"var1\" , \"var2\""; + doLineTest(csvD.parseLine(str,true)); + str = "var1 , \"var2\" "; + doLineTest(csvD.parseLine(str,true)); + str = "\"var1\" , var2 "; + doLineTest(csvD.parseLine(str,true)); + str = "var1,"; + List values = csvD.parseLine(str,true); + assertEquals("Number of values in line", 2, values.size()); + assertEquals("var1",(String)values.get(0)); + assertEquals("",(String)values.get(1)); + str = ",,,"; + values = csvD.parseLine(str,true); + assertEquals("Number of values in line", 4, values.size()); + assertEquals("",(String)values.get(0)); + assertEquals("",(String)values.get(1)); + assertEquals("",(String)values.get(2)); + assertEquals("",(String)values.get(3)); + str = " \" var1 \" , \" var2 \" "; + values = csvD.parseLine(str,false); + assertEquals("Number of values in line", 2, values.size()); + assertEquals(" var1 ",(String)values.get(0)); + assertEquals(" var2 ",(String)values.get(1)); + } + public void testParseLineWithComment(){ String str = "#var1,var2"; - List values = csvD.parseLine(str); + List values = csvD.parseLine(str,false); assertEquals("No values in list", 0, values.size()); str = "var1,#var2"; - values = csvD.parseLine(str); + values = csvD.parseLine(str,false); assertEquals("No values in list", 2, values.size()); } Added: trunk/jameleon-core/tst/xml/acceptance/csvSpacesInVarNames.xml =================================================================== --- trunk/jameleon-core/tst/xml/acceptance/csvSpacesInVarNames.xml (rev 0) +++ trunk/jameleon-core/tst/xml/acceptance/csvSpacesInVarNames.xml 2007-03-09 04:50:01 UTC (rev 1459) @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- + Jameleon - An automation testing tool.. + Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> +<testcase xmlns="jelly:jameleon" useCSV="true"> + <test-case-summary>Tests that leading and trailing spaces are removed from CSV variables names</test-case-summary> + <test-case-author>Stephane Elie</test-case-author> + <test-case-level>ACCEPTANCE</test-case-level> + <test-case-level>REGRESSION</test-case-level> + <test-case-bug>1676944</test-case-bug> + <functional-point-tested>csv</functional-point-tested> + <application-tested>framework</application-tested> + + <junit-session application="junit"> + <junit-simple-compare-2-vars functionId="Verify that the name var1 is OK" var1="${varname1}" var2="value1"/> + <junit-simple-compare-2-vars functionId="Verify that the name var2 is OK" var1="${varname2}" var2="value2"/> + <junit-simple-compare-2-vars functionId="Verify that the name var3 is OK" var1="${varname3}" var2="value3"/> + <junit-simple-compare-2-vars functionId="Verify that the name var4 is OK" var1="${varname4}" var2="value4"/> + <junit-simple-compare-2-vars functionId="Verify that the name var5 is OK" var1="${varname5}" var2="value5"/> + </junit-session> +</testcase> Property changes on: trunk/jameleon-core/tst/xml/acceptance/csvSpacesInVarNames.xml ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-09 15:52:14
|
Revision: 1465 http://svn.sourceforge.net/jameleon/?rev=1465&view=rev Author: engrean Date: 2007-03-09 07:52:06 -0800 (Fri, 09 Mar 2007) Log Message: ----------- First try at auto-expanding results when countRow = false Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/res/testCaseDocs.js trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java Property Changed: ---------------- trunk/jameleon-core/ Property changes on: trunk/jameleon-core ___________________________________________________________________ Name: svn:ignore - .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders velocity.log.1 + .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders velocity.log.1 target Modified: trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-09 15:52:06 UTC (rev 1465) @@ -3,6 +3,11 @@ #set( $shortDesc = $results.identifier ) #if ($results.dataDriven) + #if ($results.isA("net.sf.jameleon.result.CountableResult")) + #set( $countRow = "true") + #else + #set( $countRow = "false") + #end #parse("TestCaseResultsDataDrivenChildTemplate.txt") #elseif ($results.parent) <b>Steps for <i>$results.elementName</i></b><br/> Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-09 15:52:06 UTC (rev 1465) @@ -1,3 +1,8 @@ +#if($countRow == "false" || $results.failed()) + #set ($expandIcon = "minus.gif") +#else + #set ($expandIcon = "plus.gif") +#end <div> <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> @@ -3,5 +8,5 @@ <a href="javascript:showInfo('$results.hashCode()_$results.getRowNum()_data')"><i>i</i></a> <img onclick="showBranch('$results.hashCode()_$results.getRowNum()');swapIcon('$results.hashCode()_$results.getRowNum()','$results.hashCode()_$results.getRowNum()_img')" - src="${results_res_dir}/icons/plus.gif" border="0" id="$results.hashCode()_$results.getRowNum()_img"> + src="${results_res_dir}/icons/${expandIcon}" border="0" id="$results.hashCode()_$results.getRowNum()_img"> $shortDesc - row $results.getRowNum() </div> @@ -46,12 +51,11 @@ </td></tr></table> </blockquote> </span> -#if ($results.failed()) +#if ($results.failed() || $countRow == "false") #set( $class = "branch_displayed") #else #set( $class = "branch") #end <span id="$results.hashCode()_$results.getRowNum()" class="$class"> #parse("TestCaseResultsChildTemplate.txt") -</span> - +</span> \ No newline at end of file Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-09 15:52:06 UTC (rev 1465) @@ -1,3 +1,8 @@ +#if ($countRow == "true") + #set($class = "branch") +#else + #set($class = "branch_displayed") +#end <img src="${results_res_dir}/icons/bullet.gif"> <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_data')"><i>i</i></a> Modified: trunk/jameleon-core/res/testCaseDocs.js =================================================================== --- trunk/jameleon-core/res/testCaseDocs.js 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/res/testCaseDocs.js 2007-03-09 15:52:06 UTC (rev 1465) @@ -4,8 +4,7 @@ closedImg.src = "../../res/icons/plus.gif"; function showBranch(branch) { - var objBranch = - document.getElementById(branch).style; + var objBranch = document.getElementById(branch).style; if(objBranch.display=="block") objBranch.display="none"; else @@ -13,8 +12,7 @@ } function swapIcon(branch,img) { - var objBranch = - document.getElementById(branch).style; + var objBranch = document.getElementById(branch).style; objImg = document.getElementById(img); if(objBranch.display=="block") objImg.src = openImg.src; @@ -23,8 +21,7 @@ } function showInfo(id) { - var obj = - document.getElementById(id).style; + var obj = document.getElementById(id).style; if(obj.display=="block") obj.display="none"; else Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-03-09 15:52:06 UTC (rev 1465) @@ -404,5 +404,14 @@ this.elementTagName = elementName; } + public boolean isA(String clss){ + boolean isInstance = false; + try{ + isInstance = Class.forName(clss).isInstance(this); + }catch(ClassNotFoundException cnfe){ + //I guess this means false + } + return isInstance; + } } \ No newline at end of file Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java 2007-03-09 15:50:28 UTC (rev 1464) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java 2007-03-09 15:52:06 UTC (rev 1465) @@ -58,6 +58,13 @@ results = null; tag = null; } + + public void testIsA(){ + assertTrue("JTestResults is an instance of a JameleonTestResult", results.isA("net.sf.jameleon.result.JameleonTestResult")); + assertTrue("JTestResults is an instance of a XMLable", results.isA("net.sf.jameleon.XMLable")); + assertFalse("JTestResults is not an instance of a String", results.isA("java.lang.String")); + assertFalse("JTestResults is not an instance of an unknown class", results.isA("UNkownCLASSName")); + } public void testFindAncestorByClass(){ CountableTestResult countableResult = new CountableTestResult(tag); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-10 06:11:26
|
Revision: 1469 http://svn.sourceforge.net/jameleon/?rev=1469&view=rev Author: engrean Date: 2007-03-09 22:11:20 -0800 (Fri, 09 Mar 2007) Log Message: ----------- - Errors are now handled in the <testcase> and any other non leaf node tags - The expansion icon is now only displayed if there are indeed children results. - The key-value pair of data is only displayed if there is some data - The error message is now HTML escaped - The execution time is now nicely formatted. Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/function/AttributeBroker.java trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/tags/AssertTrueTag.java trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java trunk/jameleon-core/src/java/net/sf/jameleon/util/JameleonUtility.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/util/JameleonUtilityTest.java Modified: trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-10 06:11:20 UTC (rev 1469) @@ -10,8 +10,25 @@ #end #parse("TestCaseResultsDataDrivenChildTemplate.txt") #elseif ($results.parent) - <br/><b>Steps for <i>$results.elementName</i></b><br/> - #parse("TestCaseResultsChildTemplate.txt") + #if ( $results.failed() && $results.getError() ) + <span id="$results.hashCode()_errMsg" class="errMsg"> + <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> + #if ($results.errorMsg) + $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() + #else + See stacktrace for details + #end + <br/> + <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> + #foreach ( $st in $results.error.stackTrace ) + $st<br/> + #end + </span> + </span> + #else + <br/><b>Steps for <i>$results.elementName</i></b><br/> + #parse("TestCaseResultsChildTemplate.txt") + #end #else #parse("TestCaseResultsLeafChildTemplate.txt") #end Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-10 06:11:20 UTC (rev 1469) @@ -7,8 +7,10 @@ <div> <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_$results.getRowNum()_data')"><i>i</i></a> +#if ($results.getChildrenResults().size() > 0) <img onclick="showBranch('$results.hashCode()_$results.getRowNum()');swapIcon('$results.hashCode()_$results.getRowNum()','$results.hashCode()_$results.getRowNum()_img')" src="${results_res_dir}/icons/${expandIcon}" border="0" id="$results.hashCode()_$results.getRowNum()_img"> +#end $shortDesc - row $results.getRowNum() </div> @@ -32,6 +34,7 @@ #end </table> </td><td> + #if ( $results.getRowData() && $results.getRowData().keySet().size() > 0) <table class="key_value"> <tr> <td colspan="2">$results.getElementName() data</td> @@ -47,8 +50,26 @@ </tr> #end </table> + #end </td></tr></table> </span> + +#if ( $results.failed() && $results.getError() ) + <span id="$results.hashCode()_errMsg" class="errMsg"> + <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> + #if ($results.errorMsg) + $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() + #else + See stacktrace for details + #end + <br/> + <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> + #foreach ( $st in $results.error.stackTrace ) +$st<br/> + #end + </span> + </span> +#end #if ($results.failed() || $countRow == "false") #set( $class = "branch_displayed") #else Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-10 06:11:20 UTC (rev 1469) @@ -47,7 +47,7 @@ <span id="$results.hashCode()_errMsg" class="errMsg"> <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> #if ($results.errorMsg) - $results.errorMsg + $results.getHtmlFormattedErrorMsg() #else See stacktrace for details #end Modified: trunk/jameleon-core/res/TestCaseResultsTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-10 06:11:20 UTC (rev 1469) @@ -1,7 +1,6 @@ <html> <head> - <title>$!tc.name Documentation</title> - + <title>$!tc.name Documentation</title> <style type="text/css" media="all">@import url("${results_res_dir}/testCaseDocs.css");</style> <script language="JavaScript" src="${results_res_dir}/testCaseDocs.js"></script> </head> @@ -57,7 +56,7 @@ <th width="50%">Failures</th> </tr> <tr> - <td>$results.executionTime</td> + <td>$results.getExecutionTimeToDisplay()</td> <td>$results.getCountableResults().size()</td> <td>$results.getFailedCountableResults().size()</td> <td>To Be Calculated</td> @@ -70,6 +69,22 @@ </table> <hr> <br> + #if ( $results.failed() && $results.getError() ) + <span id="$results.hashCode()_errMsg" class="errMsg"> + <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> + #if ($results.errorMsg) + $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() + #else + See stacktrace for details + #end + <br/> + <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> + #foreach ( $st in $results.error.stackTrace ) + $st<br/> + #end + </span> + </span> + #end #parse("TestCaseResultsChildTemplate.txt") </body> </html> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/function/AttributeBroker.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/function/AttributeBroker.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/src/java/net/sf/jameleon/function/AttributeBroker.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -123,7 +123,10 @@ attr = (Attribute)attributes.get(it.next()); if (attr.isRequired() && !attr.isValueSet()) { if (getAttributeValue(attr, context) == null) { - errors.append("\"").append(attr).append("\","); + if (errors.length() > 0) { + errors.append(","); + } + errors.append(attr); } } } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/tags/AssertTrueTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/tags/AssertTrueTag.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/tags/AssertTrueTag.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -36,7 +36,7 @@ * </testcase> * </source></pre> * @jameleon.function name="ju-assert-true" type="action" - * @jameleon.step Compare the expected value against ehe actual value. + * @jameleon.step Verify that the expected expression validates to true. */ public class AssertTrueTag extends AbstractAssertTag{ Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -145,6 +145,13 @@ } /** + * @return the stack trace stating was happened + */ + public String getHtmlFormattedErrorMsg(){ + return JameleonUtility.decodeTextToXML(getErrorMsg()); + } + + /** * @return the time it took to run this step */ public long getExecutionTime(){ @@ -152,6 +159,13 @@ } /** + * @return the time it took to run this step + */ + public String getExecutionTimeToDisplay(){ + return JameleonUtility.executionTimeToString(executionTime); + } + + /** * Set the execution time * @param executionTime - The time it took to run this step */ Modified: trunk/jameleon-core/src/java/net/sf/jameleon/util/JameleonUtility.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/JameleonUtility.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/JameleonUtility.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -182,6 +182,13 @@ return str; } + public static String decodeTextToXML(String str){ + str = str.replaceAll("&","\\&"); + str = str.replaceAll("<","\\<"); + str = str.replaceAll(">","\\>"); + return str; + } + public static String executionTimeToString(long time){ long hours, mins, secs; hours = time / 3600000; Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -20,14 +20,16 @@ import java.io.File; +import org.apache.commons.jelly.LocationAware; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; + import net.sf.jameleon.bean.FunctionalPoint; +import net.sf.jameleon.util.JameleonUtility; import net.sf.jameleon.util.XMLHelper; -import org.apache.commons.jelly.LocationAware; - public class JameleonTestResultTest extends TestCase { private JameleonTestResult results; @@ -58,6 +60,15 @@ results = null; tag = null; } + + public void testGetHtmlFormattedMessage() { + results.setError(new RuntimeException("some <error>")); + assertEquals("error message", "some <error>", results.getHtmlFormattedErrorMsg()); + } + + public void testGetExecutionTimeToDisplay(){ + assertEquals("execution time", JameleonUtility.executionTimeToString(EXECUTION_TIME), results.getExecutionTimeToDisplay()); + } public void testIsA(){ assertTrue("JTestResults is an instance of a JameleonTestResult", results.isA("net.sf.jameleon.result.JameleonTestResult")); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/util/JameleonUtilityTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/util/JameleonUtilityTest.java 2007-03-10 05:05:10 UTC (rev 1468) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/util/JameleonUtilityTest.java 2007-03-10 06:11:20 UTC (rev 1469) @@ -80,6 +80,15 @@ assertEquals("xml converted text", "<value>automation & testing</value>", xml); } + public void testDecodeTextToXML(){ + String xml = "<xml>"; + String text = JameleonUtility.decodeTextToXML(xml); + assertEquals("xml converted text", "<xml>", text); + xml = "<value>automation & testing</value>"; + text = JameleonUtility.decodeTextToXML(xml); + assertEquals("xml converted text", "<value>automation & testing</value>", text); + } + public void testCreateDirStructure(){ File dirToCreate = new File(TEST_DIR); JameleonUtility.createDirStructure(dirToCreate); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-10 16:01:02
|
Revision: 1471 http://svn.sourceforge.net/jameleon/?rev=1471&view=rev Author: engrean Date: 2007-03-10 08:01:00 -0800 (Sat, 10 Mar 2007) Log Message: ----------- Added percent passed to test case results pulled logic out of log4j layouts and put in TestCaseResult Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java Modified: trunk/jameleon-core/res/TestCaseResultsTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-10 16:01:00 UTC (rev 1471) @@ -59,7 +59,7 @@ <td>$results.getExecutionTimeToDisplay()</td> <td>$results.getCountableResults().size()</td> <td>$results.getFailedCountableResults().size()</td> - <td>To Be Calculated</td> + <td>$results.getPercentagePassed()</td> <td class="failures"> #foreach ( $result in $results.getAllFailedLeafChildrenResults() ) <a href="#$result.hashCode()">$result.errorMsg</a> <br/> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java 2007-03-10 16:01:00 UTC (rev 1471) @@ -77,15 +77,15 @@ int numFailed = result.getRowsFailed(); */ - List countableResults = getCountableResults(result); + List countableResults = result.getCountableResults(); int numRun = countableResults.size(); - int numFailed = getFailedCountableResults(result).size(); + int numFailed =result.getFailedCountableResults().size(); totalTestsRun += numRun; totalTestsFailed += numFailed; totalTestsPassed += (numRun - numFailed); - String percentagePassed = getPercentagePassed(numRun, numFailed); + String percentagePassed = TestCaseResult.getPercentagePassed(numRun, numFailed); String rowS = null; String cellS = null; @@ -250,7 +250,7 @@ */ public String getFooter() { String totalExecutionTime = getExecutionTime(); - String percentagePassed = getPercentagePassed(totalTestsRun, totalTestsFailed); + String percentagePassed = TestCaseResult.getPercentagePassed(totalTestsRun, totalTestsFailed); StringBuffer sb = new StringBuffer(); sb.append("</table>" + Layout.LINE_SEP); Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-03-10 16:01:00 UTC (rev 1471) @@ -86,14 +86,6 @@ return new Integer(rowNum); } - protected List getCountableResults(TestCaseResult result){ - return result.getCountableResults(); - } - - protected List getFailedCountableResults(TestCaseResult result){ - return result.getFailedCountableResults(); - } - protected void checkBuffer(){ // Reset working buffer. If the buffer is too large, then we need a new // one in order to avoid the penalty of creating a large array. @@ -122,25 +114,6 @@ return JameleonUtility.executionTimeToString(totalExecutionTime); } - /** - * Returns the summary for the total tests run, passed and failed. - */ - public String getPercentagePassed(int testsRun, int testsFailed) { - String percentagePassed = "N/A"; - try { - NumberFormat nf = NumberFormat.getPercentInstance(); - int testsPassed = testsRun - testsFailed; - if (testsRun > 0) { - percentagePassed = nf.format((double) testsPassed/testsRun); - } else { - percentagePassed = nf.format(0); - } - } catch (ArithmeticException ae) { - } - return percentagePassed; - } - - protected class ErrorResult { protected String errMsg; protected String fileName; Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-03-10 16:01:00 UTC (rev 1471) @@ -27,17 +27,17 @@ * A DataDrivableResult can contain session results and function point results. */ public class DataDrivableResult extends TestResultWithChildren { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * The row number of exeuction for the data-drivable tag - */ - protected int rowNum; - /** - * The row data for the data-drivable tag - */ - protected Map rowData; - + /** + * The row number of exeuction for the data-drivable tag + */ + protected int rowNum; + /** + * The row data for the data-drivable tag + */ + protected Map rowData; + public DataDrivableResult(FunctionalPoint tag){ super(tag); } @@ -51,21 +51,21 @@ } public Map getRowData(){ - return rowData; + return rowData; } - + public void setRowData(Map rowData){ - this.rowData = rowData; + this.rowData = rowData; } - + public int getRowNum(){ - return rowNum; + return rowNum; } - + public void setRowNum(int rowNum){ - this.rowNum = rowNum; + this.rowNum = rowNum; } - + /** * @return a XML String representation of the results */ Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-03-10 16:01:00 UTC (rev 1471) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.text.NumberFormat; import net.sf.jameleon.bean.FunctionalPoint; @@ -135,6 +136,33 @@ return failedCountableResults; } + /** + * Returns the summary for the total tests run, passed and failed. + */ + public String getPercentagePassed() { + int testsRun = getCountableResults().size(); + int testsFailed = getFailedCountableResults().size(); + return getPercentagePassed(testsRun, testsFailed); + } + + /** + * Returns the summary for the total tests run, passed and failed. + */ + public static String getPercentagePassed(int testsRun, int testsFailed) { + String percentagePassed = "N/A"; + try { + NumberFormat nf = NumberFormat.getPercentInstance(); + int testsPassed = testsRun - testsFailed; + if (testsRun > 0) { + percentagePassed = nf.format((double) testsPassed/testsRun); + } else { + percentagePassed = nf.format(0); + } + } catch (ArithmeticException ae) { + } + return percentagePassed; + } + public void recordFailureToCountableResult(){ countFailure(); } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java 2007-03-10 06:18:25 UTC (rev 1470) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java 2007-03-10 16:01:00 UTC (rev 1471) @@ -54,6 +54,24 @@ tag.addTagName("test-case"); } + public void testGetPercentagePassed(){ + for (int i = 0; i < 4; i++) { + new CountableDataDrivableResult(tag, results); + } + assertEquals("percent passed", "100%", results.getPercentagePassed()); + CountableDataDrivableResult cfr = new CountableDataDrivableResult(tag, results); + cfr.setError(new RuntimeException("failure 1")); + assertEquals("percent passed", "80%", results.getPercentagePassed()); + } + + public void testGetPercentagePassed2(){ + assertEquals("percent passed", "100%", TestCaseResult.getPercentagePassed(1, 0)); + assertEquals("percent passed", "67%", TestCaseResult.getPercentagePassed(3, 1)); + assertEquals("percent passed", "75%", TestCaseResult.getPercentagePassed(4, 1)); + assertEquals("percent passed", "0%", TestCaseResult.getPercentagePassed(0, 1)); + assertEquals("percent passed", "0%", TestCaseResult.getPercentagePassed(0, 0)); + } + public void testGetFailedResults(){ TestResultWithChildren res = new MockTestResultWithChildren(tag, results); FunctionalPoint tag2 = new FunctionalPoint(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-10 18:24:05
|
Revision: 1473 http://svn.sourceforge.net/jameleon/?rev=1473&view=rev Author: engrean Date: 2007-03-10 10:24:03 -0800 (Sat, 10 Mar 2007) Log Message: ----------- Fixed problems with results of tags getting added to the result tree due to the postcondition rule. Now results for leaf tags that weren't executed are removed and parent tags that didn't fail and have no child results are also removed from the results tree. Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java trunk/jameleon-core/tst/java/net/sf/jameleon/SessionTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/function/FunctionTagTest.java trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml trunk/jameleon-core/tst/xml/framework/postconditionTag.xml Modified: trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -19,6 +19,7 @@ package net.sf.jameleon; import java.io.IOException; +import java.util.List; import java.util.Properties; import org.apache.commons.jelly.JellyTagException; @@ -36,8 +37,8 @@ import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.FunctionResultRecordable; import net.sf.jameleon.result.JameleonTestResult; +import net.sf.jameleon.result.SessionResult; import net.sf.jameleon.result.SessionResultRecordable; -import net.sf.jameleon.result.SessionResult; import net.sf.jameleon.util.JameleonUtility; import net.sf.jameleon.util.StateStorer; /** @@ -213,6 +214,7 @@ sessionResults.setExecutionTime(System.currentTimeMillis()-startTime); // A hack to show the variables created during execution of a function point( like the variable mapping feature ) //sessionResults.getParams().putAll(context.getVariables()); + removeChildlessResult(); log.debug(sessionResults); if (tcOrganization != null) { tc.setOrganization(tcOrganization); @@ -362,6 +364,27 @@ } } } + + + /** + * Removes the current result from its parent if it has no children, meaning the tags weren't actually run + * @param result - The result to remove + */ + protected void removeChildlessResult(){ + if (sessionResults.passed() && + ( sessionResults.getChildrenResults() == null || + sessionResults.getChildrenResults().size() == 0) ) { + + if (sessionResults.getParentResults() != null) { + List results = sessionResults.getParentResults().getChildrenResults(); + if (results != null) { + int index = results.lastIndexOf(sessionResults); + results.remove(index); + } + } + } + } + ////////////////////////////////////////////////////////////////////////////////////////////// // FunctionResultRecordable implementation methods // ////////////////////////////////////////////////////////////////////////////////////////////// @@ -387,5 +410,4 @@ public void recordDataDrivableResult(DataDrivableResult result){ recordResult(result); } - } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -33,6 +33,17 @@ import java.util.ResourceBundle; import java.util.Set; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; +import org.apache.commons.jelly.LocationAware; +import org.apache.commons.jelly.MissingAttributeException; +import org.apache.commons.jelly.XMLOutput; +import org.apache.commons.jelly.expression.CompositeExpression; +import org.apache.commons.jelly.expression.Expression; +import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory; +import org.apache.log4j.Logger; + import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.bean.TestCase; import net.sf.jameleon.data.DataDrivable; @@ -40,21 +51,12 @@ import net.sf.jameleon.exception.JameleonScriptException; import net.sf.jameleon.result.CountableDataDrivableResult; import net.sf.jameleon.result.DataDrivableResult; +import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.JameleonTestResult; import net.sf.jameleon.result.TestCaseResult; +import net.sf.jameleon.result.TestResultWithChildren; import net.sf.jameleon.util.*; -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.jelly.JellyException; -import org.apache.commons.jelly.JellyTagException; -import org.apache.commons.jelly.LocationAware; -import org.apache.commons.jelly.MissingAttributeException; -import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.expression.CompositeExpression; -import org.apache.commons.jelly.expression.Expression; -import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory; -import org.apache.log4j.Logger; - /** * Every test case script must have at least one testcase tag containing all other Jameleon tags. * <p> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -23,17 +23,24 @@ import java.io.IOException; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.jelly.JellyTagException; +import org.apache.commons.jelly.LocationAware; +import org.apache.commons.jelly.MissingAttributeException; +import org.apache.commons.jelly.XMLOutput; +import org.apache.log4j.Logger; + import net.sf.jameleon.JameleonTagSupport; import net.sf.jameleon.SessionTag; import net.sf.jameleon.TestCaseTag; import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.event.BreakPoint; import net.sf.jameleon.exception.JameleonScriptException; +import net.sf.jameleon.result.CountableDataDrivableResult; import net.sf.jameleon.result.DataDrivableResult; -import net.sf.jameleon.result.CountableDataDrivableResult; import net.sf.jameleon.result.DataDrivableResultRecordable; import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.FunctionResultRecordable; @@ -42,12 +49,6 @@ import net.sf.jameleon.result.SessionResultRecordable; import net.sf.jameleon.util.StateStorer; -import org.apache.commons.jelly.JellyTagException; -import org.apache.commons.jelly.LocationAware; -import org.apache.commons.jelly.MissingAttributeException; -import org.apache.commons.jelly.XMLOutput; -import org.apache.log4j.Logger; - /** * This is a basic implementation of DataDrivable. This is data source * independent as possible for now. @@ -259,16 +260,12 @@ traceMsg("BEGIN executing row number "+rowNum); try{ //The first result has already been added. - if (rowNum > 1){ - if (isCountRow()) { - dataDrivableResult = new CountableDataDrivableResult((FunctionalPoint) fp.clone()); - }else{ - dataDrivableResult = new DataDrivableResult((FunctionalPoint) fp.clone()); - } - recordThisResult(); - } - dataDrivableResult.setRowData(vars); - dataDrivableResult.setRowNum(rowNum); + if (rowNum > 1){ + dataDrivableResult = createNewResult(); + recordThisResult(); + } + dataDrivableResult.setRowData(vars); + dataDrivableResult.setRowNum(rowNum); stateStorer.setStoreDir(new File(stateStorer.getStoreDir(), getNewStateStoreLocation(rowNum))); try { invokeBody(xmlOut); @@ -300,6 +297,7 @@ } } }finally{ + removeChildlessResult(dataDrivableResult); failedOnCurrentRow = false; traceMsg("END executing row number "+rowNum); } @@ -397,11 +395,29 @@ }catch(Throwable t){ setResultError(new JameleonScriptException(t)); }finally{ - dataDrivableResult.setTag((FunctionalPoint) fp.clone()); - resetFunctionalPoint(); + dataDrivableResult.setTag((FunctionalPoint) fp.clone()); + resetFunctionalPoint(); } } + /** + * Removes the current result from its parent if it has no children, meaning the tags weren't actually run + * @param result - The result to remove + */ + protected void removeChildlessResult(DataDrivableResult result){ + if (result.passed() && + ( result.getChildrenResults() == null || + result.getChildrenResults().size() == 0 ) ) { + if (result.getParentResults() != null) { + List results = result.getParentResults().getChildrenResults(); + if (results != null) { + int index = results.lastIndexOf(result); + results.remove(index); + } + } + } + } + protected void setResultError(Exception e){ dataDrivableResult.setError(e); } @@ -415,7 +431,8 @@ } return ddr; } - + + public Map getRowData(){ return rowData; } @@ -457,8 +474,8 @@ } /** - * Records a SessionResult to the tag's results - * @param result + * Removes a FunctionResult from the list of recorded results + * @param result - the result to remove */ public void recordSessionResult(SessionResult result){ recordResult(result); Modified: trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -307,6 +307,8 @@ cleanUp(); } } + }else{ + removeFunctionResult(); } } @@ -550,6 +552,16 @@ } } + protected void removeFunctionResult(){ + if (fResults.getParentResults() != null) { + List results = fResults.getParentResults().getChildrenResults(); + if (results != null) { + int index = results.lastIndexOf(fResults); + results.remove(index); + } + } + } + /** * Adds the result for this test step into the session's results * and logs this information to the logger. Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -26,7 +26,7 @@ /** * Records a DataDrivableResult to the tag's results - * @param result + * @param result - the result to add */ public void recordDataDrivableResult(DataDrivableResult result); Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -27,7 +27,7 @@ /** * Records a FunctionResult to the tag's results and sets the FunctionResult's parent * result to itself - * @param result + * @param result - the result to record */ public void recordFunctionResult(FunctionResult result); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/SessionTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/SessionTagTest.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/SessionTagTest.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -26,8 +26,8 @@ import junit.framework.TestCase; import junit.framework.TestSuite; -import net.sf.jameleon.result.FunctionResult; -import net.sf.jameleon.result.TestCaseResult; +import net.sf.jameleon.bean.FunctionalPoint; +import net.sf.jameleon.result.*; public class SessionTagTest extends TestCase { Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -28,10 +28,12 @@ import junit.framework.Test; import junit.framework.TestSuite; +import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.bean.TestCase; import net.sf.jameleon.event.TestCaseEventHandler; import net.sf.jameleon.event.TestTestCaseListener; import net.sf.jameleon.exception.JameleonScriptException; +import net.sf.jameleon.result.*; import net.sf.jameleon.util.AssertLevel; import net.sf.jameleon.util.Configurator; import net.sf.jameleon.util.JameleonUtility; Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -21,14 +21,6 @@ import java.util.HashMap; import java.util.Map; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import net.sf.jameleon.MockSessionTag; -import net.sf.jameleon.TestCaseTag; -import net.sf.jameleon.result.CountableDataDrivableResult; -import net.sf.jameleon.result.DataDrivableResult; - import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.Script; @@ -37,7 +29,16 @@ import com.mockobjects.dynamic.AnyConstraintMatcher; import com.mockobjects.dynamic.Mock; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import net.sf.jameleon.MockSessionTag; +import net.sf.jameleon.TestCaseTag; +import net.sf.jameleon.bean.FunctionalPoint; +import net.sf.jameleon.result.*; + + public class AbstractDataDrivableTagTest extends TestCase { private MockDataDrivableTag mockDdTag; @@ -70,7 +71,7 @@ mockST.setParent(testCaseTag); mockDdTag.setParent(mockST); } - + public void testCreateNewResult(){ assertFalse("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableResult); mockDdTag.countRow = true; Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/function/FunctionTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/function/FunctionTagTest.java 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/function/FunctionTagTest.java 2007-03-10 18:24:03 UTC (rev 1473) @@ -76,6 +76,12 @@ config.setConfigName(UNIT_TEST_CONF); ft.setupEnvironment(); } + + public void testRemoveFunctionResult(){ + assertTrue(st.getSessionResult().getChildrenResults().contains(ft.getFunctionResults())); + ft.removeFunctionResult(); + assertFalse(st.getSessionResult().getChildrenResults().contains(ft.getFunctionResults())); + } public void testSetUpFunctionResult(){ FunctionResult oldFr = ft.fResults; Modified: trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml =================================================================== --- trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml 2007-03-10 18:24:03 UTC (rev 1473) @@ -189,6 +189,7 @@ noFailOnFunctionId="run some failing tests" htmlLineFailedReason="should fail here" htmlLineFailedFunctionId="fail" + numOfFunctionsRun="1" htmlLineNumFailed="32"/> <execute-jameleon-script @@ -250,7 +251,7 @@ testCaseName="postconditionTag" htmlLineFailedReason="POSTCONDITION FAILURE: executed all the way to the bottom" htmlLineFailedFunctionId="Do a basic assertTrue with false in a postcondition" - numOfFunctionsRun="5" + numOfFunctionsRun="4" numOfFailures="2"/> <execute-jameleon-script @@ -271,7 +272,7 @@ checkOutcomeFailed="true" testCaseName="postconditionWithCsvNoCountRow" noFailOnFunctionId="This tag shouldn't get executed" - numOfFunctionsRun="7" + numOfFunctionsRun="6" numOfFailures="5"/> <execute-jameleon-script @@ -395,7 +396,7 @@ checkOutcomeFailed="true" testCaseName="postconditionWithCsvCountRow" noFailOnFunctionId="This tag shouldn't get executed" - numOfFunctionsRun="7" + numOfFunctionsRun="6" numOfFailures="5" numOfTestCasesRun="3" numOfTestCasesFailed="3"/> Modified: trunk/jameleon-core/tst/xml/framework/postconditionTag.xml =================================================================== --- trunk/jameleon-core/tst/xml/framework/postconditionTag.xml 2007-03-10 16:01:32 UTC (rev 1472) +++ trunk/jameleon-core/tst/xml/framework/postconditionTag.xml 2007-03-10 18:24:03 UTC (rev 1473) @@ -30,10 +30,10 @@ msg="fail here" test="false"/> <ju-assert-true - functionId="This tag shouldn't get executed!" + functionId="This tag should get executed even though the previous one failed!" test="true"/> <ju-assert-true - functionId="This tag shouldn't get executed either!" + functionId="This tag should get executed also!" test="true"/> <ju-assert-true functionId="Do a basic assertTrue with false in a postcondition" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2007-03-13 03:42:11
|
Revision: 1477 http://svn.sourceforge.net/jameleon/?rev=1477&view=rev Author: selie Date: 2007-03-12 20:42:06 -0700 (Mon, 12 Mar 2007) Log Message: ----------- Now using velocimacros instead of duplicate code. Added valocimacro to: - display tag attributes table - display error message and stacktrace Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java Added Paths: ----------- trunk/jameleon-core/res/TestCaseDocs.vm Added: trunk/jameleon-core/res/TestCaseDocs.vm =================================================================== --- trunk/jameleon-core/res/TestCaseDocs.vm (rev 0) +++ trunk/jameleon-core/res/TestCaseDocs.vm 2007-03-13 03:42:06 UTC (rev 1477) @@ -0,0 +1,50 @@ +#macro( errors $isLeaf) +#if ($isLeaf == true) + #set( $failed = $results.failed() ) +#else + #set( $failed = $results.failed() && $results.getError() ) +#end + +#if ( $failed ) + <span id="$results.hashCode()_errMsg" class="errMsg"> + <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> + #if ($results.errorMsg) + #if ($isLeaf == true) + $results.getHtmlFormattedErrorMsg() + #else + $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() + #end + #else + See stacktrace for details + #end + <br/> + <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> + #foreach ( $st in $results.error.stackTrace ) + $st<br/> + #end + </span> + </span> +#end +#end + + +#macro( attributes ) +<table class="attributes_value"> + <tr> + <td><$results.getElementName()/></td> + <td>$results.getExecutionTimeToDisplay()</td> + </tr> + <tr> + <th>attribute</th> + <th>value</th> + </tr> + #foreach ( $attr in $results.getTag().getAttributes() ) + #if ( $attr.isValueSet() && !$attr.name.equals('functionId') ) + <tr> + <td>$attr.getName()</td> + <td>$attr.getDisplayedValue()</td> + </tr> + #end + #end +</table> +#end Property changes on: trunk/jameleon-core/res/TestCaseDocs.vm ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-12 21:02:58 UTC (rev 1476) +++ trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-13 03:42:06 UTC (rev 1477) @@ -10,22 +10,8 @@ #end #parse("TestCaseResultsDataDrivenChildTemplate.txt") #elseif ($results.parent) - #if ( $results.failed() && $results.getError() ) - <span id="$results.hashCode()_errMsg" class="errMsg"> - <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> - #if ($results.errorMsg) - $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() - #else - See stacktrace for details - #end - <br/> - <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> - #foreach ( $st in $results.error.stackTrace ) - $st<br/> - #end - </span> - </span> - #else + #errors( false ) + #if ( !$results.failed() || !$results.getError() ) <br/><b>Steps for <i>$results.elementName</i></b><br/> #parse("TestCaseResultsChildTemplate.txt") #end Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-12 21:02:58 UTC (rev 1476) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-13 03:42:06 UTC (rev 1477) @@ -16,24 +16,7 @@ <span id="$results.hashCode()_$results.getRowNum()_data" class="branch"> <table class="indent"><tr><td> - <table class="attributes_value"> - <tr> - <td><$results.getElementName()/></td> - <td>$results.getExecutionTimeToDisplay()</td> - </tr> - <tr> - <th>attribute</th> - <th>value</th> - </tr> - #foreach ( $attr in $results.getTag().getAttributes() ) - #if ( $attr.isValueSet() && !$attr.name.equals('functionId') ) - <tr> - <td>$attr.getName()</td> - <td>$attr.getDisplayedValue()</td> - </tr> - #end - #end - </table> + #attributes() </td><td> #if ( $results.getRowData() && $results.getRowData().keySet().size() > 0) <table class="key_value"> @@ -55,22 +38,7 @@ </td></tr></table> </span> -#if ( $results.failed() && $results.getError() ) - <span id="$results.hashCode()_errMsg" class="errMsg"> - <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> - #if ($results.errorMsg) - $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() - #else - See stacktrace for details - #end - <br/> - <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> - #foreach ( $st in $results.error.stackTrace ) -$st<br/> - #end - </span> - </span> -#end +#errors( false ) #if ($results.failed() || $countRow == "false") #set( $class = "branch_displayed") #else Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-12 21:02:58 UTC (rev 1476) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-03-13 03:42:06 UTC (rev 1477) @@ -25,39 +25,7 @@ </span> #end <span id="$results.hashCode()_data" class="branch"> - <table class="attributes_value"> - <tr> - <td><$results.elementName/></td> - <td>$results.getExecutionTimeToDisplay()</td> - </tr> - <tr> - <th>attribute</th> - <th>value</th> - </tr> - #foreach ( $attr in $results.tag.attributes ) - #if ( $attr.valueSet && !$attr.name.equals('functionId')) - <tr> - <td>$attr.name</td> - <td>$attr.displayedValue</td> - </tr> - #end - #end - </table> + #attributes() </span> -#if ( $results.failed() ) - <span id="$results.hashCode()_errMsg" class="errMsg"> - <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> - #if ($results.errorMsg) - $results.getHtmlFormattedErrorMsg() - #else - See stacktrace for details - #end - <br/> - <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> - #foreach ( $st in $results.error.stackTrace ) -$st<br/> - #end - </span> - </span> -#end +#errors( true ) Modified: trunk/jameleon-core/res/TestCaseResultsTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-12 21:02:58 UTC (rev 1476) +++ trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-13 03:42:06 UTC (rev 1477) @@ -69,22 +69,7 @@ </table> <hr> <br> - #if ( $results.failed() && $results.getError() ) - <span id="$results.hashCode()_errMsg" class="errMsg"> - <img class="indent" onclick="showInfo('$results.hashCode()_stacktrace')" src="${results_res_dir}/icons/stacktrace.gif" border="0"> - #if ($results.errorMsg) - $results.getTag().getDefaultTagName() - $results.getHtmlFormattedErrorMsg() - #else - See stacktrace for details - #end - <br/> - <span id="$results.hashCode()_stacktrace" class="branch stacktrace"> - #foreach ( $st in $results.error.stackTrace ) - $st<br/> - #end - </span> - </span> - #end + #errors( false ) #parse("TestCaseResultsChildTemplate.txt") </body> </html> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java 2007-03-12 21:02:58 UTC (rev 1476) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java 2007-03-13 03:42:06 UTC (rev 1477) @@ -35,6 +35,7 @@ public TestCaseDocsTransformer(String templateName){ Velocity.setProperty("resource.loader", "classpath"); Velocity.setProperty("classpath.resource.loader.class", "net.sf.jameleon.util.VelocityClasspathResourceLoader"); + Velocity.setProperty("velocimacro.library", "TestCaseDocs.vm"); try{ Velocity.init(); }catch(Exception rnfe){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-20 14:19:26
|
Revision: 1483 http://svn.sourceforge.net/jameleon/?rev=1483&view=rev Author: engrean Date: 2007-03-20 07:19:25 -0700 (Tue, 20 Mar 2007) Log Message: ----------- Fixed Bug #1684371 - remove Javadoc2Bean unused methods Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/bean/Javadoc2Bean.java trunk/jameleon-core/tst/java/net/sf/jameleon/bean/Javadoc2BeanTest.java Modified: trunk/jameleon-core/src/java/net/sf/jameleon/bean/Javadoc2Bean.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/bean/Javadoc2Bean.java 2007-03-18 22:14:22 UTC (rev 1482) +++ trunk/jameleon-core/src/java/net/sf/jameleon/bean/Javadoc2Bean.java 2007-03-20 14:19:25 UTC (rev 1483) @@ -58,13 +58,7 @@ docBuilder = new JavaDocBuilder(); docBuilder.getClassLibrary().addClassLoader(getClass().getClassLoader()); } - - public String getClassNameFromTag(String tagName) throws MissingResourceException{ - ResourceBundle tags; - tags = ResourceBundle.getBundle(SupportedTags.DEFAULT_CUSTOM_TAGS); - return tags.getString(tagName); - } - + public String getClassNameFromSource(String sourceFileName) throws MissingResourceException{ if (sourceFileName.startsWith(sourceDir.getPath())) { sourceFileName = sourceFileName.substring(sourceDir.getPath().length() + 1); @@ -108,11 +102,7 @@ public void setIsA(String isA){ this.isA = isA; } - - public FunctionalPoint getFunctionalPointWithTag(String tagName) throws FileNotFoundException{ - return getFunctionalPoint(getJavaClassWithTag(tagName)); - } - + public FunctionalPoint getFunctionalPointWithClass(String className) throws FileNotFoundException{ return getFunctionalPoint(getJavaClassWithClass(className)); } @@ -312,12 +302,7 @@ } return docBuilder; } - - protected JavaClass getJavaClassWithTag(String tagName) throws FileNotFoundException{ - String className = getClassNameFromTag(tagName); - return getJavaClass(className, tagName); - } - + protected JavaClass getJavaClassWithClass(String className) throws FileNotFoundException{ return getJavaClass(className, className); } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/bean/Javadoc2BeanTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/bean/Javadoc2BeanTest.java 2007-03-18 22:14:22 UTC (rev 1482) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/bean/Javadoc2BeanTest.java 2007-03-20 14:19:25 UTC (rev 1483) @@ -44,7 +44,7 @@ private static final String DUMMY_WITH_APPLICATION = "net.sf.jameleon.bean.DummyWithApplication"; private static final String DUMMY_WITH_APPLICATIONS = "net.sf.jameleon.bean.DummyWithApplications"; - private static File tstTagFile; + private File tstTagFile; public Javadoc2BeanTest( String name ) { super( name ); @@ -102,25 +102,6 @@ assertEquals("short description", "First sentence with a period in it.", j2b.getShortDescription(desc)); } - public String testGetClassNameFromTag(){ - String className = null; - try{ - className = j2b.getClassNameFromTag(FP_TAG_NAME); - assertEquals("Class Name for "+ FP_TAG_NAME, FP_CLASS_NAME, className); - }catch(MissingResourceException mre){ - fail("should have found the file!"); - } - return className; - } - - public void testGetFileFromClassName(){ - String className = testGetClassNameFromTag(); - assertNotNull("Class Name", className); - assertEquals("source dir ", tstTagFile, j2b.getSourceDir()); - String fileName = j2b.getSourceFile(className).getPath(); - assertEquals("Source File",FP_SRC_FILE, fileName); - } - public void testConvertClassNameToSourceName(){ String className = "check.to.see.if.this.Works.class"; String fileName = j2b.convertClassNameToSourceName(className,true); @@ -130,15 +111,6 @@ assertEquals("Source File",JameleonUtility.fixFileSeparators("check/to/see/if/this/Works.java"), fileName); } - public void testGetFunctionalPointWithTag(){ - try{ - FunctionalPoint fp = j2b.getFunctionalPointWithTag(FP_TAG_NAME); - validateFunctionalPoint(fp); - }catch (FileNotFoundException fnfe){ - fail("File should exist!" + " "+fnfe.getMessage()); - } - } - public void testGetFunctionalPointWithClass(){ try{ FunctionalPoint fp = j2b.getFunctionalPointWithClass(FP_CLASS_NAME); @@ -187,17 +159,6 @@ } - public void testGetFunctionalPointWithTagOnlyTagName(){ - try{ - FunctionalPoint fp = j2b.getFunctionalPointWithTag(FP_TAG_NAME); - assertNotNull("Functional Point Bean shouldn't be null", fp); - assertEquals("FP tag name", FP_TAG_NAME , fp.getDefaultTagName()); - assertEquals("FP Type", "action", fp.getType()); - }catch (FileNotFoundException fnfe){ - fail("File should exist!"); - } - } - public void testGetClassNameFromSourceValidSource(){ String sourceFileName = "net"+File.separator+"sf"+File.separator+"jameleon"+File.separator+"TestCaseTag.java"; assertEquals("Class name from source file:", "net.sf.jameleon.TestCaseTag", j2b.getClassNameFromSource(sourceFileName)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-20 14:38:36
|
Revision: 1484 http://svn.sourceforge.net/jameleon/?rev=1484&view=rev Author: engrean Date: 2007-03-20 07:23:47 -0700 (Tue, 20 Mar 2007) Log Message: ----------- More changes against bug #1677238 ] Custom configuration files are ignored by SupportedTags.java - All tags in the tst/java directory are now registered as a test-plugin to help test on-the-fly configurations - Fixed a bug there the jameleon.conf file was read in with different logic which is already handled in the Configurator class Modified Paths: -------------- trunk/jameleon-core/build.properties trunk/jameleon-core/src/java/net/sf/jameleon/ant/ExecuteTestCaseTask.java trunk/jameleon-core/src/java/net/sf/jameleon/util/SupportedTags.java trunk/jameleon-core/src/xml/standard-build.xml.fragment trunk/jameleon-core/tst/java/net/sf/jameleon/util/ConfiguratorTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/util/GenSyntaxReferenceTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/util/SupportedTagsTest.java trunk/jameleon-core/tst/res/jameleon.conf trunk/jameleon-core/tst/res/jameleon.unittest Property Changed: ---------------- trunk/jameleon-core/tst/res/ Modified: trunk/jameleon-core/build.properties =================================================================== --- trunk/jameleon-core/build.properties 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/build.properties 2007-03-20 14:23:47 UTC (rev 1484) @@ -9,3 +9,4 @@ test.suite.version=3.3-M4 start.date=11 November 2006 genSyntaxRef=true +tst.outputFileName=test-plugin.properties Modified: trunk/jameleon-core/src/java/net/sf/jameleon/ant/ExecuteTestCaseTask.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/ant/ExecuteTestCaseTask.java 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/src/java/net/sf/jameleon/ant/ExecuteTestCaseTask.java 2007-03-20 14:23:47 UTC (rev 1484) @@ -24,16 +24,15 @@ import java.util.List; import java.util.Map; +import net.sf.jameleon.ExecuteTestCase; +import net.sf.jameleon.util.Configurator; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Parameter; -import net.sf.jameleon.ExecuteTestCase; -import net.sf.jameleon.ui.Utils; -import net.sf.jameleon.util.Configurator; - public class ExecuteTestCaseTask extends Task { protected final LinkedList fileSets = new LinkedList(); @@ -53,6 +52,7 @@ * @exception BuildException If anything goes wrong. */ public final void execute() throws BuildException { + Configurator.clearInstance(); validateOptions(); ExecuteTestCase exec = new ExecuteTestCase(debug); exec.setWaitTimeBetweenScripts(waitTimeBetweenScripts); Modified: trunk/jameleon-core/src/java/net/sf/jameleon/util/SupportedTags.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/SupportedTags.java 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/SupportedTags.java 2007-03-20 14:23:47 UTC (rev 1484) @@ -99,11 +99,6 @@ return props; } - - private InputStream getInputStreamFromPath(String name) throws IOException{ - return new FileInputStream(name); - } - private InputStream getInputStreamFromClassPath(String name){ InputStream input = null; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); @@ -121,21 +116,9 @@ } public String[] getPlugins() { - Properties props = new Properties(); - try { - props.load(getInputStreamFromPath(pluginsFile)); - } catch (IOException ioe) { - if (warnOnNoPluginsFile) { - warnOnNoPluginsFile = false; - System.err.println("\nWARNING: Could not load "+pluginsFile+".\nNo plug-ins will be enabled!\n"); - } - } catch (NullPointerException npe) { - } - String[] pluginProps = null; - String tmpText = props.getProperty("plugins"); - if (tmpText != null) { - pluginProps = tmpText.split(" "); - }else if (warnOnNoPluginsFile) { + String[] pluginProps = Configurator.getInstance().getValueAsArray("plugins"); + if ( (pluginProps == null || pluginProps.length == 0 ) && + warnOnNoPluginsFile) { System.err.println("WARNING: Could not find 'plugins' entry in "+pluginsFile+".\nNo plug-ins will be enabled!\n"); warnOnNoPluginsFile = false; } Modified: trunk/jameleon-core/src/xml/standard-build.xml.fragment =================================================================== --- trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-03-20 14:23:47 UTC (rev 1484) @@ -182,6 +182,7 @@ <fileset dir="tst" includes="**/*.class" /> </delete> <delete file="tst/res/TestCaseTagDefs.properties"/> + <delete file="tst/res/test-plugin.properties"/> <delete dir="tst/_tmp" failonerror="false"/> <delete dir="tst/res/net" failonerror="false"/> <delete dir="tst/xml/_tmp" failonerror="false"/> @@ -267,7 +268,15 @@ </target> <target name="register.functions.tst" depends="copyJameleonConf, init.taskdefs" description="Register function points in the tst/src directory."> - <jmln-register outputdir="tst/res" quiet="true" isA="org.apache.commons.jelly.TagSupport"> + <condition property="tst.outputFileName" value="TestCaseTagDefs.properties"> + <equals arg1="${tst.outputFileName}" arg2="$${tst.outputFileName}"/> + </condition> + + <jmln-register + outputdir="tst/res" + quiet="true" + isA="org.apache.commons.jelly.TagSupport" + outputFileName="${tst.outputFileName}"> <fileset dir="tst/java"> <include name="**/*.java"/> <exclude name="**/DummyTagInvalidType.java"/> Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/util/ConfiguratorTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/util/ConfiguratorTest.java 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/util/ConfiguratorTest.java 2007-03-20 14:23:47 UTC (rev 1484) @@ -112,7 +112,7 @@ public void testGetKeys(){ config.setConfigName(UNIT_TEST_CONF); config.configure(); - assertEquals("# of values", 19, config.getKeys().size()); + assertEquals("# of values", 20, config.getKeys().size()); } public void testGetKeysStartingWith(){ Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/util/GenSyntaxReferenceTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/util/GenSyntaxReferenceTest.java 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/util/GenSyntaxReferenceTest.java 2007-03-20 14:23:47 UTC (rev 1484) @@ -55,7 +55,7 @@ } public void testGetTagsForPlugin(){ - Map tags = genReference.getTagsForPlugin("TestCaseTagDefs"); + Map tags = genReference.getTagsForPlugin("test-plugin"); Set keys = tags.keySet(); Object[] tagsA = keys.toArray(); assertTrue("There should be at least one key ", tagsA.length > 1); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/util/SupportedTagsTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/util/SupportedTagsTest.java 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/util/SupportedTagsTest.java 2007-03-20 14:23:47 UTC (rev 1484) @@ -44,11 +44,13 @@ } public void setUp(){ + Configurator.getInstance().setConfigName(PLUGINS_TEST); st = new SupportedTags(); st.setPluginsFile(PLUGINS_TEST); } - + public void testGetPluginsFile(){ + Configurator.clearInstance(); st = new SupportedTags(); assertEquals("Default plugins file", Configurator.DEFAULT_CONFIG_NAME, st.getPluginsFile()); } @@ -77,6 +79,7 @@ public void testGetPluginsToRegister(){ String[] plugins = st.getPlugins(); + assertNotNull("plugins should be configured", plugins); assertEquals("# of plugins ", 3, plugins.length); assertEquals("1st plugin", "plugin1", plugins[0]); assertEquals("2nd plugin", "plugin2", plugins[1]); Property changes on: trunk/jameleon-core/tst/res ___________________________________________________________________ Name: svn:ignore - TestCaseTagDefs.properties net + TestCaseTagDefs.properties net test-plugin.properties Modified: trunk/jameleon-core/tst/res/jameleon.conf =================================================================== --- trunk/jameleon-core/tst/res/jameleon.conf 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/tst/res/jameleon.conf 2007-03-20 14:23:47 UTC (rev 1484) @@ -12,3 +12,4 @@ scriptDir=tst/xml classpath.entry1=tst/res classpath.entry2=tst/java +plugins=test-plugin Modified: trunk/jameleon-core/tst/res/jameleon.unittest =================================================================== --- trunk/jameleon-core/tst/res/jameleon.unittest 2007-03-20 14:19:25 UTC (rev 1483) +++ trunk/jameleon-core/tst/res/jameleon.unittest 2007-03-20 14:23:47 UTC (rev 1484) @@ -17,3 +17,4 @@ storeStateEvent=storeStateOnChange enableSslCertCheck=false functionDelay=200 +plugins=test-plugin \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2007-03-28 02:54:36
|
Revision: 1491 http://svn.sourceforge.net/jameleon/?rev=1491&view=rev Author: selie Date: 2007-03-27 19:54:21 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Old DataDrivableResult is now called DataDrivableRowResult. New DataDrivableResult is parent of all its DataDrivableRowResult. Updated some unit tests to account for this change. Added compact format to data driven results file when countRow=false. Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java Added Paths: ----------- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java Property Changed: ---------------- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java Modified: trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-03-28 02:54:21 UTC (rev 1491) @@ -4,10 +4,16 @@ #if ($results.dataDriven) #if ($results.isA("net.sf.jameleon.result.CountableResult")) - #set( $countRow = "true") + #set( $standardFormat = true) #else - #set( $countRow = "false") + <!-- compact format --> + #set( $standardFormat = false) #end + #if ($results.isA("net.sf.jameleon.result.DataDrivableResult")) + #set( $isARow = false) + #else + #set( $isARow = true) + #end #parse("TestCaseResultsDataDrivenChildTemplate.txt") #elseif ($results.parent) #errors( false ) Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-03-28 02:54:21 UTC (rev 1491) @@ -1,49 +1,85 @@ -#if($countRow == "false" || $results.failed()) +#if($results.failed()) #set ($expandIcon = "minus.gif") #else #set ($expandIcon = "plus.gif") #end +#if (!$standardFormat && $isARow) + <!-- do not display the row header for compact format --> + #parse("TestCaseResultsChildTemplate.txt") +#else <div> + <img src="${results_res_dir}/icons/bullet.gif"> <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_$results.getRowNum()_data')"><i>i</i></a> #if ($results.getChildrenResults().size() > 0) <img onclick="showBranch('$results.hashCode()_$results.getRowNum()');swapIcon('$results.hashCode()_$results.getRowNum()','$results.hashCode()_$results.getRowNum()_img')" src="${results_res_dir}/icons/${expandIcon}" border="0" id="$results.hashCode()_$results.getRowNum()_img" name="expand"> #end - $shortDesc - row $results.getRowNum() +#if ($isARow) + $shortDesc - row $results.getRowNum() +#else + $shortDesc +#end </div> <span id="$results.hashCode()_$results.getRowNum()_data" class="branch"> - <table class="indent"><tr><td> - #attributes() - </td><td> - #if ( $results.getRowData() && $results.getRowData().keySet().size() > 0) - <table class="key_value"> - <tr> - <td colspan="2">$results.getElementName() data</td> - </tr> - <tr> - <th>variable</th> - <th>value</th> - </tr> - #foreach ( $key in $results.getRowData().keySet() ) - <tr> - <td class='key_value'>$key</td> - <td> $results.getRowData().get($key)</td> - </tr> +#if ($isARow) + #if ( $results.getRowData() && $results.getRowData().keySet().size() > 0) + <table class="key_value indent"> + <tr> + <td colspan="2">$results.getElementName() data</td> + </tr> + <tr> + <th>variable</th> + <th>value</th> + </tr> + #foreach ( $key in $results.getRowData().keySet() ) + <tr> + <td class='key_value'>$key</td> + <td> $results.getRowData().get($key)</td> + </tr> + #end + </table> + #end +#else + #attributes() + #if (!$standardFormat) + <!-- regroup child datas in a single table for compact format --> + #if ( $results.getChildrenResults().size() > 0) + #if ($results.getChildrenResults().get(0).getRowData() && $results.getChildrenResults().get(0).getRowData().keySet().size() > 0) + #set( $colspan = $results.getChildrenResults().get(0).getRowData().keySet().size() + 1 ) + <table class="key_value indent"> + <tr> + <td colspan="$colspan">$results.getElementName() data</td> + </tr><tr> + <th>row</th> + #foreach ( $key in $results.getChildrenResults().get(0).getRowData().keySet() ) + <th>$key</th> + #end + </tr> + #foreach ( $childResults in $results.childrenResults ) + <tr> + <td>$childResults.getRowNum()</td> + #foreach ( $value in $childResults.getRowData().values() ) + <td>$value</td> + #end + </tr> + #end + </table> #end - </table> #end - </td></tr></table> + #end +#end </span> #errors( false ) -#if ($results.failed() || $countRow == "false") +#if ($results.failed()) #set( $class = "branch_displayed") #else #set( $class = "branch") #end <span id="$results.hashCode()_$results.getRowNum()" class="$class"> #parse("TestCaseResultsChildTemplate.txt") -</span> \ No newline at end of file +</span> +#end \ No newline at end of file Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -49,12 +49,10 @@ import net.sf.jameleon.data.DataDrivable; import net.sf.jameleon.event.TestCaseEventHandler; import net.sf.jameleon.exception.JameleonScriptException; -import net.sf.jameleon.result.CountableDataDrivableResult; -import net.sf.jameleon.result.DataDrivableResult; -import net.sf.jameleon.result.FunctionResult; +import net.sf.jameleon.result.CountableDataDrivableRowResult; +import net.sf.jameleon.result.DataDrivableRowResult; import net.sf.jameleon.result.JameleonTestResult; import net.sf.jameleon.result.TestCaseResult; -import net.sf.jameleon.result.TestResultWithChildren; import net.sf.jameleon.util.*; /** @@ -120,11 +118,11 @@ protected TestCaseResult results; //TODO: Remove this. This is a workaround to get correct failed and passed results - protected DataDrivableResult ddResult; + protected DataDrivableRowResult ddRowResult; //TODO: Remove this also. Additional getter required to get row number in session tag if useCSV=true - public DataDrivableResult getDdResult() { - return ddResult; + public DataDrivableRowResult getDdResult() { + return ddRowResult; } protected ArrayList keysSet = new ArrayList(); @@ -693,12 +691,12 @@ */ public void executeDrivableRow(int rowNum){ traceMsg("BEGIN executing row number "+rowNum); - ddResult = new CountableDataDrivableResult(fp, results); - ddResult.copyLocationAwareProperties(this); - ddResult.setRowData(rowData); - ddResult.setRowNum(rowNum); + ddRowResult = new CountableDataDrivableRowResult(fp, results); + ddRowResult.copyLocationAwareProperties(this); + ddRowResult.setRowData(rowData); + ddRowResult.setRowNum(rowNum); stateStorer.setStoreDir(getResultsDir(rowNum)); - invokeChildren(rowNum, ddResult); + invokeChildren(rowNum, ddRowResult); traceMsg("END executing row number "+rowNum); } @@ -752,9 +750,9 @@ * @param result - the result to record */ protected void recordResult(JameleonTestResult result){ - if (ddResult != null) { - ddResult.addChildResult(result); - result.setParentResults(ddResult); + if (ddRowResult != null) { + ddRowResult.addChildResult(result); + result.setParentResults(ddRowResult); }else if (results != null) { results.addChildResult(result); result.setParentResults(results); Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -39,14 +39,7 @@ import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.event.BreakPoint; import net.sf.jameleon.exception.JameleonScriptException; -import net.sf.jameleon.result.CountableDataDrivableResult; -import net.sf.jameleon.result.DataDrivableResult; -import net.sf.jameleon.result.DataDrivableResultRecordable; -import net.sf.jameleon.result.FunctionResult; -import net.sf.jameleon.result.FunctionResultRecordable; -import net.sf.jameleon.result.JameleonTestResult; -import net.sf.jameleon.result.SessionResult; -import net.sf.jameleon.result.SessionResultRecordable; +import net.sf.jameleon.result.*; import net.sf.jameleon.util.StateStorer; /** @@ -72,6 +65,7 @@ protected Map vars; protected DataDrivableResult dataDrivableResult; + protected DataDrivableRowResult dataDrivableRowResult; protected boolean countRow; protected StateStorer stateStorer = StateStorer.getInstance(); protected File previousStateDir; @@ -261,11 +255,11 @@ try{ //The first result has already been added. if (rowNum > 1){ - dataDrivableResult = createNewResult(); + dataDrivableRowResult = createNewResult(); recordThisResult(); } - dataDrivableResult.setRowData(vars); - dataDrivableResult.setRowNum(rowNum); + dataDrivableRowResult.setRowData(vars); + dataDrivableRowResult.setRowNum(rowNum); stateStorer.setStoreDir(new File(stateStorer.getStoreDir(), getNewStateStoreLocation(rowNum))); try { invokeBody(xmlOut); @@ -285,10 +279,10 @@ la.setLineNumber(getLineNumber()); la.setFileName(getFileName()); JameleonScriptException jse = new JameleonScriptException(err.getMessage(), la); - dataDrivableResult.setError(jse); + dataDrivableRowResult.setError(jse); throw jse; }else{ - dataDrivableResult.setError(err); + dataDrivableRowResult.setError(err); } } finally { stateStorer.setStoreDir(previousStateDir); @@ -297,7 +291,7 @@ } } }finally{ - removeChildlessResult(dataDrivableResult); + removeChildlessResult(dataDrivableRowResult); failedOnCurrentRow = false; traceMsg("END executing row number "+rowNum); } @@ -356,18 +350,22 @@ if (addt == null) { addt = this; } - dataDrivableResult = createNewResult(); + dataDrivableResult = new DataDrivableResult((FunctionalPoint) fp.clone()); + dataDrivableRowResult = createNewResult(); Object obj = findAncestorWithClass(DataDrivableResultRecordable.class); if (obj != null) { resultRecorder = (DataDrivableResultRecordable)obj; + dataDrivableResult.copyLocationAwareProperties(this); + resultRecorder.recordDataDrivableResult(dataDrivableResult); } recordThisResult(); } protected void recordThisResult(){ - dataDrivableResult.copyLocationAwareProperties(this); + dataDrivableRowResult.copyLocationAwareProperties(this); if (resultRecorder != null) { - resultRecorder.recordDataDrivableResult(dataDrivableResult); + dataDrivableResult.addChildResult(dataDrivableRowResult); + dataDrivableRowResult.setParentResults(dataDrivableResult); } } @@ -395,23 +393,23 @@ }catch(Throwable t){ setResultError(new JameleonScriptException(t)); }finally{ - dataDrivableResult.setTag((FunctionalPoint) fp.clone()); + dataDrivableRowResult.setTag((FunctionalPoint) fp.clone()); resetFunctionalPoint(); } } /** - * Removes the current result from its parent if it has no children, meaning the tags weren't actually run - * @param result - The result to remove + * Removes the current rowResult from its parent if it has no children, meaning the tags weren't actually run + * @param rowResult - The rowResult to remove */ - protected void removeChildlessResult(DataDrivableResult result){ - if (result.passed() && - ( result.getChildrenResults() == null || - result.getChildrenResults().size() == 0 ) ) { - if (result.getParentResults() != null) { - List results = result.getParentResults().getChildrenResults(); + protected void removeChildlessResult(DataDrivableRowResult rowResult){ + if (rowResult.passed() && + ( rowResult.getChildrenResults() == null || + rowResult.getChildrenResults().size() == 0 ) ) { + if (rowResult.getParentResults() != null) { + List results = rowResult.getParentResults().getChildrenResults(); if (results != null) { - int index = results.lastIndexOf(result); + int index = results.lastIndexOf(rowResult); results.remove(index); } } @@ -419,15 +417,15 @@ } protected void setResultError(Exception e){ - dataDrivableResult.setError(e); + dataDrivableRowResult.setError(e); } - protected DataDrivableResult createNewResult(){ - DataDrivableResult ddr = null; + protected DataDrivableRowResult createNewResult(){ + DataDrivableRowResult ddr = null; if (isCountRow()){ - ddr = new CountableDataDrivableResult((FunctionalPoint) fp.clone()); + ddr = new CountableDataDrivableRowResult((FunctionalPoint) fp.clone()); }else{ - ddr = new DataDrivableResult((FunctionalPoint) fp.clone()); + ddr = new DataDrivableRowResult((FunctionalPoint) fp.clone()); } return ddr; } @@ -437,8 +435,8 @@ return rowData; } - public DataDrivableResult getDataDrivableResult(){ - return dataDrivableResult; + public DataDrivableRowResult getDataDrivableRowResult(){ + return dataDrivableRowResult; } ///////////////////////////////////////////////////////// @@ -451,13 +449,13 @@ * @param result - the result to record */ protected void recordResult(JameleonTestResult result){ - if (dataDrivableResult != null) { - dataDrivableResult.addChildResult(result); - result.setParentResults(dataDrivableResult); + if (dataDrivableRowResult != null) { + dataDrivableRowResult.addChildResult(result); + result.setParentResults(dataDrivableRowResult); } } /** - * Records a DataDrivableResult to the tag's results + * Records a DataDrivableRowResult to the tag's results * @param result */ public void recordDataDrivableResult(DataDrivableResult result){ Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -18,12 +18,11 @@ */ package net.sf.jameleon.logging; -import java.text.NumberFormat; import java.util.Date; import java.util.Iterator; import java.util.List; -import net.sf.jameleon.result.DataDrivableResult; +import net.sf.jameleon.result.DataDrivableRowResult; import net.sf.jameleon.result.JameleonTestResult; import net.sf.jameleon.result.TestCaseResult; import net.sf.jameleon.util.JameleonUtility; @@ -79,7 +78,7 @@ protected Integer getFailedRowNum(JameleonTestResult result){ int rowNum = 0; - DataDrivableResult ddr = (DataDrivableResult)result.findAncestorByClass(DataDrivableResult.class); + DataDrivableRowResult ddr = (DataDrivableRowResult)result.findAncestorByClass(DataDrivableRowResult.class); if (ddr != null){ rowNum = ddr.getRowNum(); } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -1,7 +1,7 @@ /* Jameleon - An automation testing tool.. Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -29,7 +29,6 @@ public CountableDataDrivableResult(FunctionalPoint tag) { super(tag); - // TODO Auto-generated constructor stub } public CountableDataDrivableResult(FunctionalPoint tag, HasChildResults parentResults){ Added: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -0,0 +1,50 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +public class CountableDataDrivableRowResult extends DataDrivableRowResult + implements CountableResult { + + private static final long serialVersionUID = 1L; + + protected boolean countableResultFailed; + + public CountableDataDrivableRowResult(FunctionalPoint tag) { + super(tag); + } + + public CountableDataDrivableRowResult(FunctionalPoint tag, HasChildResults parentResults){ + super(tag, parentResults); + } + + ///////////////////////////////////////////////////////////////////////////////// + // CountableResult methods // + ///////////////////////////////////////////////////////////////////////////////// + + public void countFailure(){ + countableResultFailed = true; + } + + public boolean isCountableResultFailed(){ + return countableResultFailed; + } + +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -1,7 +1,7 @@ /* Jameleon - An automation testing tool.. Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -18,8 +18,6 @@ */ package net.sf.jameleon.result; -import java.util.Map; - import net.sf.jameleon.bean.FunctionalPoint; /** @@ -29,15 +27,6 @@ public class DataDrivableResult extends TestResultWithChildren { private static final long serialVersionUID = 1L; - /** - * The row number of exeuction for the data-drivable tag - */ - protected int rowNum; - /** - * The row data for the data-drivable tag - */ - protected Map rowData; - public DataDrivableResult(FunctionalPoint tag){ super(tag); } @@ -50,22 +39,6 @@ return true; } - public Map getRowData(){ - return rowData; - } - - public void setRowData(Map rowData){ - this.rowData = rowData; - } - - public int getRowNum(){ - return rowNum; - } - - public void setRowNum(int rowNum){ - this.rowNum = rowNum; - } - /** * @return a XML String representation of the results */ @@ -82,4 +55,4 @@ public String toString() { return super.toString(); } -} \ No newline at end of file +} Added: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -0,0 +1,85 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import java.util.Map; + +import net.sf.jameleon.bean.FunctionalPoint; + +/** + * An implementation of @see TestResult that represents the results of a data-drivable tag. + * A DataDrivableRowResult can contain session results and function point results. + */ +public class DataDrivableRowResult extends TestResultWithChildren { + private static final long serialVersionUID = 1L; + + /** + * The row number of exeuction for the data-drivable tag + */ + protected int rowNum; + /** + * The row data for the data-drivable tag + */ + protected Map rowData; + + public DataDrivableRowResult(FunctionalPoint tag){ + super(tag); + } + + public DataDrivableRowResult(FunctionalPoint tag, HasChildResults parentResults){ + super(tag, parentResults); + } + + public boolean isDataDriven() { + return true; + } + + public Map getRowData(){ + return rowData; + } + + public void setRowData(Map rowData){ + this.rowData = rowData; + } + + public int getRowNum(){ + return rowNum; + } + + public void setRowNum(int rowNum){ + this.rowNum = rowNum; + } + + /** + * @return a XML String representation of the results + */ + public String toXML() { + StringBuffer buffer = new StringBuffer("\t<data-drivable-row>\n"); + buffer.append(super.toXML()); + buffer.append("\t</data-drivable-row>\n"); + return buffer.toString(); + } + + /** + * @return A String representation of the results + */ + public String toString() { + return super.toString(); + } +} \ No newline at end of file Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -56,7 +56,7 @@ import net.sf.jameleon.event.TestCaseEvent; import net.sf.jameleon.event.TestCaseListener; import net.sf.jameleon.function.FunctionTag; -import net.sf.jameleon.result.DataDrivableResult; +import net.sf.jameleon.result.DataDrivableRowResult; import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.JameleonTestResult; import net.sf.jameleon.result.TestCaseResult; @@ -422,7 +422,7 @@ protected Integer getFailedRowNum(JameleonTestResult result){ int rowNum = 0; - DataDrivableResult ddr = (DataDrivableResult)result.findAncestorByClass(DataDrivableResult.class); + DataDrivableRowResult ddr = (DataDrivableRowResult)result.findAncestorByClass(DataDrivableRowResult.class); if (ddr != null){ rowNum = ddr.getRowNum(); } Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCaseResultsFrame.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -19,7 +19,7 @@ package net.sf.jameleon; import net.sf.jameleon.bean.FunctionalPoint; -import net.sf.jameleon.result.DataDrivableResult; +import net.sf.jameleon.result.DataDrivableRowResult; /** * Simply overrides the <code>CsvTag</code>'s destroyVariables() method. @@ -28,11 +28,12 @@ public class MockCsvTag2 extends CsvTag { protected void setResultError(Exception e){ - if (dataDrivableResult == null){ - dataDrivableResult = new DataDrivableResult(new FunctionalPoint()); + if (dataDrivableRowResult == null){ + dataDrivableRowResult = new DataDrivableRowResult(new FunctionalPoint()); recordThisResult(); } - dataDrivableResult.setError(e); + dataDrivableRowResult.setError(e); + dataDrivableResult.setError(e); } } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -28,12 +28,10 @@ import junit.framework.Test; import junit.framework.TestSuite; -import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.bean.TestCase; import net.sf.jameleon.event.TestCaseEventHandler; import net.sf.jameleon.event.TestTestCaseListener; import net.sf.jameleon.exception.JameleonScriptException; -import net.sf.jameleon.result.*; import net.sf.jameleon.util.AssertLevel; import net.sf.jameleon.util.Configurator; import net.sf.jameleon.util.JameleonUtility; @@ -128,9 +126,9 @@ mTct.executeDrivableRow(2); assertEquals("rowNum after call", 2, mTct.invokeChildrenRowNum); assertNotNull("dd result after call", mTct.mockTagDDResult); - assertTrue("dd result should be the same", mTct.ddResult == mTct.mockTagDDResult); - assertEquals("row number", 2, mTct.ddResult.getRowNum()); - Map rowData = mTct.ddResult.getRowData(); + assertTrue("dd result should be the same", mTct.ddRowResult == mTct.mockTagDDResult); + assertEquals("row number", 2, mTct.ddRowResult.getRowNum()); + Map rowData = mTct.ddRowResult.getRowData(); assertEquals("# of row variables", 3, rowData.size()); assertEquals("row variable 1", "val1", rowData.get("var1")); assertEquals("row variable 2", "val2", rowData.get("var2")); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -35,7 +35,6 @@ import net.sf.jameleon.MockSessionTag; import net.sf.jameleon.TestCaseTag; -import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.result.*; @@ -73,9 +72,9 @@ } public void testCreateNewResult(){ - assertFalse("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableResult); + assertFalse("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableRowResult); mockDdTag.countRow = true; - assertTrue("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableResult); + assertTrue("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableRowResult); } public void testSetUpDataDrivable(){ @@ -101,9 +100,9 @@ } public void testGetDataDrivableResult(){ - DataDrivableResult ddr = new DataDrivableResult(null); - mockDdTag.dataDrivableResult = ddr; - assertTrue(ddr == mockDdTag.getDataDrivableResult()); + DataDrivableRowResult ddr = new DataDrivableRowResult(null); + mockDdTag.dataDrivableRowResult = ddr; + assertTrue(ddr == mockDdTag.getDataDrivableRowResult()); } public void testAddVariablesToRowData(){ @@ -130,30 +129,32 @@ } public void testExecuteDrivableRowNullDataDrivableResult(){ - assertNull("dataDrivableResult should be null", mockDdTag.dataDrivableResult); + assertNull("dataDrivableResult should be null", mockDdTag.dataDrivableRowResult); Map vars = new HashMap(); vars.put("1", "one"); mockDdTag.setUpDataDrivable(); mockDdTag.addVariablesToRowData(vars); + DataDrivableRowResult ddrr = new DataDrivableRowResult(null); DataDrivableResult ddr = new DataDrivableResult(null); + mockDdTag.dataDrivableRowResult = ddrr; mockDdTag.dataDrivableResult = ddr; mockDdTag.executeDrivableRow(1); - assertNotNull("dataDrivableResult should not be null", mockDdTag.dataDrivableResult); - assertTrue("dataDrivableResult should not have changed", ddr == mockDdTag.dataDrivableResult); - assertFalse("dataDrivableResult should not be countable", mockDdTag.dataDrivableResult instanceof CountableDataDrivableResult); - assertEquals("row data '1'", vars.get("1"), ddr.getRowData().get("1")); - assertEquals("row #", 1, ddr.getRowNum()); + assertNotNull("dataDrivableResult should not be null", mockDdTag.dataDrivableRowResult); + assertTrue("dataDrivableResult should not have changed", ddrr == mockDdTag.dataDrivableRowResult); + assertFalse("dataDrivableResult should not be countable", mockDdTag.dataDrivableRowResult instanceof CountableDataDrivableRowResult); + assertEquals("row data '1'", vars.get("1"), ddrr.getRowData().get("1")); + assertEquals("row #", 1, ddrr.getRowNum()); mockDdTag.executeDrivableRow(2); - DataDrivableResult ddr2 = mockDdTag.getDataDrivableResult(); + DataDrivableRowResult ddr2 = mockDdTag.getDataDrivableRowResult(); //Since countRow defaults to false, the dataDrivableResult should not have changed since the last execution - assertFalse("dataDrivableResult should still not be countable", mockDdTag.dataDrivableResult instanceof CountableDataDrivableResult); - assertTrue("a new result should have been created", ddr != mockDdTag.dataDrivableResult); + assertFalse("dataDrivableResult should still not be countable", mockDdTag.dataDrivableRowResult instanceof CountableDataDrivableRowResult); + assertTrue("a new result should have been created", ddrr != mockDdTag.dataDrivableRowResult); assertEquals("row #", 2, ddr2.getRowNum()); mockDdTag.setCountRow(true); mockDdTag.executeDrivableRow(3); - ddr2 = mockDdTag.getDataDrivableResult(); - assertNotNull("dataDrivableResult should not be null", mockDdTag.dataDrivableResult); - assertTrue("dataDrivableResult should be countable", mockDdTag.dataDrivableResult instanceof CountableDataDrivableResult); + ddr2 = mockDdTag.getDataDrivableRowResult(); + assertNotNull("dataDrivableResult should not be null", mockDdTag.dataDrivableRowResult); + assertTrue("dataDrivableResult should be countable", mockDdTag.dataDrivableRowResult instanceof CountableDataDrivableRowResult); assertEquals("row #", 3, ddr2.getRowNum()); } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -25,7 +25,7 @@ import junit.framework.TestSuite; public class CountableDataDrivableResultTest extends TestCase { - private CountableDataDrivableResult cddr; + private CountableDataDrivableRowResult cddr; public CountableDataDrivableResultTest(String name) { super(name); @@ -40,7 +40,7 @@ } public void setUp(){ - cddr = new CountableDataDrivableResult(new FunctionalPoint()); + cddr = new CountableDataDrivableRowResult(new FunctionalPoint()); } public void testCountFailure(){ Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultTest.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultTest.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -29,7 +29,7 @@ public class DataDrivableResultTest extends TestCase { - private DataDrivableResult ddResult; + private DataDrivableRowResult ddRowResult; private static final FunctionalPoint tag = new FunctionalPoint(); public static void main(String args[]) { @@ -45,36 +45,36 @@ } public void setUp(){ - ddResult = new DataDrivableResult(tag); + ddRowResult = new DataDrivableRowResult(tag); } public void testConstructor(){ - assertNotNull("DataDrivableResult after call to constructor", ddResult); - assertEquals("# of child results", 0, ddResult.childrenResults.size()); - assertTrue(tag == ddResult.tag); + assertNotNull("DataDrivableRowResult after call to constructor", ddRowResult); + assertEquals("# of child results", 0, ddRowResult.childrenResults.size()); + assertTrue(tag == ddRowResult.tag); } public void testConstructor2(){ - DataDrivableResult dr = new DataDrivableResult(tag, ddResult); - assertNotNull("DataDrivableResult after call to constructor", dr); + DataDrivableRowResult dr = new DataDrivableRowResult(tag, ddRowResult); + assertNotNull("DataDrivableRowResult after call to constructor", dr); assertEquals("# of child results", 0, dr.childrenResults.size()); assertTrue(tag == dr.tag); - assertTrue(ddResult == dr.parentResults); + assertTrue(ddRowResult == dr.parentResults); } public void testGetSetRowNum(){ - ddResult.setRowNum(1); - assertEquals("rowNum", 1, ddResult.getRowNum()); - ddResult.setRowNum(2); - assertEquals("rowNum", 2, ddResult.getRowNum()); + ddRowResult.setRowNum(1); + assertEquals("rowNum", 1, ddRowResult.getRowNum()); + ddRowResult.setRowNum(2); + assertEquals("rowNum", 2, ddRowResult.getRowNum()); } public void testGetSetRowData(){ Map vars = new HashMap(); vars.put("1", "one"); vars.put("2", "two"); - ddResult.setRowData(vars); - assertEquals("# of variables in data-drivable vars", 2, ddResult.getRowData().size()); + ddRowResult.setRowData(vars); + assertEquals("# of variables in data-drivable vars", 2, ddRowResult.getRowData().size()); } public void testToXML(){ @@ -84,12 +84,12 @@ res.getTag().setFunctionId("some id"); File f = new File("some/file.txt"); res.setErrorFile(f); - ddResult.addChildResult(res); - String xml = ddResult.toXML(); + ddRowResult.addChildResult(res); + String xml = ddRowResult.toXML(); XMLHelper xmlHelper = new XMLHelper(xml); - String value = xmlHelper.getValueFromXPath("/data-drivable/children-results/function-point/functionId/text()"); + String value = xmlHelper.getValueFromXPath("/data-drivable-row/children-results/function-point/functionId/text()"); assertEquals("functionId", "some id", value); - value = xmlHelper.getValueFromXPath("/data-drivable/children-results/function-point/error-file-name/text()"); + value = xmlHelper.getValueFromXPath("/data-drivable-row/children-results/function-point/error-file-name/text()"); assertEquals("resulsFileName", f.getPath(), value); SessionResult sessionRes = new SessionResult(new FunctionalPoint()); @@ -101,11 +101,11 @@ res2.setError(new RuntimeException("some error message")); sessionRes.addChildResult(res2); - ddResult.addChildResult(sessionRes); + ddRowResult.addChildResult(sessionRes); - xml = ddResult.toXML(); + xml = ddRowResult.toXML(); xmlHelper = new XMLHelper(xml); - value = xmlHelper.getValueFromXPath("/data-drivable/children-results/session-result/application/text()"); + value = xmlHelper.getValueFromXPath("/data-drivable-row/children-results/session-result/application/text()"); assertEquals("session application", "app2", value); } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java 2007-03-28 02:35:33 UTC (rev 1490) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java 2007-03-28 02:54:21 UTC (rev 1491) @@ -56,10 +56,10 @@ public void testGetPercentagePassed(){ for (int i = 0; i < 4; i++) { - new CountableDataDrivableResult(tag, results); + new CountableDataDrivableRowResult(tag, results); } assertEquals("percent passed", "100%", results.getPercentagePassed()); - CountableDataDrivableResult cfr = new CountableDataDrivableResult(tag, results); + CountableDataDrivableRowResult cfr = new CountableDataDrivableRowResult(tag, results); cfr.setError(new RuntimeException("failure 1")); assertEquals("percent passed", "80%", results.getPercentagePassed()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-03-28 14:31:26
|
Revision: 1494 http://svn.sourceforge.net/jameleon/?rev=1494&view=rev Author: engrean Date: 2007-03-28 07:31:25 -0700 (Wed, 28 Mar 2007) Log Message: ----------- Replaced link to script file with a span of the actual source. Also reordered testcase attributes. Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsTemplate.txt trunk/jameleon-core/res/testCaseDocs.css trunk/jameleon-core/src/java/net/sf/jameleon/bean/TestCase.java trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java trunk/jameleon-core/tst/java/net/sf/jameleon/bean/TestCaseTest.java Modified: trunk/jameleon-core/res/TestCaseResultsTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-28 14:29:20 UTC (rev 1493) +++ trunk/jameleon-core/res/TestCaseResultsTemplate.txt 2007-03-28 14:31:25 UTC (rev 1494) @@ -6,31 +6,33 @@ </head> <body> <table width="100%" cellspacing="0" class="fields"> - <tr> - <td class="header">Test Case Script</td> - <td><a href="$tc.file" target="_new">$tc.file</a></td> - </tr> <tr class="alt"> - <td class="header" width="22%">Test Case</td><td>$!tc.name</td> + <td class="header" width="15%">Test Case</td><td>$!tc.name</td> </tr> <tr> <td class="header">Summary</td><td>$!tc.summary</td> </tr> <tr><td colspan="2"> </td></tr> <tr class="alt"> + <td class="header">Test Case ID</td><td>$!tc.testCaseId</td> + </tr> + <tr> + <td class="header">Requirement ID</td><td>$!tc.testCaseRequirement</td> + </tr> + <tr class="alt"> <td class="header">Author</td><td>$!tc.author</td> </tr> <tr> - <td class="header">Application Tested</td><td>$!tc.application</td> + <td class="header">Bug(s)</td><td>#foreach ( $bug in $tc.bugs ) <a href="${bugTrackerUrl}${bug}">$bug</a> #end</td> </tr> <tr class="alt"> - <td class="header">Feature Tested</td><td>$!tc.functionalPointTested</td> + <td class="header">Application Tested</td><td>$!tc.application</td> </tr> <tr> - <td class="header">Test Level(s)</td><td>#foreach ( $level in $tc.testLevels ) $level #end</td> + <td class="header">Feature Tested</td><td>$!tc.functionalPointTested</td> </tr> <tr class="alt"> - <td class="header">Bug(s)</td><td>#foreach ( $bug in $tc.bugs ) <a href="${bugTrackerUrl}${bug}">$bug</a> #end</td> + <td class="header">Test Level(s)</td><td>#foreach ( $level in $tc.testLevels ) $level #end</td> </tr> <tr> <td class="header">Test Environment</td><td>$!tc.testEnvironment</td> @@ -39,35 +41,39 @@ <td class="header">Organization</td><td>$!tc.organization</td> </tr> <tr> - <td class="header">Test Case ID</td><td>$!tc.testCaseId</td> + <td class="header">Script Source</td> + <td><div><a href="javascript:showInfo('script_source')"><i>view source</i></a></div> + <span id="script_source" class="source"> + <pre> +$tc.scriptContents + </pre> + </span> + </td> </tr> + </table> + <br/> + <table width="100%" class="key_value"> <tr class="alt"> - <td class="header">Requirement ID</td><td>$!tc.testCaseRequirement</td> + <th width="15%">Execution Time</th> + <th width="10%"># Run</th> + <th width="10%"># Fail</th> + <th width="15%">Pass</th> + <th width="50%">Failures</th> </tr> - </table> - <br> - <table width="100%" class="key_value"> - <tr class="alt"> - <th width="15%">Execution Time</th> - <th width="10%"># Run</th> - <th width="10%"># Fail</th> - <th width="15%">Pass</th> - <th width="50%">Failures</th> - </tr> - <tr> - <td>$results.getExecutionTimeToDisplay()</td> - <td>$results.getCountableResults().size()</td> - <td>$results.getFailedCountableResults().size()</td> - <td>$results.getPercentagePassed()</td> - <td class="failures"> + <tr> + <td>$results.getExecutionTimeToDisplay()</td> + <td>$results.getCountableResults().size()</td> + <td>$results.getFailedCountableResults().size()</td> + <td>$results.getPercentagePassed()</td> + <td class="failures"> #foreach ( $result in $results.getAllFailedLeafChildrenResults() ) <a href="#$result.hashCode()">$result.errorMsg</a> <br/> #end - </td> - </tr> - </table> - <hr> - <a href="javascript:expandAll('root')">Expand all</a> | <a href="javascript:collapseAll('root')">Collapse all</a> + </td> + </tr> + </table> + <hr/> + <font size="1"><a href="javascript:expandAll('root')">Expand all</a> | <a href="javascript:collapseAll('root')">Collapse all</a></font> <br/><br/> #errors( false ) <div id='root'> Modified: trunk/jameleon-core/res/testCaseDocs.css =================================================================== --- trunk/jameleon-core/res/testCaseDocs.css 2007-03-28 14:29:20 UTC (rev 1493) +++ trunk/jameleon-core/res/testCaseDocs.css 2007-03-28 14:31:25 UTC (rev 1494) @@ -48,6 +48,14 @@ display: none; margin-left: 16px; } +.source{ + display: none; + background-color: #FFF9DF; + border-right: 1px solid #888; + border-left: 1px solid #888; + border-top: 1px solid #888; + border-bottom: 1px solid #888; +} .branch_displayed{ display: block; margin-left: 16px; Modified: trunk/jameleon-core/src/java/net/sf/jameleon/bean/TestCase.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/bean/TestCase.java 2007-03-28 14:29:20 UTC (rev 1493) +++ trunk/jameleon-core/src/java/net/sf/jameleon/bean/TestCase.java 2007-03-28 14:31:25 UTC (rev 1494) @@ -16,6 +16,9 @@ package net.sf.jameleon.bean; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; import java.io.IOException; import java.net.URL; import java.util.Iterator; @@ -147,6 +150,24 @@ return file; } + public String getScriptContents(){ + File f = new File(file); + StringBuffer contents = new StringBuffer(); + if (f.exists() && f.isFile()) { + try{ + BufferedReader reader = new BufferedReader(new FileReader(f)); + String line = null; + while((line = reader.readLine()) != null){ + contents.append(line+"\n"); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + String escapedContents = JameleonUtility.decodeTextToXML(contents.toString()); + return escapedContents; + } + public String getFunctionalPointTested(){ return functionalPointTested; } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-03-28 14:29:20 UTC (rev 1493) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-03-28 14:31:25 UTC (rev 1494) @@ -31,8 +31,9 @@ public class TestCaseResult extends TestResultWithChildren implements CountableResult { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; + /** * The name of the test case */ Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/bean/TestCaseTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/bean/TestCaseTest.java 2007-03-28 14:29:20 UTC (rev 1493) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/bean/TestCaseTest.java 2007-03-28 14:31:25 UTC (rev 1494) @@ -18,12 +18,15 @@ */ package net.sf.jameleon.bean; +import java.io.File; import java.util.List; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; + import net.sf.jameleon.util.Configurator; +import net.sf.jameleon.util.JameleonUtility; import net.sf.jameleon.util.XMLHelper; public class TestCaseTest extends TestCase { @@ -94,6 +97,16 @@ testCase = null; } + public void testGetScriptContents(){ + File f = new File("tst/xml/acceptance/testsuite.xml"); + String s = f.getAbsolutePath(); + //Jelly adds a '/' at the beginning under windows. Let's that it works + testCase.setFile(File.separator+s); + String scriptContents = testCase.getScriptContents(); + assertTrue("no > symbols should exist", scriptContents.indexOf(">") == -1); + assertTrue("no < symbols should exist", scriptContents.indexOf("<") == -1); + } + public void testAddTestCaseLevel(){ assertEquals("# of test case levels", 2, testCase.getTestLevels().size()); testCase.addTestLevel(TEST_LEVEL1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-04-28 21:08:15
|
Revision: 1504 http://svn.sourceforge.net/jameleon/?rev=1504&view=rev Author: engrean Date: 2007-04-28 14:08:13 -0700 (Sat, 28 Apr 2007) Log Message: ----------- Added unit tests that weren't added, did some refactoring of the results to help tell differentiate between containers and actual results. Fixed logic that shows a single data-driven tag when countRow is false and one tag for each row when countRow is true. Fix various other little bugs. Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/ExecuteJameleonScriptTag.java trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java trunk/jameleon-core/src/java/net/sf/jameleon/result/HasChildResults.java trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/RowResultContainer.java trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResultRecordable.java trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/TestResultWithChildren.java trunk/jameleon-core/src/java/net/sf/jameleon/result/TestSuiteResult.java trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/FunctionResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/JameleonTestResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/MockTestResultWithChildren.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/SessionResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestCaseResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestResultWithChildrenTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/TestSuiteResultTest.java Added Paths: ----------- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResultContainer.java trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableFunctionResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultContainer.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultContainerTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableRowResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableFunctionResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultContainerTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableRowResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/MockCountableResult.java Removed Paths: ------------- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/result/DataDrivableResultTest.java Modified: trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/res/TestCaseResultsChildTemplate.txt 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,35 +1,48 @@ #foreach ( $results in $results.childrenResults ) - + ##ENTRY - $results.getClass()<br/> #set( $shortDesc = $results.identifier ) #if ($results.dataDriven) - <h2>$results.getClass()</h2> + ##DATA_DRIVEN - $results.getClass()<br/> ##Only display data-drivable tags that have children - #if ($results.getChildrenResults().size() > 0) - #if ($results.isA("net.sf.jameleon.result.CountableResult")) - #set( $countableResult = true) + #set ( $numOfChildren = $results.getChildrenResults().size() ) + #if ($numOfChildren > 0 || ($numOfChildren == 0 && $results.failed()) ) + ##HAS_CHILDREN - $results.getClass()<br/> + ##Is it a container? + #if ( $results.isA("net.sf.jameleon.result.RowResultContainer") && !$results.isCountable()) + ##IS_CONTAINER - $results.getClass()<br/> + #parse("TestCaseResultsDataDrivenNotCountableContainer.txt") + #parse("TestCaseResultsChildTemplate.txt") + #elseif ( $results.isA("net.sf.jameleon.result.RowResultContainer") && $results.isCountable()) + ##IS_COUNTABLE_ROW_CONTAINER - $results.getClass()<br/> + #parse("TestCaseResultsChildTemplate.txt") #else - <!-- compact format --> - #set( $countableResult = false) + ##This means it isn't a container, but it's a countable row + #if ($results.isA("net.sf.jameleon.result.CountableDataDrivableRowResult")) + ##IS_COUNTABLE_ROW - $results.getClass()<br/> + #parse("TestCaseResultsDataDrivenChildTemplate.txt") + #else + ##IS_NON_COUNTABLE_ROW - $results.getClass()<br/> + ##since it's not a countable row result, we don't want to see info on the tag + #parse("TestCaseResultsChildTemplate.txt") + #end #end - #if ($results.isA("net.sf.jameleon.result.DataDrivableResult")) - #set( $isARow = false) - #else - #set( $isARow = true) - #end - #parse("TestCaseResultsDataDrivenChildTemplate.txt") #end #elseif ($results.parent) + ##IS_PARENT - $results.getClass()<br/> + <div> + <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> + <a href="javascript:showInfo('$results.hashCode()_parent_tag')"><i>i</i></a> + $shortDesc + </div> + <span id="$results.hashCode()_parent_tag" class="branch"> + <table class="indent"> + <tr><td>#attributes()</td></tr> + </table> + </span> #errors() - #if ( !$results.failed() || !$results.getError() ) - <br/><a href="javascript:showInfo('$results.hashCode()_parent_tag')"><i>i</i></a> <b>Steps for <i>$results.elementName</i></b><br/> - <span id="$results.hashCode()_parent_tag" class="branch"> - <table class="indent"> - <tr><td>#attributes()</td></tr> - </table> - </span> - #parse("TestCaseResultsChildTemplate.txt") - #end + #parse("TestCaseResultsChildTemplate.txt") #else + ##IS_LEAF_NODE - $results.getClass()<br/> #parse("TestCaseResultsLeafChildTemplate.txt") #end #end \ No newline at end of file Modified: trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/res/TestCaseResultsDataDrivenChildTemplate.txt 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,4 +1,4 @@ -#if($results.failed() || !$countableResult) +#if($results.failed()) #set( $class = "branch_displayed") #set ($expandIcon = "minus.gif") #else @@ -6,25 +6,15 @@ #set ($expandIcon = "plus.gif") #end -#if ( !$countableResult && $isARow ) - <!-- do not display the row header for compact format --> - #parse("TestCaseResultsChildTemplate.txt") -#else <div> - <img src="${results_res_dir}/icons/bullet.gif"> <img src="${results_res_dir}/icons/${results.getOutcome()}.gif"> <a href="javascript:showInfo('$results.hashCode()_$results.getRowNum()_data')"><i>i</i></a> <img onclick="showBranch('$results.hashCode()_$results.getRowNum()');swapIcon('$results.hashCode()_$results.getRowNum()','$results.hashCode()_$results.getRowNum()_img')" src="${results_res_dir}/icons/${expandIcon}" border="0" id="$results.hashCode()_$results.getRowNum()_img" name="expand"> -#if ($isARow) $shortDesc - row $results.getRowNum() -#else - $shortDesc -#end </div> <span id="$results.hashCode()_$results.getRowNum()_data" class="branch"> -#if ($isARow) #attributes() #if ( $results.getRowData() && $results.getRowData().keySet().size() > 0) <table class="key_value indent"> @@ -43,39 +33,9 @@ #end </table> #end -#else - #attributes() - #if (!$countableResult) - ## regroup child datas in a single table for compact format - #if ( $results.getChildrenResults().size() > 0) - #if ($results.getChildrenResults().get(0).getRowData() && $results.getChildrenResults().get(0).getRowData().keySet().size() > 0) - #set( $colspan = $results.getChildrenResults().get(0).getRowData().keySet().size() + 1 ) - <table class="key_value indent"> - <tr> - <td colspan="$colspan">$results.getElementName() data</td> - </tr><tr> - <th>row</th> - #foreach ( $key in $results.getChildrenResults().get(0).getRowData().keySet() ) - <th>$key</th> - #end - </tr> - #foreach ( $childResults in $results.childrenResults ) - <tr> - <td>$childResults.getRowNum()</td> - #foreach ( $value in $childResults.getRowData().values() ) - <td>$value</td> - #end - </tr> - #end - </table> - #end - #end - #end -#end </span> #errors() <span id="$results.hashCode()_$results.getRowNum()" class="$class"> #parse("TestCaseResultsChildTemplate.txt") </span> -#end \ No newline at end of file Modified: trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/SessionTag.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -32,7 +32,7 @@ import net.sf.jameleon.bean.FunctionalPoint; import net.sf.jameleon.data.AbstractDataDrivableTag; import net.sf.jameleon.exception.JameleonScriptException; -import net.sf.jameleon.result.DataDrivableResult; +import net.sf.jameleon.result.DataDrivableResultContainer; import net.sf.jameleon.result.DataDrivableResultRecordable; import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.FunctionResultRecordable; @@ -404,10 +404,10 @@ recordResult(result); } /** - * Records a DataDrivableResult to the tag's results + * Records a DataDrivableResultContainer to the tag's results * @param result */ - public void recordDataDrivableResult(DataDrivableResult result){ + public void recordDataDrivableResult(DataDrivableResultContainer result){ recordResult(result); } } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -49,10 +49,7 @@ import net.sf.jameleon.data.DataDrivable; import net.sf.jameleon.event.TestCaseEventHandler; import net.sf.jameleon.exception.JameleonScriptException; -import net.sf.jameleon.result.CountableDataDrivableRowResult; -import net.sf.jameleon.result.DataDrivableRowResult; -import net.sf.jameleon.result.JameleonTestResult; -import net.sf.jameleon.result.TestCaseResult; +import net.sf.jameleon.result.*; import net.sf.jameleon.util.*; /** @@ -102,6 +99,7 @@ protected TestCaseEventHandler eventHandler = TestCaseEventHandler.getInstance(); protected long startTime; protected File resultsFile; + protected CountableDataDrivableResultContainer rowResultContainer; /** * DEFAULT - true. @@ -656,9 +654,9 @@ } catch (ThreadDeath td){ throw td; } catch (Throwable t) { - if (trace){ - log.info(JameleonUtility.getStack(t)); - } + if (trace){ + log.info(JameleonUtility.getStack(t)); + } LocationAware la = null; Throwable err = t; if (t.getCause() != null && t.getCause() instanceof LocationAware) { @@ -674,12 +672,10 @@ jse = new JameleonScriptException(err.getMessage(), la); } if (jse != null) { - logError(jse); - result.setError(jse); - }else{ - logError(err); - result.setError(err); + err = jse; } + logError(err); + result.setError(t); } finally{ result.setExecutionTime(System.currentTimeMillis() - startTime); } @@ -692,7 +688,11 @@ */ public void executeDrivableRow(int rowNum){ traceMsg("BEGIN executing row number "+rowNum); - ddRowResult = new CountableDataDrivableRowResult(fp, results); + TestResultWithChildren res = results; + if (rowResultContainer != null) { + res = rowResultContainer; + } + ddRowResult = new CountableDataDrivableRowResult(fp, res); ddRowResult.copyLocationAwareProperties(this); ddRowResult.setRowData(rowData); ddRowResult.setRowNum(rowNum); @@ -704,6 +704,10 @@ protected void initResults(){ results = new TestCaseResult(getFunctionalPoint()); results.copyLocationAwareProperties(this); + if (useCSV) { + rowResultContainer = new CountableDataDrivableResultContainer(getFunctionalPoint(), results); + rowResultContainer.copyLocationAwareProperties(this); + } } /** Modified: trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/data/AbstractDataDrivableTag.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -64,7 +64,7 @@ protected Map rowData = new HashMap(); protected Map vars; - protected DataDrivableResult dataDrivableResult; + protected DataDrivableResultContainer resultContainer; protected DataDrivableRowResult dataDrivableRowResult; protected boolean countRow; protected StateStorer stateStorer = StateStorer.getInstance(); @@ -144,7 +144,7 @@ /** * Sets the DataDrivable tag to increment the number of times the test case was executed * for each row executed. - * @param countRow - Set to true to increment the test case results for + * @param countRow - Set to true to increment the test case results for every row executed * @jameleon.attribute default="false" */ public void setCountRow(boolean countRow){ @@ -297,6 +297,10 @@ } } + public DataDrivableResultContainer getResultContainer(){ + return resultContainer; + } + /** * To continue on a normal execution path even though an error occurs, set this to false * @jameleon.attribute @@ -350,13 +354,17 @@ if (addt == null) { addt = this; } - dataDrivableResult = new DataDrivableResult((FunctionalPoint) fp.clone()); + if (isCountRow()) { + resultContainer = new CountableDataDrivableResultContainer((FunctionalPoint) fp.clone()); + }else{ + resultContainer = new DataDrivableResultContainer((FunctionalPoint) fp.clone()); + } dataDrivableRowResult = createNewResult(); Object obj = findAncestorWithClass(DataDrivableResultRecordable.class); if (obj != null) { resultRecorder = (DataDrivableResultRecordable)obj; - dataDrivableResult.copyLocationAwareProperties(this); - resultRecorder.recordDataDrivableResult(dataDrivableResult); + resultContainer.copyLocationAwareProperties(this); + resultRecorder.recordDataDrivableResult(resultContainer); } recordThisResult(); } @@ -364,8 +372,8 @@ protected void recordThisResult(){ dataDrivableRowResult.copyLocationAwareProperties(this); if (resultRecorder != null) { - dataDrivableResult.addChildResult(dataDrivableRowResult); - dataDrivableRowResult.setParentResults(dataDrivableResult); + resultContainer.addChildResult(dataDrivableRowResult); + dataDrivableRowResult.setParentResults(resultContainer); } } @@ -418,6 +426,7 @@ protected void setResultError(Exception e){ dataDrivableRowResult.setError(e); + resultContainer.setError(e); } protected DataDrivableRowResult createNewResult(){ @@ -458,7 +467,7 @@ * Records a DataDrivableRowResult to the tag's results * @param result */ - public void recordDataDrivableResult(DataDrivableResult result){ + public void recordDataDrivableResult(DataDrivableResultContainer result){ recordResult(result); } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/ExecuteJameleonScriptTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/ExecuteJameleonScriptTag.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/plugin/junit/ExecuteJameleonScriptTag.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -33,9 +33,9 @@ import net.sf.jameleon.event.TestCaseListener; import net.sf.jameleon.logging.JameleonHTMLLayout; import net.sf.jameleon.logging.JameleonXMLLayout; -import net.sf.jameleon.result.CountableDataDrivableResult; -import net.sf.jameleon.result.DataDrivableResult; -import net.sf.jameleon.result.DataDrivableResultRecordable; +import net.sf.jameleon.result.CountableDataDrivableResultContainer; +import net.sf.jameleon.result.CountableFunctionResult; +import net.sf.jameleon.result.FunctionResultRecordable; import net.sf.jameleon.result.FunctionResult; import net.sf.jameleon.result.JameleonTestResult; import net.sf.jameleon.result.TestCaseResult; @@ -182,7 +182,6 @@ result = tct.getResults(); } }; - protected DataDrivableResult dataDrivableResult; public void testBlock(){ String errMsg = executeScript(); @@ -286,17 +285,15 @@ base.setLevel(Level.INFO); TestCaseEventHandler.getInstance().addTestCaseListener(listener); - dataDrivableResult = new CountableDataDrivableResult(fp); - dataDrivableResult.copyLocationAwareProperties(this); - - DataDrivableResultRecordable resultRecorder = (DataDrivableResultRecordable)findAncestorWithClass(DataDrivableResultRecordable.class); - resultRecorder.recordDataDrivableResult(dataDrivableResult); - getFunctionResults().setParentResults(dataDrivableResult); } protected void setUpFunctionResults(){ - fResults = new FunctionResult(fp); + fResults = new CountableFunctionResult(fp); fResults.copyLocationAwareProperties(this); + Object obj = findAncestorWithClass(FunctionResultRecordable.class); + if (obj != null) { + ((FunctionResultRecordable)obj).recordFunctionResult(fResults); + } } public void tearDown(){ Deleted: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,50 +0,0 @@ -/* - Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package net.sf.jameleon.result; - -import net.sf.jameleon.bean.FunctionalPoint; - -public class CountableDataDrivableResult extends DataDrivableResult - implements CountableResult, RowResultContainer { - - private static final long serialVersionUID = 1L; - - protected boolean countableResultFailed; - - public CountableDataDrivableResult(FunctionalPoint tag) { - super(tag); - } - - public CountableDataDrivableResult(FunctionalPoint tag, HasChildResults parentResults){ - super(tag, parentResults); - } - - ///////////////////////////////////////////////////////////////////////////////// - // CountableResult methods // - ///////////////////////////////////////////////////////////////////////////////// - - public void countFailure(){ - countableResultFailed = true; - } - - public boolean isCountableResultFailed(){ - return countableResultFailed; - } - -} Copied: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResultContainer.java (from rev 1503, trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResult.java) =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResultContainer.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableResultContainer.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,42 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +public class CountableDataDrivableResultContainer + extends DataDrivableResultContainer implements RowResultContainer { + + private static final long serialVersionUID = 1L; + + public CountableDataDrivableResultContainer(FunctionalPoint tag) { + super(tag); + } + + public CountableDataDrivableResultContainer(FunctionalPoint tag, HasChildResults parentResults){ + super(tag, parentResults); + } + + ///////////////////////////////////////////////////////////////////////// + // RowResultContainer implementations // + ///////////////////////////////////////////////////////////////////////// + public boolean isCountable(){ + return true; + } +} Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableDataDrivableRowResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Added: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableFunctionResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableFunctionResult.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableFunctionResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,65 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +/** + * An implementation of @see TestResult that represents the result of a function point + */ +public class CountableFunctionResult extends FunctionResult implements CountableResult { + private static final long serialVersionUID = 1L; + + /** + * The default constructor + */ + public CountableFunctionResult(){ + super(); + } + + /** + * @param tag - The functional point tied to the results + */ + public CountableFunctionResult(FunctionalPoint tag){ + super(tag); + } + + /** + * @param tag - The functional point tied to the results + * @param parentTestResult - The parent test results to update + */ + public CountableFunctionResult(FunctionalPoint tag, HasChildResults parentTestResult){ + super(tag, parentTestResult); + } + + + /** + * Mark this result a failed + */ + public void countFailure(){ + setFailed(); + } + /** + * Get whether this result failed or not + * @return true if the result failed + */ + public boolean isCountableResultFailed(){ + return failed(); + } +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableFunctionResult.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/CountableResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,14 +18,13 @@ */ package net.sf.jameleon.result; - /** * Describes a result that is countable */ public interface CountableResult { - /** - * Mark this result a failed - */ + /** + * Mark this result a failed + */ public void countFailure(); /** * Get whether this result failed or not Deleted: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,58 +0,0 @@ -/* - Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package net.sf.jameleon.result; - -import net.sf.jameleon.bean.FunctionalPoint; - -/** - * An implementation of @see TestResult that represents the results of a data-drivable tag. - * A DataDrivableResult can contain session results and function point results. - */ -public class DataDrivableResult extends TestResultWithChildren implements RowResultContainer { - private static final long serialVersionUID = 1L; - - public DataDrivableResult(FunctionalPoint tag){ - super(tag); - } - - public DataDrivableResult(FunctionalPoint tag, HasChildResults parentResults){ - super(tag, parentResults); - } - - public boolean isDataDriven() { - return true; - } - - /** - * @return a XML String representation of the results - */ - public String toXML() { - StringBuffer buffer = new StringBuffer("\t<data-drivable>\n"); - buffer.append(super.toXML()); - buffer.append("\t</data-drivable>\n"); - return buffer.toString(); - } - - /** - * @return A String representation of the results - */ - public String toString() { - return super.toString(); - } -} Copied: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultContainer.java (from rev 1503, trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResult.java) =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultContainer.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultContainer.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,66 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * An implementation of @see TestResult that represents the results of a data-drivable tag. + * A DataDrivableResult can contain session results and function point results. + */ +public class DataDrivableResultContainer extends TestResultWithChildren implements RowResultContainer { + private static final long serialVersionUID = 1L; + + public DataDrivableResultContainer(FunctionalPoint tag){ + super(tag); + } + + public DataDrivableResultContainer(FunctionalPoint tag, HasChildResults parentResults){ + super(tag, parentResults); + } + + public List getCountableResults(){ + List countabeResults = new ArrayList(); + countabeResults.addAll(getCountableChildResults()); + return countabeResults; + } + + public boolean isCountable(){ + return false; + } + + public boolean isDataDriven(){ + return true; + } + + /** + * @return a XML String representation of the results + */ + public String toXML() { + StringBuffer buffer = new StringBuffer("\t<data-drivable>\n"); + buffer.append(super.toXML()); + buffer.append("\t</data-drivable>\n"); + return buffer.toString(); + } + +} Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableResultRecordable.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,6 @@ * Records a DataDrivableResult to the tag's results * @param result - the result to add */ - public void recordDataDrivableResult(DataDrivableResult result); + public void recordDataDrivableResult(DataDrivableResultContainer result); } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/DataDrivableRowResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,7 @@ * An implementation of @see TestResult that represents the results of a data-drivable tag. * A DataDrivableRowResult can contain session results and function point results. */ -public class DataDrivableRowResult extends TestResultWithChildren { +public class DataDrivableRowResult extends TestResultWithChildren{ private static final long serialVersionUID = 1L; /** @@ -46,10 +46,6 @@ super(tag, parentResults); } - public boolean isDataDriven() { - return true; - } - public Map getRowData(){ return rowData; } @@ -66,6 +62,10 @@ this.rowNum = rowNum; } + public boolean isDataDriven(){ + return true; + } + /** * @return a XML String representation of the results */ Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/FunctionResultRecordable.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/HasChildResults.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/HasChildResults.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/HasChildResults.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/JameleonTestResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/RowResultContainer.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/RowResultContainer.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/RowResultContainer.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -22,4 +22,11 @@ * Describes a result that contains row results */ public interface RowResultContainer { + + /** + * Used to define whether the tag's countRow is set to true or false. + * + * @return truen if countRow is set to true + */ + boolean isCountable(); } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResultRecordable.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResultRecordable.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/SessionResultRecordable.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/TestCaseResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -108,20 +108,13 @@ public List getCountableResults(){ List countabeResults = new ArrayList(); - Object obj; - for (Iterator it = getChildrenResults().iterator(); it.hasNext();) { - obj = it.next(); - if (obj instanceof HasChildResults) { - countabeResults.addAll(((HasChildResults)obj).getCountableResults()); - } - } + countabeResults.addAll(getCountableChildResults()); if (countabeResults.size() == 0) { countabeResults.add(this); } return countabeResults; } - /** * Gets all the failed ancestor children results that can be counted as * test case results Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/TestResultWithChildren.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/TestResultWithChildren.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/TestResultWithChildren.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -107,16 +107,31 @@ return allFailedLeafResults; } + /** + * Gets all the countable ancestor children results that can be counted as + * test case results + * + * @return List + */ public List getCountableResults(){ List countabeResults = new ArrayList(); Object obj; if (this instanceof CountableResult) { countabeResults.add(this); } + countabeResults.addAll(getCountableChildResults()); + return countabeResults; + } + + protected List getCountableChildResults(){ + List countabeResults = new ArrayList(); + Object obj; for (Iterator it = getChildrenResults().iterator(); it.hasNext();) { obj = it.next(); if (obj instanceof HasChildResults) { countabeResults.addAll(((HasChildResults)obj).getCountableResults()); + }else if (obj instanceof CountableResult) { + countabeResults.add(obj); } } return countabeResults; Modified: trunk/jameleon-core/src/java/net/sf/jameleon/result/TestSuiteResult.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/result/TestSuiteResult.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/src/java/net/sf/jameleon/result/TestSuiteResult.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/MockCsvTag2.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,13 +27,13 @@ */ public class MockCsvTag2 extends CsvTag { - protected void setResultError(Exception e){ - if (dataDrivableRowResult == null){ - dataDrivableRowResult = new DataDrivableRowResult(new FunctionalPoint()); - recordThisResult(); - } - dataDrivableRowResult.setError(e); - dataDrivableResult.setError(e); + protected void setResultError(Exception e){ + if (getDataDrivableRowResult() == null) { + dataDrivableRowResult = new DataDrivableRowResult(new FunctionalPoint()); + recordThisResult(); + } + getDataDrivableRowResult().setError(e); + getResultContainer().setError(e); } } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/TestCaseTagTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -114,6 +114,7 @@ public void testExecuteDrivableRow() throws Exception{ MockTestCase2Tag mTct = new MockTestCase2Tag(); + mTct.setCountRow(true); mTct.setContext(new JellyContext()); mTct.initResults(); assertEquals("verify default value",-1, mTct.invokeChildrenRowNum); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/data/AbstractDataDrivableTagTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,6 +1,6 @@ /* Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -71,6 +71,15 @@ mockDdTag.setParent(mockST); } + public void testInit() throws Exception{ + assertNull("result container should be null", mockDdTag.getResultContainer()); + mockDdTag.init(); + assertFalse("result container should not be countable", mockDdTag.getResultContainer().isCountable()); + mockDdTag.setCountRow(true); + mockDdTag.init(); + assertTrue("result container should be countable", mockDdTag.getResultContainer().isCountable()); + } + public void testCreateNewResult(){ assertFalse("result should not be countable", mockDdTag.createNewResult() instanceof CountableDataDrivableRowResult); mockDdTag.countRow = true; @@ -135,9 +144,9 @@ mockDdTag.setUpDataDrivable(); mockDdTag.addVariablesToRowData(vars); DataDrivableRowResult ddrr = new DataDrivableRowResult(null); - DataDrivableResult ddr = new DataDrivableResult(null); + DataDrivableResultContainer ddr = new DataDrivableResultContainer(null); mockDdTag.dataDrivableRowResult = ddrr; - mockDdTag.dataDrivableResult = ddr; + mockDdTag.resultContainer = ddr; mockDdTag.executeDrivableRow(1); assertNotNull("dataDrivableResult should not be null", mockDdTag.dataDrivableRowResult); assertTrue("dataDrivableResult should not have changed", ddrr == mockDdTag.dataDrivableRowResult); Added: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultContainerTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultContainerTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultContainerTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,46 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class CountableDataDrivableResultContainerTest extends TestCase { + + public CountableDataDrivableResultContainerTest(String name) { + super(name); + } + + public static void main(String args[]) { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() { + return new TestSuite( CountableDataDrivableResultContainerTest.class ); + } + + public void testIsCountable(){ + CountableDataDrivableResultContainer cddrc = new CountableDataDrivableResultContainer(new FunctionalPoint()); + assertTrue(cddrc.isCountable()); + } + +} Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultContainerTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Deleted: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java 2007-04-27 03:39:23 UTC (rev 1503) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -1,56 +0,0 @@ -/* - Jameleon - An automation testing tool.. - Copyright (C) 2006 Christian W. Hargraves (en...@ho...) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package net.sf.jameleon.result; - -import net.sf.jameleon.bean.FunctionalPoint; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class CountableDataDrivableResultTest extends TestCase { - private CountableDataDrivableRowResult cddr; - - public CountableDataDrivableResultTest(String name) { - super(name); - } - - public static void main(String args[]) { - junit.textui.TestRunner.run( suite() ); - } - - public static Test suite() { - return new TestSuite( CountableDataDrivableResultTest.class ); - } - - public void setUp(){ - cddr = new CountableDataDrivableRowResult(new FunctionalPoint()); - } - - public void testCountFailure(){ - cddr.countFailure(); - assertTrue(cddr.countableResultFailed); - } - - public void testIsCountableResultFailed(){ - assertFalse(cddr.isCountableResultFailed()); - cddr.countFailure(); - assertTrue(cddr.isCountableResultFailed()); - } -} Copied: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableRowResultTest.java (from rev 1503, trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableResultTest.java) =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableRowResultTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableDataDrivableRowResultTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,56 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2006-2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.bean.FunctionalPoint; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class CountableDataDrivableRowResultTest extends TestCase { + private CountableDataDrivableRowResult cddr; + + public CountableDataDrivableRowResultTest(String name) { + super(name); + } + + public static void main(String args[]) { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() { + return new TestSuite( CountableDataDrivableRowResultTest.class ); + } + + public void setUp(){ + cddr = new CountableDataDrivableRowResult(new FunctionalPoint()); + } + + public void testCountFailure(){ + cddr.countFailure(); + assertTrue(cddr.countableResultFailed); + } + + public void testIsCountableResultFailed(){ + assertFalse(cddr.isCountableResultFailed()); + cddr.countFailure(); + assertTrue(cddr.isCountableResultFailed()); + } +} Added: trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableFunctionResultTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableFunctionResultTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/result/CountableFunctionResultTest.java 2007-04-28 21:08:13 UTC (rev 1504) @@ -0,0 +1,64 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.result; + +import net.sf.jameleon.DummyJameleonTagSupport; +import net.sf.jameleon.bean.FunctionalPoint; +import net.sf.jameleon.util.JameleonUtility; +import net.sf.j... [truncated message content] |
From: <en...@us...> - 2007-05-11 07:10:31
|
Revision: 1508 http://svn.sourceforge.net/jameleon/?rev=1508&view=rev Author: engrean Date: 2007-05-11 00:10:24 -0700 (Fri, 11 May 2007) Log Message: ----------- Fixed bug # 1685266 - errorlinks in testcase.html Modified Paths: -------------- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java Added Paths: ----------- trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/TestStoreTag.java trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/ValidateResultsFileTag.java trunk/jameleon-core/tst/xml/acceptance/stateStorerTest.xml Modified: trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt =================================================================== --- trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-05-11 07:05:56 UTC (rev 1507) +++ trunk/jameleon-core/res/TestCaseResultsLeafChildTemplate.txt 2007-05-11 07:10:24 UTC (rev 1508) @@ -9,7 +9,7 @@ src="${results_res_dir}/icons/plus.gif" border="0" id="$results.hashCode()_img" name="expand"> #end #if ( $results.errorFile ) -<a href="$results.errorFile.name"><img src="${results_res_dir}/icons/snapShot.gif"></a> +<a href="..$fileSeparator..$fileSeparator$results.errorFile.getPath()"><img src="${results_res_dir}/icons/snapShot.gif"></a> #end $shortDesc </div> @@ -28,5 +28,3 @@ </span> #errors() </span> - - Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-05-11 07:05:56 UTC (rev 1507) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-05-11 07:10:24 UTC (rev 1508) @@ -916,6 +916,7 @@ } vars.put("tc", getTestCase()); + vars.put("fileSeparator", File.separator); vars.put("results", getResults()); vars.put("printFileName", Boolean.TRUE); vars.put("results_res_dir", RESULTS_RES_DIR); Added: trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/TestStoreTag.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/TestStoreTag.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/TestStoreTag.java 2007-05-11 07:10:24 UTC (rev 1508) @@ -0,0 +1,49 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.plugin.junit; + +import java.io.File; +import java.io.IOException; + +import net.sf.jameleon.util.JameleonUtility; +import net.sf.jameleon.util.StateStorer; + +/** + * @jameleon.function name="test-store" type="action" + */ +public class TestStoreTag extends JUnitFunctionTag { + + /** + * @jameleon.attribute default="fileStored" + */ + private String fileStoredContextVar; + + public void store(String filename, int event) throws IOException{ + File file = new File(filename+".txt"); + JameleonUtility.recordResultsToFile(file, "test text"); + getFunctionResults().setErrorFile(file); + setVariable(fileStoredContextVar, file); + } + + public void testBlock(){ + StateStorer.getInstance().eventOccured(StateStorer.ON_COMMAND_EVENT); + } + + +} Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/TestStoreTag.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/ValidateResultsFileTag.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/ValidateResultsFileTag.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/ValidateResultsFileTag.java 2007-05-11 07:10:24 UTC (rev 1508) @@ -0,0 +1,44 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.plugin.junit; + +import java.io.File; +import java.util.List; + +import net.sf.jameleon.result.FunctionResult; + +/** + * @jameleon.function name="validate-results-file" type="action" + */ + +public class ValidateResultsFileTag extends JUnitFunctionTag { + + /** + * @jameleon.attribute required="true" + */ + private File expectedFile; + + public void testBlock(){ + List results = getFunctionResults().getParentResults().getChildrenResults(); + //Get the results from the previous tag + FunctionResult result = (FunctionResult)results.get(results.size()-2); + assertTrue("The file was not saved", result.getErrorFile().exists()); + assertEquals("file path", expectedFile.getAbsolutePath(), result.getErrorFile().getAbsolutePath()); + } +} \ No newline at end of file Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/ValidateResultsFileTag.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/tst/xml/acceptance/stateStorerTest.xml =================================================================== --- trunk/jameleon-core/tst/xml/acceptance/stateStorerTest.xml (rev 0) +++ trunk/jameleon-core/tst/xml/acceptance/stateStorerTest.xml 2007-05-11 07:10:24 UTC (rev 1508) @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<!-- + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> +<testcase xmlns="jelly:jameleon"> + + <test-case-summary>Tests the snapshot functionality</test-case-summary> + <test-case-author>Christian Hargraves</test-case-author> + <test-case-level>ACCEPTANCE</test-case-level> + <functional-point-tested>snapshot functionality</functional-point-tested> + <application-tested>junit plugin</application-tested> + <test-store + functionId="Save a file with the contents 'test text' by spawning an error" + fileStoredContextVar="fileStored"/> + <validate-results-file + functionId="Verify that the ${fileStored} was saved" + expectedFile="${fileStored}"/> + <csv name="oneRow"> + <test-store + functionId="Spawn another on_command event inside a countRow='false' data-drivable" + fileStoredContextVar="file2Stored"/> + <validate-results-file + functionId="Verify that the ${file2Stored} was saved" + expectedFile="${file2Stored}"/> + </csv> + <csv name="oneRow" countRow="true"> + <test-store + functionId="Spawn another on_command event inside a countRow='true' data-drivable" + fileStoredContextVar="file3Stored"/> + <validate-results-file + functionId="Verify that the ${file3Stored} was saved" + expectedFile="${file3Stored}"/> + </csv> +</testcase> Property changes on: trunk/jameleon-core/tst/xml/acceptance/stateStorerTest.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-16 21:41:45
|
Revision: 1513 http://svn.sourceforge.net/jameleon/?rev=1513&view=rev Author: engrean Date: 2007-05-16 14:41:44 -0700 (Wed, 16 May 2007) Log Message: ----------- replaced xml fragment include with Ant file import. Modified Paths: -------------- trunk/jameleon-core/build.xml trunk/jameleon-core/src/xml/standard-build.xml.fragment Modified: trunk/jameleon-core/build.xml =================================================================== --- trunk/jameleon-core/build.xml 2007-05-16 21:41:22 UTC (rev 1512) +++ trunk/jameleon-core/build.xml 2007-05-16 21:41:44 UTC (rev 1513) @@ -17,13 +17,11 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> -<!DOCTYPE project [ - <!ENTITY STANDARD-BUILD SYSTEM "./src/xml/standard-build.xml.fragment"> -]> <project name="jameleon-core" default="main" basedir="."> <property name="projectTag" value="${ant.project.name}" /> <property name="htdocs.baseDir" value="htdocs" /> <property name="jameleon.core" value="true"/> + <import file="./src/xml/standard-build.xml.fragment"/> <target name="acceptance" depends="init.taskdefs, copyJameleonConf"> <delete dir="tst/_tmp"/> @@ -50,12 +48,6 @@ <target name="test.ant.task" depends="init.taskdefs" description="Executes a script using the testEnvironment and organization"> </target> - <target name="run.gui" depends="copyJameleonConf" description="Runs the GUI"> - <java classname="net.sf.jameleon.ui.JameleonUI" - classpathref="gui.classpath" - fork="true"/> - </target> - <!-- PACKAGING TARGETS --> <target name="package.releases" description="creates a src, bin and tutorial zip file" depends="package.release.src, package.release.bin, package.test-suite, package.htdocs"> @@ -294,8 +286,6 @@ </zip> </target> - &STANDARD-BUILD; - <!-- Test targets --> Modified: trunk/jameleon-core/src/xml/standard-build.xml.fragment =================================================================== --- trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-05-16 21:41:22 UTC (rev 1512) +++ trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-05-16 21:41:44 UTC (rev 1513) @@ -1,6 +1,7 @@ - +<project> <property environment="ENV"/> - <property file="build.properties" /> + <property name="ENV.JAMELEON_HOME" value="../jameleon-core"/> + <property file="build.properties"/> <property name="jdk.version" value="1.4"/> <path id="jameleon.classpath"> @@ -55,7 +56,13 @@ </fileset> <path refid="classpath"/> </path> - + + <target name="run.gui" depends="copyJameleonConf" description="Runs the GUI"> + <java classname="net.sf.jameleon.ui.JameleonUI" + classpathref="gui.classpath" + fork="true"/> + </target> + <target name="init" description="creates the needed directories" > <mkdir dir="${build.dir}" /> <mkdir dir="${dist.dir}" /> @@ -412,3 +419,4 @@ <target name="prepare.tst" depends="main, build.tst, register.functions.tst"/> <target name="quick.test" depends="prepare.tst, test"/> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-16 21:55:57
|
Revision: 1521 http://svn.sourceforge.net/jameleon/?rev=1521&view=rev Author: engrean Date: 2007-05-16 14:55:32 -0700 (Wed, 16 May 2007) Log Message: ----------- renamed standard-build.xml.fragment to standard-build.xml Modified Paths: -------------- trunk/jameleon-core/build.xml trunk/jameleon-core/xdocs/antTasks.xml Added Paths: ----------- trunk/jameleon-core/src/xml/standard-build.xml Removed Paths: ------------- trunk/jameleon-core/src/xml/standard-build.xml.fragment Modified: trunk/jameleon-core/build.xml =================================================================== --- trunk/jameleon-core/build.xml 2007-05-16 21:53:42 UTC (rev 1520) +++ trunk/jameleon-core/build.xml 2007-05-16 21:55:32 UTC (rev 1521) @@ -21,7 +21,7 @@ <property name="projectTag" value="${ant.project.name}" /> <property name="htdocs.baseDir" value="htdocs" /> <property name="jameleon.core" value="true"/> - <import file="./src/xml/standard-build.xml.fragment"/> + <import file="./src/xml/standard-build.xml"/> <target name="acceptance" depends="init.taskdefs, copyJameleonConf"> <delete dir="tst/_tmp"/> Added: trunk/jameleon-core/src/xml/standard-build.xml =================================================================== --- trunk/jameleon-core/src/xml/standard-build.xml (rev 0) +++ trunk/jameleon-core/src/xml/standard-build.xml 2007-05-16 21:55:32 UTC (rev 1521) @@ -0,0 +1,422 @@ +<project> + <property environment="ENV"/> + <property name="jameleon.home" value="../jameleon-core"/> + <property file="build.properties"/> + <property name="jdk.version" value="1.4"/> + + <path id="jameleon.classpath"> + <fileset dir="${jameleon.home}/lib"> + <include name="*.jar"/> + </fileset> + <fileset dir="${jameleon.home}/Dist"> + <include name="*.jar"/> + </fileset> + </path> + + <path id="classpath"> + <fileset dir="lib"> + <include name="*.jar"/> + </fileset> + <path refid="jameleon.classpath"/> + </path> + + <path id="test.classpath"> + <pathelement location="${tst.dir}/res"/> + <pathelement location="${tst.dir}/java"/> + <pathelement location="${build.dir}"/> + <fileset dir="${ENV.JAVA_HOME}/lib"> + <include name="tools.jar"/> + </fileset> + <fileset dir="${tst.dir}/lib"> + <include name="*.jar"/> + </fileset> + <path refid="classpath"/> + </path> + + <path id="gui.classpath"> + <fileset dir="lib"> + <include name="*.jar"/> + </fileset> + <fileset dir="${dist.dir}"> + <include name="*.jar"/> + </fileset> + <fileset dir="${tst.dir}/lib"> + <include name="*.jar"/> + </fileset> + <pathelement location="${tst.dir}/lib"/> + <path refid="jameleon.classpath"/> + </path> + + <path id="classpath.with.ant"> + <fileset dir="${jameleon.home}/lib/ant"> + <include name="*.jar"/> + </fileset> + <fileset dir="${ENV.JAVA_HOME}/lib"> + <include name="tools.jar"/> + </fileset> + <path refid="classpath"/> + </path> + + <target name="run.gui" depends="copyJameleonConf" description="Runs the GUI"> + <java classname="net.sf.jameleon.ui.JameleonUI" + classpathref="gui.classpath" + fork="true"/> + </target> + + <target name="init" description="creates the needed directories" > + <mkdir dir="${build.dir}" /> + <mkdir dir="${dist.dir}" /> + <mkdir dir="lib" /> + <mkdir dir="tst/lib" /> + <mkdir dir="res" /> + <mkdir dir="tst/java" /> + <mkdir dir="src/java" /> + <tstamp/> + </target> + + <target name="init.taskdefs" description="Intializes Task Definitions used by this build"> + <!--JAMELEON TASK DEFS --> + <taskdef resource="ant/JameleonAntTasks.properties" format="properties" classpathref="test.classpath"/> + <!--END JAMELEON TASK DEFS --> + </target> + + <target name="gen.syntax.reference" depends="init.taskdefs" if="genSyntaxRef"> + <gen-syntax-ref + plugin="${projectTag}"> + <templateParam name="pluginName" value="${pluginName}"/> + </gen-syntax-ref> + </target> + + <target name="build" depends="init" + description="This should not be called independently."> + + <javac srcdir="src/java" + destdir="${build.dir}" + debug="on" + deprecation="off" + optimize="on" + source="${jdk.version}" + classpathref="classpath" + failonerror="true"/> + </target> + + <target name="build.tst" depends="init, register.functions.tst" + description="This should not be called independently."> + + <javac srcdir="tst/java" + debug="on" + deprecation="off" + optimize="on" + source="${jdk.version}" + failonerror="true"> + <classpath> + <fileset dir="${dist.dir}"> + <include name="*.jar"/> + </fileset> + <path refid="test.classpath"/> + </classpath> + </javac> + </target> + + <target name="copyRes"> + <filter token="jar.version" value="${version}"/> + <copy todir="${build.dir}" filtering="true"> + <fileset dir="res"> + <include name="**/*.properties"/> + </fileset> + </copy> + <copy todir="${build.dir}"> + <fileset dir="res"> + <include name="**/**"/> + <exclude name="**/*.properties"/> + </fileset> + </copy> + </target> + + <target name="copyJameleonConf"> + <copy file="tst/res/jameleon.conf" todir="${basedir}"/> + </target> + + <target name="jar" depends="init" + description="creates a jar file from the compiled code." > + + <manifest file="MANIFEST.MF"> + <section name="common"> + <attribute name="Specification-Title" value="Jameleon"/> + <attribute name="Specification-Version" value="${version}"/> + <attribute name="Implementation-Title" value="${ant.project.name}"/> + <attribute name="Implementation-Version" value="${version} ${TODAY}"/> + </section> + </manifest> + <jar jarfile="${dist.dir}/${ant.project.name}.jar" + basedir="${build.dir}" + manifest="MANIFEST.MF"/> + <delete file="MANIFEST.MF"/> + </target> + + <target name="javadocs" depends="main" + description="Creates JavaDocs for this project"> + <echo message="${ENV.JAVA_HOME}"/> + <delete dir="docs/javadocs"/> + <mkdir dir="docs/javadocs"/> + <javadoc packagenames="net.sf.jameleon.*" + sourcepath="src/java" + destdir="docs/javadocs" + author="true" + version="true" + use="true" + windowtitle="Jameleon API Documentation" + doctitle="Jameleon API Documentation" + access="protected" + classpathref="classpath.with.ant"> + <bottom><![CDATA[Copyright © Christian W. Hargraves.<br><img src="http://sourceforge.net/sflogo.php?group_id=84246&type=1">]]></bottom> + <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/> + <link href="http://jakarta.apache.org/commons/jelly/apidocs/"/> + <taglet name="net.sf.jameleon.taglet.JameleonFunctionTaglet" path="${jameleon.home}/${dist.dir}/jameleon-core.jar"/> + <taglet name="net.sf.jameleon.taglet.JameleonStepTaglet" path="${jameleon.home}/${dist.dir}/jameleon-core.jar"/> + <taglet name="net.sf.jameleon.taglet.JameleonAttributeTaglet" path="${jameleon.home}/${dist.dir}/jameleon-core.jar"/> + <taglet name="net.sf.jameleon.taglet.JameleonApplicationTaglet" path="${jameleon.home}/${dist.dir}/jameleon-core.jar"/> + </javadoc> + </target> + + <target name="cleanSyntaxRef" if="genSyntaxRef"> + <delete file="xdocs/syntax-reference.xml"/> + </target> + + <target name="cleanTest" > + <mkdir dir="tst"/> + <delete> + <fileset dir="tst" includes="**/*.class" /> + </delete> + <delete file="tst/res/TestCaseTagDefs.properties"/> + <delete file="tst/res/test-plugin.properties"/> + <delete dir="tst/_tmp" failonerror="false"/> + <delete dir="tst/res/net" failonerror="false"/> + <delete dir="tst/xml/_tmp" failonerror="false"/> + <delete dir="jameleon_test_results" failonerror="false"/> + </target> + + <target name="cleanDist" + description="deletes the dist directory"> + <delete dir="${dist.dir}" /> + </target> + + <target name="cleanZip" + description="deletes the dist directory"> + <delete> + <fileset dir="." includes="*.zip"/> + </delete> + </target> + + <target name="cleanBuild" + description="deletes the build directory"> + <delete dir="${build.dir}" /> + <delete dir="docs/javadocs" /> + <delete dir="target" /> + </target> + + <target name="cleanLogs" + description="deletes the logs generated by the build"> + <delete failonerror="false"> + <fileset dir="."> + <include name="TestResults*"/> + <include name="*log*"/> + <include name="junit*.properties"/> + <include name="**/*~"/> + <include name="*results.txt"/> + <include name="**/*.log"/> + </fileset> + </delete> + <delete dir="tst/unit_test_reports"/> + <delete dir="jameleon_test_results"/> + </target> + + <target name="cleanJameleonConf" + description="deletes jameleon.conf file copied from tst/res"> + <delete failonerror="false" file="jameleon.conf"/> + </target> + + <target name="clean" depends="cleanDist,cleanBuild, cleanTest,cleanLogs,cleanZip,cleanSyntaxRef,cleanJameleonConf" + description="deletes both the dist and build directory"/> + + <target name="test" depends="build.tst" description="Runs JUnit tests"> + <delete dir="tst/_tmp"/> + <condition property="tests" value="${test}"> + <not> + <equals arg1="${test}" arg2="$${test}"/> + </not> + </condition> + + <condition property="tests" value="TestAll.class"> + <available file="tst/java/TestAll.class"/> + </condition> + + <condition property="tests" value="**/*Test.class"> + <equals arg1="${tests}" arg2="$${tests}"/> + </condition> + + <echo message="${tests}"/> + <junit printsummary="off" fork="true" filtertrace="true" haltonfailure="true" forkmode="perBatch"> + <sysproperty key="basedir" value="${basedir}"/> + <sysproperty key="visible" value="${visible}"/> + <formatter type="brief" usefile="false"/> + <classpath> + <fileset dir="${dist.dir}"> + <include name="*.jar"/> + </fileset> + <path refid="test.classpath"/> + </classpath> + <batchtest todir="${tst.reports}"> + <fileset dir="tst/java"> + <include name="${tests}"/> + </fileset> + </batchtest> + </junit> + </target> + + <target name="register.functions.tst" depends="copyJameleonConf, init.taskdefs" description="Register function points in the tst/src directory."> + <condition property="tst.outputFileName" value="TestCaseTagDefs.properties"> + <equals arg1="${tst.outputFileName}" arg2="$${tst.outputFileName}"/> + </condition> + + <jmln-register + outputdir="tst/res" + quiet="true" + isA="org.apache.commons.jelly.TagSupport" + outputFileName="${tst.outputFileName}"> + <fileset dir="tst/java"> + <include name="**/*.java"/> + <exclude name="**/DummyTagInvalidType.java"/> + </fileset> + </jmln-register> + </target> + + <target name="register.functions" depends="init.taskdefs" description="Register Jameleon tags in the src/java directory"> + <jmln-register outputdir="${build.dir}" + outputfilename="${projectTag}.properties" + isA="org.apache.commons.jelly.TagSupport" + quiet="true"> + <fileset dir="src/java"> + <include name="**/*.java"/> + </fileset> + </jmln-register> + </target> + + <target name="test.macro" depends="init.taskdefs" description="tests that the macro named ${macro}!"> + <condition property="throwExceptionOnFailure" value="true"> + <equals arg1="${throwExceptionOnFailure}" arg2="$${throwExceptionOnFailure}"/> + </condition> + <delete dir="tst/_tmp"/> + <jmln-test throwExceptionOnFailure="${throwExceptionOnFailure}" debug="true" > + <fileset dir="tst/"> + <include name="${macro}"/> + </fileset> + </jmln-test> + </target> + + <target name="test.macro.vm" depends="init.taskdefs" description="tests that the macro named ${macro}!"> + <delete dir="tst/_tmp"/> + <jmln-test-vm classpathref="test.classpath" fork="true" separateVmPerScript="false" printFooter="true" failOnError="true"> + <fileset dir="tst/"> + <include name="${macro}"/> + </fileset> + </jmln-test-vm> + </target> + + <target name="execute.testcases" depends="copyJameleonConf, init.taskdefs" description="Executes a series of test cases"> + <delete dir="tst/_tmp"/> + <jmln-test debug="true" throwExceptionOnFailure="false" waitTimeBetweenScripts="0"> + <fileset dir="tst/xml/acceptance"> + <include name="*.xml"/> + </fileset> + </jmln-test> + </target> + + <target name="execute.testcases.vm" depends="init.taskdefs" description="Executes a series of test cases"> + <delete dir="tst/_tmp"/> + <jmln-test-vm debug="true" classpathref="test.classpath" fork="true" separateVmPerScript="false" printFooter="true"> + <fileset dir="tst/xml/acceptance"> + <include name="*.xml"/> + </fileset> + </jmln-test-vm> + </target> + + <target name="package.release.src" description="creates a src release" depends="clean"> + <zip destfile="${ant.project.name}-${version}-src.zip"> + <zipfileset dir="." prefix="${ant.project.name}-${version}-src"> + <exclude name="build.sh"/> + <exclude name="build.bat"/> + <exclude name="lib/**"/> + <exclude name=".vslick/**"/> + </zipfileset> + + <zipfileset dir="." prefix="${ant.project.name}-${version}-src" filemode="755"> + <exclude name=".vslick/**"/> + <include name="build.sh"/> + <include name="build.bat"/> + <include name="lib/**"/> + </zipfileset> + </zip> + + </target> + + <target name="jar.launcher.files" + depends="init" + description="creates a jameleon launcher jar file." + if="jameleon.core"> + + <property name="ant.launcher.dir" value="${build.dir}/tmp"/> + <property name="launcher.file" value="${dist.dir}/jameleon-launcher.jar"/> + <delete file="${launcher.file}"/> + <mkdir dir="${ant.launcher.dir}"/> + <unjar src="${lib.dir}/ant/ant-launcher.jar" dest="${ant.launcher.dir}"/> + <manifest file="MANIFEST.MF"> + <section name="common"> + <attribute name="Specification-Title" value="Jameleon"/> + <attribute name="Specification-Version" value="0.1"/> + <attribute name="Implementation-Title" value="Jameleon Launcher"/> + <attribute name="Implementation-Version" value="0.1 ${TODAY}"/> + </section> + <attribute name="Main-Class" value="net.sf.jameleon.launch.JameleonLauncher"/> + </manifest> + <jar jarfile="${launcher.file}" + basedir="${build.dir}" + manifest="MANIFEST.MF" + includes="net/sf/jameleon/launch/*.class"/> + <jar jarfile="${launcher.file}" + update="true" + basedir="${ant.launcher.dir}" + includes="**/Locator*.class"/> + <delete file="MANIFEST.MF"/> + <delete dir="${ant.launcher.dir}"/> + <delete dir="${build.dir}/net/sf/jameleon/launch"/> + </target> + + <target name="package.release.bin" description="creates a bin release" depends="main"> + <zip destfile="${ant.project.name}-${version}-bin.zip"> + <zipfileset dir="lib" prefix="${ant.project.name}-${version}-bin" filemode="755"> + <include name="**"/> + <exclude name="ant/**"/> + </zipfileset> + <zipfileset dir="${dist.dir}" prefix="${ant.project.name}-${version}-bin" filemode="755"> + <include name="${ant.project.name}.jar"/> + </zipfileset> + </zip> + </target> + + <target name="cleanAll" depends="clean"/> + + <target name="prepare" depends=""/> + + <target name="all" depends="junit, acceptance"/> + + <target name="compile" depends="build, copyRes"/> + + <target name="main" depends="compile, jar.launcher.files, init.taskdefs, register.functions, jar, gen.syntax.reference"/> + + <target name="junit" depends="prepare.tst, test"/> + + <target name="prepare.tst" depends="main, build.tst, register.functions.tst"/> + + <target name="quick.test" depends="prepare.tst, test"/> +</project> \ No newline at end of file Property changes on: trunk/jameleon-core/src/xml/standard-build.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + native Deleted: trunk/jameleon-core/src/xml/standard-build.xml.fragment =================================================================== --- trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-05-16 21:53:42 UTC (rev 1520) +++ trunk/jameleon-core/src/xml/standard-build.xml.fragment 2007-05-16 21:55:32 UTC (rev 1521) @@ -1,422 +0,0 @@ -<project> - <property environment="ENV"/> - <property name="ENV.JAMELEON_HOME" value="../jameleon-core"/> - <property file="build.properties"/> - <property name="jdk.version" value="1.4"/> - - <path id="jameleon.classpath"> - <fileset dir="${ENV.JAMELEON_HOME}/lib"> - <include name="*.jar"/> - </fileset> - <fileset dir="${ENV.JAMELEON_HOME}/Dist"> - <include name="*.jar"/> - </fileset> - </path> - - <path id="classpath"> - <fileset dir="lib"> - <include name="*.jar"/> - </fileset> - <path refid="jameleon.classpath"/> - </path> - - <path id="test.classpath"> - <pathelement location="${tst.dir}/res"/> - <pathelement location="${tst.dir}/java"/> - <pathelement location="${build.dir}"/> - <fileset dir="${ENV.JAVA_HOME}/lib"> - <include name="tools.jar"/> - </fileset> - <fileset dir="${tst.dir}/lib"> - <include name="*.jar"/> - </fileset> - <path refid="classpath"/> - </path> - - <path id="gui.classpath"> - <fileset dir="lib"> - <include name="*.jar"/> - </fileset> - <fileset dir="${dist.dir}"> - <include name="*.jar"/> - </fileset> - <fileset dir="${tst.dir}/lib"> - <include name="*.jar"/> - </fileset> - <pathelement location="${tst.dir}/lib"/> - <path refid="jameleon.classpath"/> - </path> - - <path id="classpath.with.ant"> - <fileset dir="${ENV.JAMELEON_HOME}/lib/ant"> - <include name="*.jar"/> - </fileset> - <fileset dir="${ENV.JAVA_HOME}/lib"> - <include name="tools.jar"/> - </fileset> - <path refid="classpath"/> - </path> - - <target name="run.gui" depends="copyJameleonConf" description="Runs the GUI"> - <java classname="net.sf.jameleon.ui.JameleonUI" - classpathref="gui.classpath" - fork="true"/> - </target> - - <target name="init" description="creates the needed directories" > - <mkdir dir="${build.dir}" /> - <mkdir dir="${dist.dir}" /> - <mkdir dir="lib" /> - <mkdir dir="tst/lib" /> - <mkdir dir="res" /> - <mkdir dir="tst/java" /> - <mkdir dir="src/java" /> - <tstamp/> - </target> - - <target name="init.taskdefs" description="Intializes Task Definitions used by this build"> - <!--JAMELEON TASK DEFS --> - <taskdef resource="ant/JameleonAntTasks.properties" format="properties" classpathref="test.classpath"/> - <!--END JAMELEON TASK DEFS --> - </target> - - <target name="gen.syntax.reference" depends="init.taskdefs" if="genSyntaxRef"> - <gen-syntax-ref - plugin="${projectTag}"> - <templateParam name="pluginName" value="${pluginName}"/> - </gen-syntax-ref> - </target> - - <target name="build" depends="init" - description="This should not be called independently."> - - <javac srcdir="src/java" - destdir="${build.dir}" - debug="on" - deprecation="off" - optimize="on" - source="${jdk.version}" - classpathref="classpath" - failonerror="true"/> - </target> - - <target name="build.tst" depends="init, register.functions.tst" - description="This should not be called independently."> - - <javac srcdir="tst/java" - debug="on" - deprecation="off" - optimize="on" - source="${jdk.version}" - failonerror="true"> - <classpath> - <fileset dir="${dist.dir}"> - <include name="*.jar"/> - </fileset> - <path refid="test.classpath"/> - </classpath> - </javac> - </target> - - <target name="copyRes"> - <filter token="jar.version" value="${version}"/> - <copy todir="${build.dir}" filtering="true"> - <fileset dir="res"> - <include name="**/*.properties"/> - </fileset> - </copy> - <copy todir="${build.dir}"> - <fileset dir="res"> - <include name="**/**"/> - <exclude name="**/*.properties"/> - </fileset> - </copy> - </target> - - <target name="copyJameleonConf"> - <copy file="tst/res/jameleon.conf" todir="${basedir}"/> - </target> - - <target name="jar" depends="init" - description="creates a jar file from the compiled code." > - - <manifest file="MANIFEST.MF"> - <section name="common"> - <attribute name="Specification-Title" value="Jameleon"/> - <attribute name="Specification-Version" value="${version}"/> - <attribute name="Implementation-Title" value="${ant.project.name}"/> - <attribute name="Implementation-Version" value="${version} ${TODAY}"/> - </section> - </manifest> - <jar jarfile="${dist.dir}/${ant.project.name}.jar" - basedir="${build.dir}" - manifest="MANIFEST.MF"/> - <delete file="MANIFEST.MF"/> - </target> - - <target name="javadocs" depends="main" - description="Creates JavaDocs for this project"> - <echo message="${ENV.JAVA_HOME}"/> - <delete dir="docs/javadocs"/> - <mkdir dir="docs/javadocs"/> - <javadoc packagenames="net.sf.jameleon.*" - sourcepath="src/java" - destdir="docs/javadocs" - author="true" - version="true" - use="true" - windowtitle="Jameleon API Documentation" - doctitle="Jameleon API Documentation" - access="protected" - classpathref="classpath.with.ant"> - <bottom><![CDATA[Copyright © Christian W. Hargraves.<br><img src="http://sourceforge.net/sflogo.php?group_id=84246&type=1">]]></bottom> - <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/> - <link href="http://jakarta.apache.org/commons/jelly/apidocs/"/> - <taglet name="net.sf.jameleon.taglet.JameleonFunctionTaglet" path="${ENV.JAMELEON_HOME}/${dist.dir}/jameleon-core.jar"/> - <taglet name="net.sf.jameleon.taglet.JameleonStepTaglet" path="${ENV.JAMELEON_HOME}/${dist.dir}/jameleon-core.jar"/> - <taglet name="net.sf.jameleon.taglet.JameleonAttributeTaglet" path="${ENV.JAMELEON_HOME}/${dist.dir}/jameleon-core.jar"/> - <taglet name="net.sf.jameleon.taglet.JameleonApplicationTaglet" path="${ENV.JAMELEON_HOME}/${dist.dir}/jameleon-core.jar"/> - </javadoc> - </target> - - <target name="cleanSyntaxRef" if="genSyntaxRef"> - <delete file="xdocs/syntax-reference.xml"/> - </target> - - <target name="cleanTest" > - <mkdir dir="tst"/> - <delete> - <fileset dir="tst" includes="**/*.class" /> - </delete> - <delete file="tst/res/TestCaseTagDefs.properties"/> - <delete file="tst/res/test-plugin.properties"/> - <delete dir="tst/_tmp" failonerror="false"/> - <delete dir="tst/res/net" failonerror="false"/> - <delete dir="tst/xml/_tmp" failonerror="false"/> - <delete dir="jameleon_test_results" failonerror="false"/> - </target> - - <target name="cleanDist" - description="deletes the dist directory"> - <delete dir="${dist.dir}" /> - </target> - - <target name="cleanZip" - description="deletes the dist directory"> - <delete> - <fileset dir="." includes="*.zip"/> - </delete> - </target> - - <target name="cleanBuild" - description="deletes the build directory"> - <delete dir="${build.dir}" /> - <delete dir="docs/javadocs" /> - <delete dir="target" /> - </target> - - <target name="cleanLogs" - description="deletes the logs generated by the build"> - <delete failonerror="false"> - <fileset dir="."> - <include name="TestResults*"/> - <include name="*log*"/> - <include name="junit*.properties"/> - <include name="**/*~"/> - <include name="*results.txt"/> - <include name="**/*.log"/> - </fileset> - </delete> - <delete dir="tst/unit_test_reports"/> - <delete dir="jameleon_test_results"/> - </target> - - <target name="cleanJameleonConf" - description="deletes jameleon.conf file copied from tst/res"> - <delete failonerror="false" file="jameleon.conf"/> - </target> - - <target name="clean" depends="cleanDist,cleanBuild, cleanTest,cleanLogs,cleanZip,cleanSyntaxRef,cleanJameleonConf" - description="deletes both the dist and build directory"/> - - <target name="test" depends="build.tst" description="Runs JUnit tests"> - <delete dir="tst/_tmp"/> - <condition property="tests" value="${test}"> - <not> - <equals arg1="${test}" arg2="$${test}"/> - </not> - </condition> - - <condition property="tests" value="TestAll.class"> - <available file="tst/java/TestAll.class"/> - </condition> - - <condition property="tests" value="**/*Test.class"> - <equals arg1="${tests}" arg2="$${tests}"/> - </condition> - - <echo message="${tests}"/> - <junit printsummary="off" fork="true" filtertrace="true" haltonfailure="true" forkmode="perBatch"> - <sysproperty key="basedir" value="${basedir}"/> - <sysproperty key="visible" value="${visible}"/> - <formatter type="brief" usefile="false"/> - <classpath> - <fileset dir="${dist.dir}"> - <include name="*.jar"/> - </fileset> - <path refid="test.classpath"/> - </classpath> - <batchtest todir="${tst.reports}"> - <fileset dir="tst/java"> - <include name="${tests}"/> - </fileset> - </batchtest> - </junit> - </target> - - <target name="register.functions.tst" depends="copyJameleonConf, init.taskdefs" description="Register function points in the tst/src directory."> - <condition property="tst.outputFileName" value="TestCaseTagDefs.properties"> - <equals arg1="${tst.outputFileName}" arg2="$${tst.outputFileName}"/> - </condition> - - <jmln-register - outputdir="tst/res" - quiet="true" - isA="org.apache.commons.jelly.TagSupport" - outputFileName="${tst.outputFileName}"> - <fileset dir="tst/java"> - <include name="**/*.java"/> - <exclude name="**/DummyTagInvalidType.java"/> - </fileset> - </jmln-register> - </target> - - <target name="register.functions" depends="init.taskdefs" description="Register Jameleon tags in the src/java directory"> - <jmln-register outputdir="${build.dir}" - outputfilename="${projectTag}.properties" - isA="org.apache.commons.jelly.TagSupport" - quiet="true"> - <fileset dir="src/java"> - <include name="**/*.java"/> - </fileset> - </jmln-register> - </target> - - <target name="test.macro" depends="init.taskdefs" description="tests that the macro named ${macro}!"> - <condition property="throwExceptionOnFailure" value="true"> - <equals arg1="${throwExceptionOnFailure}" arg2="$${throwExceptionOnFailure}"/> - </condition> - <delete dir="tst/_tmp"/> - <jmln-test throwExceptionOnFailure="${throwExceptionOnFailure}" debug="true" > - <fileset dir="tst/"> - <include name="${macro}"/> - </fileset> - </jmln-test> - </target> - - <target name="test.macro.vm" depends="init.taskdefs" description="tests that the macro named ${macro}!"> - <delete dir="tst/_tmp"/> - <jmln-test-vm classpathref="test.classpath" fork="true" separateVmPerScript="false" printFooter="true" failOnError="true"> - <fileset dir="tst/"> - <include name="${macro}"/> - </fileset> - </jmln-test-vm> - </target> - - <target name="execute.testcases" depends="copyJameleonConf, init.taskdefs" description="Executes a series of test cases"> - <delete dir="tst/_tmp"/> - <jmln-test debug="true" throwExceptionOnFailure="false" waitTimeBetweenScripts="0"> - <fileset dir="tst/xml/acceptance"> - <include name="*.xml"/> - </fileset> - </jmln-test> - </target> - - <target name="execute.testcases.vm" depends="init.taskdefs" description="Executes a series of test cases"> - <delete dir="tst/_tmp"/> - <jmln-test-vm debug="true" classpathref="test.classpath" fork="true" separateVmPerScript="false" printFooter="true"> - <fileset dir="tst/xml/acceptance"> - <include name="*.xml"/> - </fileset> - </jmln-test-vm> - </target> - - <target name="package.release.src" description="creates a src release" depends="clean"> - <zip destfile="${ant.project.name}-${version}-src.zip"> - <zipfileset dir="." prefix="${ant.project.name}-${version}-src"> - <exclude name="build.sh"/> - <exclude name="build.bat"/> - <exclude name="lib/**"/> - <exclude name=".vslick/**"/> - </zipfileset> - - <zipfileset dir="." prefix="${ant.project.name}-${version}-src" filemode="755"> - <exclude name=".vslick/**"/> - <include name="build.sh"/> - <include name="build.bat"/> - <include name="lib/**"/> - </zipfileset> - </zip> - - </target> - - <target name="jar.launcher.files" - depends="init" - description="creates a jameleon launcher jar file." - if="jameleon.core"> - - <property name="ant.launcher.dir" value="${build.dir}/tmp"/> - <property name="launcher.file" value="${dist.dir}/jameleon-launcher.jar"/> - <delete file="${launcher.file}"/> - <mkdir dir="${ant.launcher.dir}"/> - <unjar src="${lib.dir}/ant/ant-launcher.jar" dest="${ant.launcher.dir}"/> - <manifest file="MANIFEST.MF"> - <section name="common"> - <attribute name="Specification-Title" value="Jameleon"/> - <attribute name="Specification-Version" value="0.1"/> - <attribute name="Implementation-Title" value="Jameleon Launcher"/> - <attribute name="Implementation-Version" value="0.1 ${TODAY}"/> - </section> - <attribute name="Main-Class" value="net.sf.jameleon.launch.JameleonLauncher"/> - </manifest> - <jar jarfile="${launcher.file}" - basedir="${build.dir}" - manifest="MANIFEST.MF" - includes="net/sf/jameleon/launch/*.class"/> - <jar jarfile="${launcher.file}" - update="true" - basedir="${ant.launcher.dir}" - includes="**/Locator*.class"/> - <delete file="MANIFEST.MF"/> - <delete dir="${ant.launcher.dir}"/> - <delete dir="${build.dir}/net/sf/jameleon/launch"/> - </target> - - <target name="package.release.bin" description="creates a bin release" depends="main"> - <zip destfile="${ant.project.name}-${version}-bin.zip"> - <zipfileset dir="lib" prefix="${ant.project.name}-${version}-bin" filemode="755"> - <include name="**"/> - <exclude name="ant/**"/> - </zipfileset> - <zipfileset dir="${dist.dir}" prefix="${ant.project.name}-${version}-bin" filemode="755"> - <include name="${ant.project.name}.jar"/> - </zipfileset> - </zip> - </target> - - <target name="cleanAll" depends="clean"/> - - <target name="prepare" depends=""/> - - <target name="all" depends="junit, acceptance"/> - - <target name="compile" depends="build, copyRes"/> - - <target name="main" depends="compile, jar.launcher.files, init.taskdefs, register.functions, jar, gen.syntax.reference"/> - - <target name="junit" depends="prepare.tst, test"/> - - <target name="prepare.tst" depends="main, build.tst, register.functions.tst"/> - - <target name="quick.test" depends="prepare.tst, test"/> -</project> \ No newline at end of file Modified: trunk/jameleon-core/xdocs/antTasks.xml =================================================================== --- trunk/jameleon-core/xdocs/antTasks.xml 2007-05-16 21:53:42 UTC (rev 1520) +++ trunk/jameleon-core/xdocs/antTasks.xml 2007-05-16 21:55:32 UTC (rev 1521) @@ -161,7 +161,7 @@ <subsection name="Syntax Reference Docs Generator"> <p> Once all of the tags are registered, you can generate a file that describes the details of each tag. - TODO: add examples. There is currently an example in the jameleon-core/src/xml/standard-build.xml.fragment file. + TODO: add examples. There is currently an example in the jameleon-core/src/xml/standard-build.xml file. </p> <p> The the following attributes are supported This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-16 23:05:30
|
Revision: 1533 http://svn.sourceforge.net/jameleon/?rev=1533&view=rev Author: engrean Date: 2007-05-16 16:05:29 -0700 (Wed, 16 May 2007) Log Message: ----------- Fixed bug# 1719937 - no cleanup after failed tag Modified Paths: -------------- trunk/jameleon-core/jameleon-core.iml trunk/jameleon-core/project.xml trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java Modified: trunk/jameleon-core/jameleon-core.iml =================================================================== --- trunk/jameleon-core/jameleon-core.iml 2007-05-16 22:00:30 UTC (rev 1532) +++ trunk/jameleon-core/jameleon-core.iml 2007-05-16 23:05:29 UTC (rev 1533) @@ -3,9 +3,192 @@ <component name="ModuleRootManager" /> <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> - <content url="file://$MODULE_DIR$" /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/tst/java" isTestSource="true" /> + </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/qdox-1.6.1.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-logging-1.1.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-jelly-1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/ant/ant-launcher.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/h2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/xercesImpl-2.6.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/velocity-dep-1.5.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/jaxen-1.1.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-beanutils-1.7.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-cli-1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/junit.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/jdic.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-collections-3.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-jexl-1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/log4j-1.2.14.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/commons-jelly-tags-beanshell-1.0-SNAPSHOT.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/ant/ant.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/xmlParserAPIs-2.6.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../../Java/jdk1.6.0_01/lib/tools.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> <orderEntryProperties /> </component> </module> Modified: trunk/jameleon-core/project.xml =================================================================== --- trunk/jameleon-core/project.xml 2007-05-16 22:00:30 UTC (rev 1532) +++ trunk/jameleon-core/project.xml 2007-05-16 23:05:29 UTC (rev 1533) @@ -103,6 +103,10 @@ <id>rhallier</id> <email>rha...@us...</email> </contributor> + <contributor> + <name>Buana</name> + <id>fatabey</id> + </contributor> </contributors> <dependencies> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java 2007-05-16 22:00:30 UTC (rev 1532) +++ trunk/jameleon-core/src/java/net/sf/jameleon/function/FunctionTag.java 2007-05-16 23:05:29 UTC (rev 1533) @@ -236,8 +236,9 @@ * Contains the actual testing of the function point. Implement this method with * any code that would make the FunctionTag unique. The default implementation does nothing. * Implement this method to make your function tag useful. + * @throws Exception when something goes wrong */ - public void testBlock() throws Exception{}; + public void testBlock() throws Exception{} /** * Simply calls <code>setupEnvironment()</code>, <code>validate()</code>, <code>setup()</code> and <code>testBlock(XMLOutput out)</code>. @@ -304,12 +305,12 @@ delay(); recordFunctionResult(startTime); eventHandler.endFunction(this, 1); - cleanUp(); } } }else{ removeFunctionResult(); } + cleanUp(); } /** @@ -438,6 +439,7 @@ /** * @return a variable with name <code>key</code> from the context as a String + * @param key The variable name */ protected String getVariableAsString(String key){ return ContextHelper.getVariableAsString(context, key); @@ -445,6 +447,7 @@ /** * @return a variable with name <code>key</code> from the context as a (primitive) boolean + * @param key The variable name */ protected boolean getVariableAsBoolean(String key) { return ContextHelper.getVariableAsBoolean(context, key); @@ -454,6 +457,7 @@ * Gets a variable from context and casts it to a list. If the value isn't a * List, then it creates a ArrayList and adds the value to it. * @return a variable with name <code>key</code> from the context as a List even if the value is null. + * @param key The variable name */ protected List getVariableAsList(String key){ return ContextHelper.getVariableAsList(context, key); @@ -610,24 +614,24 @@ * @return True if the regex matches or false if it doesn't */ public boolean regexMatches(String text, String regex) { - boolean matches = false; + boolean matches; if (regex == null) { throw new JameleonScriptException("regex! can not be null", this); } if (text == null) { throw new JameleonScriptException("text! can not be null", this); } - if (regex != null && text != null) { - Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(text); - matches = matcher.find(); - } + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(text); + matches = matcher.find(); return matches; } /** * Gets a String by its default value if an actual value isn't found. * @return a String by its default value if an actual value isn't found.. + * @param value - the value to return + * @param defaultValue - the value to return if the <code>value</code> parameter is null */ public String getStringOrDefault(String value, String defaultValue){ String returnValue = defaultValue; @@ -702,6 +706,7 @@ /** * Runs the run method of a Runnable and records the results appropriately. * @param r - The block of code you want executed ( defined in the run() method ). + * @param assertLevel - The assert level of when to run the method */ protected void assertMethodWithLevel(Runnable r, int assertLevel){ if (assertLevelManager.assertPerformable(assertLevel)) { @@ -845,7 +850,7 @@ * @param textContained - the text to be contained */ public void assertTextContains(final String text, final String textContained) { - String message = "assertTextContains: '"+textContained+"' not in given text";; + String message = "assertTextContains: '"+textContained+"' not in given text"; int assertLevel = AssertLevel.NO_LEVEL; assertTextContains(message, text, textContained, assertLevel); } @@ -868,7 +873,7 @@ * @param assertLevel - Only run this test under the assertLevel as described in {@link net.sf.jameleon.util.AssertLevel} */ public void assertTextContains(final String text, final String textContained, int assertLevel) { - String message = "assertTextContains: '"+textContained+"' not in given text";; + String message = "assertTextContains: '"+textContained+"' not in given text"; assertTextContains(message, text, textContained, assertLevel); } @@ -893,7 +898,7 @@ * @param startingText - the text that must be at the beginning. */ public void assertTextStartsWith(final String text, final String startingText) { - String message = "assertTextStartsWith: '"+startingText+"' is not at the beginning of the given text";; + String message = "assertTextStartsWith: '"+startingText+"' is not at the beginning of the given text"; int assertLevel = AssertLevel.NO_LEVEL; assertTextStartsWith(message, text, startingText, assertLevel); } @@ -916,7 +921,7 @@ * @param assertLevel - Only run this test under the assertLevel as described in {@link net.sf.jameleon.util.AssertLevel} */ public void assertTextStartsWith(final String text, final String startingText, int assertLevel) { - String message = "assertTextStartsWith: '"+startingText+"' is not at the beginning of the given text";; + String message = "assertTextStartsWith: '"+startingText+"' is not at the beginning of the given text"; assertTextStartsWith(message, text, startingText, assertLevel); } @@ -941,7 +946,7 @@ * @param endingText - the text that must be at the end. */ public void assertTextEndsWith(final String text, final String endingText) { - String message = "assertTextEndsWith: '"+endingText+"' is not at the end of the given text";; + String message = "assertTextEndsWith: '"+endingText+"' is not at the end of the given text"; int assertLevel = AssertLevel.NO_LEVEL; assertTextEndsWith(message, text, endingText, assertLevel); } @@ -964,7 +969,7 @@ * @param assertLevel - Only run this test under the assertLevel as described in {@link net.sf.jameleon.util.AssertLevel} */ public void assertTextEndsWith(final String text, final String endingText, int assertLevel) { - String message = "assertTextEndsWith: '"+endingText+"' is not at the end of the given text";; + String message = "assertTextEndsWith: '"+endingText+"' is not at the end of the given text"; assertTextEndsWith(message, text, endingText, assertLevel); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-18 13:15:22
|
Revision: 1537 http://svn.sourceforge.net/jameleon/?rev=1537&view=rev Author: engrean Date: 2007-05-18 06:15:20 -0700 (Fri, 18 May 2007) Log Message: ----------- Added features: 1721296 - Only record failed results to TestResults.xml 1721294 - Add ability to only report failed HTML results Modified Paths: -------------- trunk/jameleon-core/res/log4j.properties trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonXMLLayout.java Modified: trunk/jameleon-core/res/log4j.properties =================================================================== --- trunk/jameleon-core/res/log4j.properties 2007-05-18 02:14:57 UTC (rev 1536) +++ trunk/jameleon-core/res/log4j.properties 2007-05-18 13:15:20 UTC (rev 1537) @@ -12,6 +12,7 @@ log4j.appender.J1.File=TestResults.html log4j.appender.J1.layout=net.sf.jameleon.logging.JameleonHTMLLayout log4j.appender.J1.layout.Title=Jameleon Test Case Results +log4j.appender.J1.layout.logErrorsOnly=false log4j.appender.SLO=org.apache.log4j.ConsoleAppender log4j.appender.SLO.Threshold=INFO @@ -22,3 +23,4 @@ log4j.appender.J2.Encoding=UTF-8 log4j.appender.J2.File=TestResults.xml log4j.appender.J2.layout=net.sf.jameleon.logging.JameleonXMLLayout +log4j.appender.J2.layout.logErrorsOnly=true Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java 2007-05-18 02:14:57 UTC (rev 1536) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonHTMLLayout.java 2007-05-18 13:15:20 UTC (rev 1537) @@ -84,99 +84,99 @@ totalTestsRun += numRun; totalTestsFailed += numFailed; totalTestsPassed += (numRun - numFailed); + if (logResult(event)){ + String percentagePassed = TestCaseResult.getPercentagePassed(numRun, numFailed); - String percentagePassed = TestCaseResult.getPercentagePassed(numRun, numFailed); + String rowS; + String cellS; + String outcomeS; - String rowS = null; - String cellS = null; - String outcomeS = null; + if (result.passed()) { + rowS = ">"; + cellS = " class=\"pass\" title=\"Test Passed\">"; + outcomeS = "✓"; + } else { + rowS = " class=\"fail\">"; + cellS = " class=\"fail\" title=\"Test FAILED!\">"; + outcomeS = "✗"; + } - if (result.passed()) { - rowS = ">"; - cellS = " class=\"pass\" title=\"Test Passed\">"; - outcomeS = "✓"; - } else { - rowS = " class=\"fail\">"; - cellS = " class=\"fail\" title=\"Test FAILED!\">"; - outcomeS = "✗"; - } + String testCaseName = result.getTestName(); + String testCaseDoc = result.getTestCaseDocsFile(); + String executionTime = JameleonUtility.executionTimeToString(result.getExecutionTime()); - String testCaseName = result.getTestName(); - String testCaseDoc = result.getTestCaseDocsFile(); - String executionTime = JameleonUtility.executionTimeToString(result.getExecutionTime()); + sbuf.append(Layout.LINE_SEP); - sbuf.append(Layout.LINE_SEP); + sbuf.append("<tr").append(rowS); + sbuf.append(Layout.LINE_SEP); - sbuf.append("<tr").append(rowS); - sbuf.append(Layout.LINE_SEP); + sbuf.append("<td title=\"Test Case #\">"); + sbuf.append(testCaseNum++); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td title=\"Test Case #\">"); - sbuf.append(testCaseNum++); - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td").append(cellS); + sbuf.append(outcomeS); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td").append(cellS); - sbuf.append(outcomeS); - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td>"); + if (testCaseDoc != null && testCaseDoc.length() > 0) { + sbuf.append("<a href=\"").append(testCaseDoc).append("\" target=\"_new\">"); + } + sbuf.append(testCaseName); + if (testCaseDoc != null && testCaseDoc.length() > 0) { + sbuf.append("</a>"); + } + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td>"); - if (testCaseDoc != null && testCaseDoc.length() > 0) { - sbuf.append("<a href=\"").append(testCaseDoc).append("\" target=\"_new\">"); - } - sbuf.append(testCaseName); - if (testCaseDoc != null && testCaseDoc.length() > 0) { - sbuf.append("</a>"); - } - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td title=\"Total Execution Time\">"); + sbuf.append(executionTime); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td title=\"Total Execution Time\">"); - sbuf.append(executionTime); - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td title=\"# Iterations Run\" align=\"right\">"); + sbuf.append(numRun); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td title=\"# Iterations Run\" align=\"right\">"); - sbuf.append(numRun); - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td title=\"# Iterations Failed\" align=\"right\">"); + sbuf.append(numFailed); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td title=\"# Iterations Failed\" align=\"right\">"); - sbuf.append(numFailed); - sbuf.append("</td>" + Layout.LINE_SEP); + sbuf.append("<td title=\"% Tests Passed\" align=\"right\">"); + sbuf.append(percentagePassed); + sbuf.append("</td>" + Layout.LINE_SEP); - sbuf.append("<td title=\"% Tests Passed\" align=\"right\">"); - sbuf.append(percentagePassed); - sbuf.append("</td>" + Layout.LINE_SEP); - - sbuf.append("<td>"); - if (result.failed()) { - ErrorResult[] errors = getErrorResults(result); - sbuf.append("<table border=\"1\" width=\"100%\" id=\"").append(testCaseName).append("_failed\">"+Layout.LINE_SEP); - sbuf.append("<tr>"+Layout.LINE_SEP); - sbuf.append("<th>Row</th>"+Layout.LINE_SEP); - sbuf.append("<th>Line</th>"+Layout.LINE_SEP); - sbuf.append("<th>Point of Failure</th>"+Layout.LINE_SEP); - sbuf.append("<th>Reason</th>"+Layout.LINE_SEP); - sbuf.append("</tr>"+Layout.LINE_SEP); - for ( int i = 0; errors != null && i < errors.length; i++) { - sbuf.append("<tr class=\"fail\" id=\"line_").append(errors[i].lineNum).append("\">"+Layout.LINE_SEP); - sbuf.append("<td title=\"Row Failed\">").append(errors[i].rowNum).append("</td>"+Layout.LINE_SEP); - sbuf.append("<td title=\"Line Failed\">").append(errors[i].lineNum).append("</td>"+Layout.LINE_SEP); - sbuf.append("<td title=\"FunctionId of Point of Failure\"><i>").append(errors[i].functionId).append("</i></td>"+Layout.LINE_SEP); - sbuf.append("<td title=\"Error Message\">"+Layout.LINE_SEP); - if (errors[i].fileName == null || errors[i].fileName.equals("N/A") || errors[i].fileName.equalsIgnoreCase("null")) { - sbuf.append("<pre>").append(Transform.escapeTags(errors[i].errMsg)).append("</pre>"); - } else { - sbuf.append("<a target=\"_new\" href=\"").append(errors[i].fileName).append("\">"); - sbuf.append("<pre>").append(Transform.escapeTags(errors[i].errMsg)).append("</pre></a>"); + sbuf.append("<td>"); + if (result.failed()) { + ErrorResult[] errors = getErrorResults(result); + sbuf.append("<table border=\"1\" width=\"100%\" id=\"").append(testCaseName).append("_failed\">"+Layout.LINE_SEP); + sbuf.append("<tr>"+Layout.LINE_SEP); + sbuf.append("<th>Row</th>"+Layout.LINE_SEP); + sbuf.append("<th>Line</th>"+Layout.LINE_SEP); + sbuf.append("<th>Point of Failure</th>"+Layout.LINE_SEP); + sbuf.append("<th>Reason</th>"+Layout.LINE_SEP); + sbuf.append("</tr>"+Layout.LINE_SEP); + for ( int i = 0; errors != null && i < errors.length; i++) { + sbuf.append("<tr class=\"fail\" id=\"line_").append(errors[i].lineNum).append("\">"+Layout.LINE_SEP); + sbuf.append("<td title=\"Row Failed\">").append(errors[i].rowNum).append("</td>"+Layout.LINE_SEP); + sbuf.append("<td title=\"Line Failed\">").append(errors[i].lineNum).append("</td>"+Layout.LINE_SEP); + sbuf.append("<td title=\"FunctionId of Point of Failure\"><i>").append(errors[i].functionId).append("</i></td>"+Layout.LINE_SEP); + sbuf.append("<td title=\"Error Message\">"+Layout.LINE_SEP); + if (errors[i].fileName == null || errors[i].fileName.equals("N/A") || errors[i].fileName.equalsIgnoreCase("null")) { + sbuf.append("<pre>").append(Transform.escapeTags(errors[i].errMsg)).append("</pre>"); + } else { + sbuf.append("<a target=\"_new\" href=\"").append(errors[i].fileName).append("\">"); + sbuf.append("<pre>").append(Transform.escapeTags(errors[i].errMsg)).append("</pre></a>"); + } + sbuf.append("</td>"+Layout.LINE_SEP); + sbuf.append("</tr>"+Layout.LINE_SEP); } - sbuf.append("</td>"+Layout.LINE_SEP); - sbuf.append("</tr>"+Layout.LINE_SEP); + sbuf.append("</table>"+Layout.LINE_SEP); + } else { + sbuf.append(" "); } - sbuf.append("</table>"+Layout.LINE_SEP); - } else { - sbuf.append(" "); + sbuf.append("</td>" + Layout.LINE_SEP); + + sbuf.append("</tr>" + Layout.LINE_SEP); } - sbuf.append("</td>" + Layout.LINE_SEP); - - sbuf.append("</tr>" + Layout.LINE_SEP); - } return sbuf.toString(); } Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-05-18 02:14:57 UTC (rev 1536) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonLayout.java 2007-05-18 13:15:20 UTC (rev 1537) @@ -28,6 +28,7 @@ import net.sf.jameleon.util.JameleonUtility; import org.apache.log4j.Layout; +import org.apache.log4j.spi.LoggingEvent; public abstract class JameleonLayout extends Layout { @@ -39,7 +40,13 @@ protected long startTime = 0; // output buffer appended to when format() is invoked protected StringBuffer sbuf = new StringBuffer(BUF_SIZE); + private boolean logErrorsOnly; + public void setLogErrorsOnly(boolean logErrors){ + logErrorsOnly = logErrors; + } + + /** * No options to activate. */ @@ -106,6 +113,7 @@ /** * Returns the summary for the total tests run, passed and failed. + * @return the summary for the total tests run, passed and failed. */ public String getExecutionTime() { long stopTime = new Date().getTime(); @@ -113,6 +121,16 @@ return JameleonUtility.executionTimeToString(totalExecutionTime); } + public boolean logResult(LoggingEvent event){ + boolean isEventLoggable = true; + if (logErrorsOnly && event.getMessage() instanceof JameleonTestResult){ + JameleonTestResult result = (JameleonTestResult)event.getMessage(); + isEventLoggable = result.failed(); + } + return isEventLoggable; + } + + protected class ErrorResult { protected String errMsg; protected String fileName; Modified: trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonXMLLayout.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonXMLLayout.java 2007-05-18 02:14:57 UTC (rev 1536) +++ trunk/jameleon-core/src/java/net/sf/jameleon/logging/JameleonXMLLayout.java 2007-05-18 13:15:20 UTC (rev 1537) @@ -18,12 +18,11 @@ */ package net.sf.jameleon.logging; -import java.util.Calendar; - import net.sf.jameleon.XMLable; - import org.apache.log4j.spi.LoggingEvent; +import java.util.Calendar; + public class JameleonXMLLayout extends JameleonLayout { protected String getFormatedTimeStamp(long time) { @@ -49,37 +48,39 @@ * */ public String format(LoggingEvent event) { checkBuffer(); - sbuf.append("<log4j:event logger=\""); - sbuf.append(event.getLoggerName()); - sbuf.append("\" date=\""); - sbuf.append(getFormatedTimeStamp(event.timeStamp)); - sbuf.append("\" level=\""); - sbuf.append(event.getLevel()); - sbuf.append("\" thread=\""); - sbuf.append(event.getThreadName()); - sbuf.append("\">\r\n"); - sbuf.append("<log4j:message>"); - Object obj = event.getMessage(); - if (obj instanceof XMLable) { - sbuf.append(((XMLable)obj).toXML()); - }else{ - sbuf.append(event.getRenderedMessage()); - } - sbuf.append("</log4j:message>\r\n"); + if (logResult(event)){ + sbuf.append("<log4j:event logger=\""); + sbuf.append(event.getLoggerName()); + sbuf.append("\" date=\""); + sbuf.append(getFormatedTimeStamp(event.timeStamp)); + sbuf.append("\" level=\""); + sbuf.append(event.getLevel()); + sbuf.append("\" thread=\""); + sbuf.append(event.getThreadName()); + sbuf.append("\">\r\n"); + sbuf.append("<log4j:message>"); + Object obj = event.getMessage(); + if (obj instanceof XMLable) { + sbuf.append(((XMLable)obj).toXML()); + }else{ + sbuf.append(event.getRenderedMessage()); + } + sbuf.append("</log4j:message>\r\n"); - String[] s = event.getThrowableStrRep(); - if (s != null) { - sbuf.append("<log4j:throwable><![CDATA["); - for (int i = 0; i < s.length; i++) { - sbuf.append(s[i]); - sbuf.append("\r\n"); + String[] s = event.getThrowableStrRep(); + if (s != null) { + sbuf.append("<log4j:throwable><![CDATA["); + for (int i = 0; i < s.length; i++) { + sbuf.append(s[i]); + sbuf.append("\r\n"); + } + sbuf.append("]]></log4j:throwable>\r\n"); } - sbuf.append("]]></log4j:throwable>\r\n"); } - return sbuf.toString(); } + /** The XMLLayout prints and does not ignore exceptions. Hence the return value <code>false</code>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-19 15:33:45
|
Revision: 1539 http://svn.sourceforge.net/jameleon/?rev=1539&view=rev Author: engrean Date: 2007-05-19 08:32:58 -0700 (Sat, 19 May 2007) Log Message: ----------- Fixed Bug# 1721849 - Rename TestCaseDocsTransformer to TemplateProcesor Modified Paths: -------------- trunk/jameleon-core/jameleon-core.iml trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCasePane.java trunk/jameleon-core/src/java/net/sf/jameleon/util/GenSyntaxReference.java Added Paths: ----------- trunk/jameleon-core/src/java/net/sf/jameleon/util/TemplateProcessor.java Removed Paths: ------------- trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java Modified: trunk/jameleon-core/jameleon-core.iml =================================================================== --- trunk/jameleon-core/jameleon-core.iml 2007-05-19 15:29:02 UTC (rev 1538) +++ trunk/jameleon-core/jameleon-core.iml 2007-05-19 15:32:58 UTC (rev 1539) @@ -183,13 +183,16 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/../../Java/jdk1.6.0_01/lib/tools.jar!/" /> + <root url="jar://$MODULE_DIR$/tst/lib/mockobjects-core-0.09.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> <orderEntryProperties /> + <javadoc-paths> + <root url="http://java.sun.com/javase/6/docs/api/" /> + </javadoc-paths> </component> </module> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-05-19 15:29:02 UTC (rev 1538) +++ trunk/jameleon-core/src/java/net/sf/jameleon/TestCaseTag.java 2007-05-19 15:32:58 UTC (rev 1539) @@ -909,7 +909,7 @@ */ protected void generateResults(){ File htmlFile = getResultsFile(); - TestCaseDocsTransformer xfrmr = new TestCaseDocsTransformer(genTestCaseDocsTemplate); + TemplateProcessor processor = new TemplateProcessor(genTestCaseDocsTemplate); HashMap vars = new HashMap(); if (bugTrackerUrl != null) { vars.put("bugTrackerUrl", bugTrackerUrl ); @@ -921,7 +921,7 @@ vars.put("printFileName", Boolean.TRUE); vars.put("results_res_dir", RESULTS_RES_DIR); - xfrmr.transform(htmlFile, vars); + processor.transform(htmlFile, vars); } /** Modified: trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCasePane.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCasePane.java 2007-05-19 15:29:02 UTC (rev 1538) +++ trunk/jameleon-core/src/java/net/sf/jameleon/ui/TestCasePane.java 2007-05-19 15:32:58 UTC (rev 1539) @@ -49,7 +49,7 @@ import net.sf.jameleon.event.FunctionEventHandler; import net.sf.jameleon.event.TestCaseEventHandler; import net.sf.jameleon.util.Configurator; -import net.sf.jameleon.util.TestCaseDocsTransformer; +import net.sf.jameleon.util.TemplateProcessor; import org.apache.commons.jelly.JellyException; @@ -186,7 +186,7 @@ } public void setTestCaseInfo(TestCase tc) { - TestCaseDocsTransformer xfrmr = new TestCaseDocsTransformer("TestCaseDocsTemplate.txt"); + TemplateProcessor xfrmr = new TemplateProcessor("TestCaseDocsTemplate.txt"); HashMap vars = new HashMap(); vars.put("tc", tc); String bugUrl = Configurator.getInstance().getValue("bugTrackerUrl"); Modified: trunk/jameleon-core/src/java/net/sf/jameleon/util/GenSyntaxReference.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/GenSyntaxReference.java 2007-05-19 15:29:02 UTC (rev 1538) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/GenSyntaxReference.java 2007-05-19 15:32:58 UTC (rev 1539) @@ -58,7 +58,7 @@ Map params = new HashMap(); params.put("tags", tags); params.putAll(templateParams); - TestCaseDocsTransformer tcdf = new TestCaseDocsTransformer(templateName); + TemplateProcessor tcdf = new TemplateProcessor(templateName); tcdf.transform(toFile,params); } } Copied: trunk/jameleon-core/src/java/net/sf/jameleon/util/TemplateProcessor.java (from rev 1536, trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java) =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/TemplateProcessor.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/TemplateProcessor.java 2007-05-19 15:32:58 UTC (rev 1539) @@ -0,0 +1,78 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA +*/ +package net.sf.jameleon.util; + +import java.io.File; +import java.io.StringWriter; +import java.util.Iterator; +import java.util.Map; + +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; + +public class TemplateProcessor { + + protected Template template; + protected String templateName; + + public TemplateProcessor(String templateName){ + Velocity.setProperty("resource.loader", "classpath"); + Velocity.setProperty("classpath.resource.loader.class", "net.sf.jameleon.util.VelocityClasspathResourceLoader"); + Velocity.setProperty("velocimacro.library", "TestCaseDocs.vm"); + try{ + Velocity.init(); + }catch(Exception rnfe){ + rnfe.printStackTrace(); + } + this.templateName = templateName; + } + + public void transform(File toFile, Map params){ + String content = transformToString(params); + if (content != null) { + try{ + JameleonUtility.recordResultsToFile(toFile, content); + }catch(Exception e){ + e.printStackTrace(); + } + } + } + + public String transformToString(Map params){ + String transformedText = null; + try{ + VelocityContext context = new VelocityContext(); + Iterator it = params.keySet().iterator(); + String key = null; + while (it.hasNext()) { + key = (String)it.next(); + context.put(key, params.get(key)); + } + template = Velocity.getTemplate(templateName); + StringWriter sw = new StringWriter(); + template.merge( context, sw ); + transformedText = sw.getBuffer().toString(); + }catch(Exception e){ + e.printStackTrace(); + } + return transformedText; + } + +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/util/TemplateProcessor.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Deleted: trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java 2007-05-19 15:29:02 UTC (rev 1538) +++ trunk/jameleon-core/src/java/net/sf/jameleon/util/TestCaseDocsTransformer.java 2007-05-19 15:32:58 UTC (rev 1539) @@ -1,78 +0,0 @@ -/* - Jameleon - An automation testing tool.. - Copyright (C) 2003-2006 Christian W. Hargraves (en...@ho...) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA -*/ -package net.sf.jameleon.util; - -import java.io.File; -import java.io.StringWriter; -import java.util.Iterator; -import java.util.Map; - -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; - -public class TestCaseDocsTransformer{ - - protected Template template; - protected String templateName; - - public TestCaseDocsTransformer(String templateName){ - Velocity.setProperty("resource.loader", "classpath"); - Velocity.setProperty("classpath.resource.loader.class", "net.sf.jameleon.util.VelocityClasspathResourceLoader"); - Velocity.setProperty("velocimacro.library", "TestCaseDocs.vm"); - try{ - Velocity.init(); - }catch(Exception rnfe){ - rnfe.printStackTrace(); - } - this.templateName = templateName; - } - - public void transform(File toFile, Map params){ - String content = transformToString(params); - if (content != null) { - try{ - JameleonUtility.recordResultsToFile(toFile, content); - }catch(Exception e){ - e.printStackTrace(); - } - } - } - - public String transformToString(Map params){ - String transformedText = null; - try{ - VelocityContext context = new VelocityContext(); - Iterator it = params.keySet().iterator(); - String key = null; - while (it.hasNext()) { - key = (String)it.next(); - context.put(key, params.get(key)); - } - template = Velocity.getTemplate(templateName); - StringWriter sw = new StringWriter(); - template.merge( context, sw ); - transformedText = sw.getBuffer().toString(); - }catch(Exception e){ - e.printStackTrace(); - } - return transformedText; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-19 15:35:34
|
Revision: 1540 http://svn.sourceforge.net/jameleon/?rev=1540&view=rev Author: engrean Date: 2007-05-19 08:35:32 -0700 (Sat, 19 May 2007) Log Message: ----------- Code cleanup Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/event/DataDrivableEventHandler.java trunk/jameleon-core/src/java/net/sf/jameleon/event/FunctionEventHandler.java trunk/jameleon-core/src/java/net/sf/jameleon/event/TestCaseEventHandler.java trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteEventHandler.java trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteListener.java trunk/jameleon-core/tst/java/net/sf/jameleon/ExecuteTestCaseTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/util/StateStorerTest.java Added Paths: ----------- trunk/jameleon-core/src/java/net/sf/jameleon/reporting/ trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/ Modified: trunk/jameleon-core/src/java/net/sf/jameleon/event/DataDrivableEventHandler.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/DataDrivableEventHandler.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/DataDrivableEventHandler.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -29,11 +29,9 @@ public class DataDrivableEventHandler{ private static DataDrivableEventHandler eventHandler; - private List dataDrivableListeners; + private final List dataDrivableListeners = Collections.synchronizedList(new LinkedList()); - private DataDrivableEventHandler(){ - dataDrivableListeners = Collections.synchronizedList(new LinkedList()); - } + private DataDrivableEventHandler(){} public static DataDrivableEventHandler getInstance(){ if (eventHandler == null) { Modified: trunk/jameleon-core/src/java/net/sf/jameleon/event/FunctionEventHandler.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/FunctionEventHandler.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/FunctionEventHandler.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -28,11 +28,9 @@ public class FunctionEventHandler{ private static FunctionEventHandler eventHandler; - private List functionListeners; + private final List functionListeners = Collections.synchronizedList(new LinkedList());; - private FunctionEventHandler(){ - functionListeners = Collections.synchronizedList(new LinkedList()); - } + private FunctionEventHandler(){} public static FunctionEventHandler getInstance(){ if (eventHandler == null) { Modified: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestCaseEventHandler.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestCaseEventHandler.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestCaseEventHandler.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -28,11 +28,9 @@ public class TestCaseEventHandler{ private static TestCaseEventHandler eventHandler; - private List testCaseListeners; + private final List testCaseListeners = Collections.synchronizedList(new LinkedList()); - private TestCaseEventHandler(){ - testCaseListeners = Collections.synchronizedList(new LinkedList()); - } + private TestCaseEventHandler(){} public static TestCaseEventHandler getInstance(){ if (eventHandler == null) { Modified: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteEventHandler.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteEventHandler.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteEventHandler.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -28,11 +28,9 @@ public class TestSuiteEventHandler{ private static TestSuiteEventHandler eventHandler; - private List testSuiteListeners; + private final List testSuiteListeners = Collections.synchronizedList(new LinkedList());; - private TestSuiteEventHandler(){ - testSuiteListeners = Collections.synchronizedList(new LinkedList()); - } + private TestSuiteEventHandler(){} public static TestSuiteEventHandler getInstance(){ if (eventHandler == null) { Modified: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteListener.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteListener.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestSuiteListener.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -23,8 +23,8 @@ /** * A listener for TestSuite events. Currently only two events are tracked: * <ul> - * <li>beginTestSuite - gets called before any test cases are executed.</li> - * <li>endTestSuite - gets called after all test cases are executed.</li> + * <li>beginTestSuite - gets called before any test cases in the provided test suite are executed.</li> + * <li>endTestSuite - gets called after all test cases in the proced test suite are executed.</li> * </ul> */ public interface TestSuiteListener extends EventListener{ Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/ExecuteTestCaseTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/ExecuteTestCaseTest.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/ExecuteTestCaseTest.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -58,8 +58,8 @@ List listeners = TestCaseEventHandler.getInstance().getTestCaseListeners(); assertEquals("# of listeners before", 0, listeners.size()); - Configurator.getInstance().setValue(ExecuteTestCase.TEST_CASE_LISTENERS, TestTestCaseListener.class.getName() + - " "+TestTestCaseListener.class.getName()); + Configurator.getInstance().setValue(ExecuteTestCase.TEST_CASE_LISTENERS, TestTestCaseListener.class.getName() + + " "+ TestTestCaseListener.class.getName()); exec.registerEventListeners(); listeners = TestCaseEventHandler.getInstance().getTestCaseListeners(); @@ -87,8 +87,8 @@ } public void testDeregisterEventListeners(){ - Configurator.getInstance().setValue(ExecuteTestCase.TEST_CASE_LISTENERS, TestTestCaseListener.class.getName() + - " "+TestTestCaseListener.class.getName()); + Configurator.getInstance().setValue(ExecuteTestCase.TEST_CASE_LISTENERS, TestTestCaseListener.class.getName() + + " "+ TestTestCaseListener.class.getName()); exec.registerEventListeners(); assertEquals("# of listeners", 2, TestCaseEventHandler.getInstance().getTestCaseListeners().size()); TestCaseEventHandler.getInstance().addTestCaseListener(new TestTestCaseListener()); Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/util/StateStorerTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/util/StateStorerTest.java 2007-05-19 15:32:58 UTC (rev 1539) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/util/StateStorerTest.java 2007-05-19 15:35:32 UTC (rev 1540) @@ -36,7 +36,6 @@ public class StateStorerTest extends TestCase { private StateStorer ss; - private File storeDir; private TempText storable; public static void main(String args[]) { @@ -53,7 +52,7 @@ public void setUp() { ss = StateStorer.getInstance(); - storeDir = new File("tst"+File.separator+"_tmp"+File.separator+"StateStorerTest"); + File storeDir = new File("tst" + File.separator + "_tmp" + File.separator + "StateStorerTest"); ss.setStoreDir(storeDir); storable = new TempText(); ss.addStorable(storable); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-19 15:51:06
|
Revision: 1541 http://svn.sourceforge.net/jameleon/?rev=1541&view=rev Author: engrean Date: 2007-05-19 08:50:56 -0700 (Sat, 19 May 2007) Log Message: ----------- Feature #1643860 - TimeStamped results & beginning of log4j generated TestResults.html removal. Added Paths: ----------- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEvent.java trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEventHandler.java trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunListener.java trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventHandlerTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventTest.java trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java Removed Paths: ------------- trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestTestCaseListener.java Added: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEvent.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEvent.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEvent.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,28 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.event; + +import java.util.EventObject; + +public class TestRunEvent extends EventObject { + + public TestRunEvent(Object source){ + super(source); + } +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEventHandler.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEventHandler.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEventHandler.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,81 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA +*/ +package net.sf.jameleon.event; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +public class TestRunEventHandler{ + + private static TestRunEventHandler eventHandler; + + private final List testRunListeners = Collections.synchronizedList(new LinkedList()); + + private TestRunEventHandler(){} + + public static TestRunEventHandler getInstance(){ + if (eventHandler == null) { + eventHandler = new TestRunEventHandler(); + } + return eventHandler; + } + + public void clearInstance(){ + eventHandler = null; + } + + public void addTestRunListener(TestRunListener trl){ + testRunListeners.add(trl); + } + + public List getTestRunListeners(){ + return testRunListeners; + } + + public void removeTestRunListener(TestRunListener trl){ + testRunListeners.remove(trl); + } + + public void beginTestRun(){ + TestRunEvent tre = new TestRunEvent("Begin Test Run"); + synchronized(testRunListeners){ + Iterator it = testRunListeners.iterator(); + TestRunListener trl; + while (it.hasNext()) { + trl = (TestRunListener)it.next(); + trl.beginTestRun(tre); + } + } + } + + public void endTestRun(){ + TestRunEvent tre = new TestRunEvent("End Test Run"); + synchronized(testRunListeners){ + Iterator it = testRunListeners.iterator(); + TestRunListener tsl; + while (it.hasNext()) { + tsl = (TestRunListener)it.next(); + tsl.endTestRun(tre); + } + } + } + +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunEventHandler.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunListener.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunListener.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunListener.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,47 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.event; + + +import java.util.EventListener; + +/** + * A listener for Test Run events. A Test Run is the action of running one or tests + * through the GUI or the command line. + * + * Currently the following two events are tracked: + * <ul> + * <li>beginTestRun - gets called before any tests are run.</li> + * <li>endTestRun - gets called after all tests are executed.</li> + * </ul> + */ +public interface TestRunListener extends EventListener{ + /** + * Gets called before the execution of a test run + * @param event - a TestRunEvent Object + */ + public void beginTestRun(TestRunEvent event); + + /** + * Gets called after the execution of a test suite + * @param event - a TestRunEvent Object + */ + public void endTestRun(TestRunEvent event); + +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/event/TestRunListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java (rev 0) +++ trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,52 @@ +package net.sf.jameleon.reporting; + +import net.sf.jameleon.event.TestCaseEvent; +import net.sf.jameleon.event.TestCaseListener; +import net.sf.jameleon.exception.JameleonException; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +/** + * Writes the HTML results out to a file. This class writes both the main results + * as well as the individual testcase docs. + */ +public class HtmlResultsReporter implements TestCaseListener { + private Writer writer; + private SimpleDateFormat format = new SimpleDateFormat("yyyy-MMMMM-dd__hh-mm-ssaaa"); + private boolean headerOuputted; + + public void setWriter(Writer writer) { + this.writer = writer; + } + + public Writer getWriter() { + return writer; + } + + public File getResultsDir(File baseDir, Calendar c) { + String path = baseDir.getPath()+File.separator + format.format(c.getTime()); + return new File(path); + } + + protected void outputHeader(File baseDir, Calendar c) throws JameleonException { + if(!headerOuputted){ + try { + writer.write("<html>"); + headerOuputted = true; + } catch (IOException e) { + throw new JameleonException("Could not write results to main HTML results file: "+e.getMessage()); + } + } + } + + public void beginTestCase(TestCaseEvent event) { + } + + public void endTestCase(TestCaseEvent event) { + //To change body of implemented methods use File | Settings | File Templates. + } +} Property changes on: trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventHandlerTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventHandlerTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventHandlerTest.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,91 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA +*/ +package net.sf.jameleon.event; + +import com.mockobjects.dynamic.AnyConstraintMatcher; +import com.mockobjects.dynamic.Mock; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class TestRunEventHandlerTest extends TestCase { + + private TestRunEventHandler eventHandler; + + public static void main(String args[]) { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() { + return new TestSuite( TestRunEventHandlerTest.class ); + } + + public TestRunEventHandlerTest( String name ) { + super( name ); + } + + public void setUp() { + eventHandler = TestRunEventHandler.getInstance(); + } + + public void tearDown(){ + eventHandler.clearInstance(); + } + + public void testGetInstance(){ + TestRunEventHandler eventHandler2 = TestRunEventHandler.getInstance(); + assertTrue("There should only be a single instance", eventHandler == eventHandler2); + } + + public void testAddTestRunListener(){ + assertEquals("# of test case listeners before add.", 0, eventHandler.getTestRunListeners().size()); + Mock mockListener = new Mock(TestRunListener.class); + eventHandler.addTestRunListener((TestRunListener)mockListener.proxy()); + assertEquals("# of test case listeners after add.", 1, eventHandler.getTestRunListeners().size()); + } + + public void testRemoveTestRunListener(){ + Mock mockListener = new Mock(TestRunListener.class); + TestRunListener tsl = (TestRunListener)mockListener.proxy(); + eventHandler.addTestRunListener(tsl); + assertEquals("# of test case listeners after add.", 1, eventHandler.getTestRunListeners().size()); + eventHandler.removeTestRunListener(tsl); + assertEquals("# of test case listeners after remove.", 0, eventHandler.getTestRunListeners().size()); + } + + public void testBeginTestRun(){ + Mock mockListener = new Mock(TestRunListener.class); + mockListener.expect("beginTestRun", new AnyConstraintMatcher()); + TestRunListener trl = (TestRunListener)mockListener.proxy(); + eventHandler.addTestRunListener(trl); + eventHandler.beginTestRun(); + mockListener.verify(); + } + + + public void testEndTestRun(){ + Mock mockListener = new Mock(TestRunListener.class); + mockListener.expect("endTestRun", new AnyConstraintMatcher()); + TestRunListener trl = (TestRunListener)mockListener.proxy(); + eventHandler.addTestRunListener(trl); + eventHandler.endTestRun(); + mockListener.verify(); + } + +} Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventHandlerTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventTest.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,55 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2006 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA +*/ +package net.sf.jameleon.event; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class TestRunEventTest extends TestCase{ + + private TestRunEvent tre; + + public static void main(String args[]) { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() { + return new TestSuite( TestRunEventTest.class ); + } + + public TestRunEventTest( String name ) { + super( name ); + } + + public void setUp() { + tre = new TestRunEvent("Hello"); + } + + public void tearDown(){ + tre = null; + } + + public void testConstructor(){ + assertNotNull("TestSuiteEvent was null", tre); + String source = (String) tre.getSource(); + assertEquals("TestSuiteEvent source", "Hello", source); + } + +} Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestRunEventTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Deleted: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestTestCaseListener.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestTestCaseListener.java 2007-05-19 15:35:32 UTC (rev 1540) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestTestCaseListener.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -1,48 +0,0 @@ -/* - Jameleon - An automation testing tool.. - Copyright (C) 2005 Christian W. Hargraves (en...@ho...) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA -*/ -package net.sf.jameleon.event; - -public class TestTestCaseListener implements TestCaseListener { - - public boolean beginTestCaseCalled, endTestCaseCalled; - public TestCaseEvent beginTestCaseEvent, endTestCaseEvent; - public int numBeginTestCaseCalled, numEndTestCaseCalled; - - public void beginTestCase(TestCaseEvent event) { - beginTestCaseCalled = true; - beginTestCaseEvent = event; - numBeginTestCaseCalled++; - } - - public void endTestCase(TestCaseEvent event) { - endTestCaseCalled = true; - endTestCaseEvent = event; - numEndTestCaseCalled++; - } - - public void reset(){ - beginTestCaseCalled = false; - beginTestCaseEvent = null; - endTestCaseCalled = false; - endTestCaseEvent = null; - numBeginTestCaseCalled = 0; - numEndTestCaseCalled = 0; - } -} - Added: trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java 2007-05-19 15:50:56 UTC (rev 1541) @@ -0,0 +1,94 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package net.sf.jameleon.reporting; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import net.sf.jameleon.util.JameleonUtility; + +import java.io.File; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Calendar; + +public class HtmlResultsReporterTest extends TestCase { + + private HtmlResultsReporter reporter; + private static final File BASE_DIR = new File("jameleon_test_results"); + + public static void main(String args[]) { + junit.textui.TestRunner.run(suite()); + } + + public static Test suite() { + return new TestSuite(HtmlResultsReporterTest.class); + } + + public HtmlResultsReporterTest(String name) { + super(name); + } + + public void setUp(){ + reporter = new HtmlResultsReporter(); + reporter.setWriter(new StringWriter()); + } + + public void testGetResultsDirectory(){ + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 2007); + c.set(Calendar.MONTH, Calendar.MAY); + c.set(Calendar.DAY_OF_MONTH, 18); + c.set(Calendar.HOUR_OF_DAY, 10); + c.set(Calendar.MINUTE, 23); + c.set(Calendar.SECOND, 32); + File f = reporter.getResultsDir(BASE_DIR, c); + assertEquals("resultsDir", JameleonUtility.fixFileSeparators( + "jameleon_test_results/2007-May-18__10-23-32AM"), f.getPath()); + } + + public void testGettersSetters(){ + reporter = new HtmlResultsReporter(); + Writer writer = new StringWriter(); + reporter.setWriter(writer); + assertTrue("writer", writer == reporter.getWriter()); + } + + public void testOutputHeader() throws Exception{ + reporter.outputHeader(BASE_DIR, Calendar.getInstance()); + StringWriter writer = (StringWriter)reporter.getWriter(); + String header = writer.toString(); + assertTrue("The writer was populated with something", header.length() > 0); + assertTrue("The file should contain an html tag", header.indexOf("<html>") >= 0); + reporter.setWriter(new StringWriter()); + reporter.outputHeader(BASE_DIR, Calendar.getInstance()); + header = reporter.getWriter().toString(); + assertEquals("The # of chars in writer after another call", 0, header.length()); + + } + +// public void testBeginTestCase1stTime(){ +// TestCaseTag tct = new TestCaseTag(); +// tct.setName("htmlResultsTCName"); +// +// reporter.beginTestCase(new TestCaseEvent(tct)); +// StringWriter writer = (StringWriter)reporter.getWriter(); +// } + +} Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-19 16:38:28
|
Revision: 1544 http://svn.sourceforge.net/jameleon/?rev=1544&view=rev Author: engrean Date: 2007-05-19 09:38:18 -0700 (Sat, 19 May 2007) Log Message: ----------- added contributor Modified Paths: -------------- trunk/jameleon-core/project.xml Property Changed: ---------------- trunk/jameleon-core/ Property changes on: trunk/jameleon-core ___________________________________________________________________ Name: svn:ignore - .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders velocity.log.1 target + .settings .classpath .project Build Dist TestResults.html TestResults.xml jameleon_test_results jameleon.conf .externalToolBuilders velocity.log.1 target velocity.log Modified: trunk/jameleon-core/project.xml =================================================================== --- trunk/jameleon-core/project.xml 2007-05-19 16:03:55 UTC (rev 1543) +++ trunk/jameleon-core/project.xml 2007-05-19 16:38:18 UTC (rev 1544) @@ -104,7 +104,7 @@ <email>rha...@us...</email> </contributor> <contributor> - <name>Buana</name> + <name>Fuat Atabey</name> <id>fatabey</id> </contributor> </contributors> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-29 04:06:27
|
Revision: 1551 http://svn.sourceforge.net/jameleon/?rev=1551&view=rev Author: engrean Date: 2007-05-28 21:06:26 -0700 (Mon, 28 May 2007) Log Message: ----------- added initial header template for the test results summary Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java Added Paths: ----------- trunk/jameleon-core/res/TestResultsHeader.txt trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestCaseListenerTest.java Added: trunk/jameleon-core/res/TestResultsHeader.txt =================================================================== --- trunk/jameleon-core/res/TestResultsHeader.txt (rev 0) +++ trunk/jameleon-core/res/TestResultsHeader.txt 2007-05-29 04:06:26 UTC (rev 1551) @@ -0,0 +1,39 @@ +<html> +<head> +<meta http-equiv='content-type' content='text/html; charset=UTF-8'/> +<title>Jameleon Test Case Results</title> +<style type="text/css"> +<!-- +body, table { font-family: arial,sans-serif; font-size: x-small;} +a:link {color #e41819;} +a:visited {color #e41819;} +th {background: #0b3b63; color: #FFFFFF; text-align: left; font-size: small;} +tr {background: #FFFFFF; color: #000; font-size: small;} +td {text-align: left;} +tr.fail {background: #d6d6d6;} +td.pass {color: #1cc32b; font-size: 1.6em; font-family: tahoma,geneva,helvetica,arial,sans-serif;} +td.fail {color: #e41819; font-size: large; font-weight: bold; font-family: tahoma,geneva,helvetica,arial,sans-serif;} +--> +</style> +</head> +<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6"> +<hr size="1" noshade="true"/> +Start time: ${startTime}<br/> +#if ($organization) +Organization: ${organization}<br/> +#end +#if ($environment)Environment: $!{environment}<br/> +#end +<br/> +<table cellspacing="1" cellpadding="0" border="1" bordercolor="#224466" width="100%"> +<tr> +<th width="2%"></th> +<th width="1%"></th> + +<th width="25%">Test Case Name</th> +<th width="4%">Time</th> +<th width="2%">Run</th> +<th width="2%">Fail</th> +<th width="3%">Pass</th> +<th>Failures</th> +</tr> \ No newline at end of file Property changes on: trunk/jameleon-core/res/TestResultsHeader.txt ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java 2007-05-29 03:51:51 UTC (rev 1550) +++ trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java 2007-05-29 04:06:26 UTC (rev 1551) @@ -3,12 +3,16 @@ import net.sf.jameleon.event.TestCaseEvent; import net.sf.jameleon.event.TestCaseListener; import net.sf.jameleon.exception.JameleonException; +import net.sf.jameleon.util.TemplateProcessor; +import net.sf.jameleon.util.Configurator; import java.io.File; import java.io.IOException; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; /** * Writes the HTML results out to a file. This class writes both the main results @@ -16,8 +20,9 @@ */ public class HtmlResultsReporter implements TestCaseListener { private Writer writer; - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MMMMM-dd__hh-mm-ssaaa"); - private boolean headerOuputted; + private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MMMMM-dd__hh-mm-ssaaa"); + public static final String DEFAULT_HEADER_TEMPLATE = "TestResultsHeader.txt"; + private String testResultsHeaderTemplate = DEFAULT_HEADER_TEMPLATE; public void setWriter(Writer writer) { this.writer = writer; @@ -27,26 +32,59 @@ return writer; } - public File getResultsDir(File baseDir, Calendar c) { + public static File getResultsDir(File baseDir, Calendar c) { String path = baseDir.getPath()+File.separator + format.format(c.getTime()); return new File(path); } - protected void outputHeader(File baseDir, Calendar c) throws JameleonException { - if(!headerOuputted){ - try { - writer.write("<html>"); - headerOuputted = true; - } catch (IOException e) { - throw new JameleonException("Could not write results to main HTML results file: "+e.getMessage()); - } + + /** + * Output the header to the writer + * @param c the time to record in the header of the file + * @throws JameleonException when the results could not be written to + */ + protected void outputHeader(Calendar c) throws JameleonException { + try { + TemplateProcessor processor = new TemplateProcessor(testResultsHeaderTemplate); + Configurator config = Configurator.getInstance(); + Map params = new HashMap(); + params.put("organization", config.getValue("organization")); + params.put("environment", config.getValue("testEnvironment")); + params.put("startTime", c.getTime()); + + writer.write(processor.transformToString(params)); + } catch (IOException e) { + throw new JameleonException("Could not write results to main HTML results file: "+e.getMessage()); } } - - public void beginTestCase(TestCaseEvent event) { + + /** + * Gets the template for the overall results header file + * @return the template for the overall results header file + */ + public String getTestResultsHeaderTemplate() { + return testResultsHeaderTemplate; } + /** + * Sets the template for the overall results header file + * @param testResultsHeaderTemplate the template to use for the header of the overall results + */ + public void setTestResultsHeaderTemplate(String testResultsHeaderTemplate) { + this.testResultsHeaderTemplate = testResultsHeaderTemplate; + } + + /** + * Currently does nothing. + * @param event - The test case event that spawned this + */ + public void beginTestCase(TestCaseEvent event) {} + + /** + * Records the test case results + * @param event - The test case event that spawned this + */ public void endTestCase(TestCaseEvent event) { - //To change body of implemented methods use File | Settings | File Templates. + } } Copied: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestCaseListenerTest.java (from rev 1536, trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestTestCaseListener.java) =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestCaseListenerTest.java (rev 0) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestCaseListenerTest.java 2007-05-29 04:06:26 UTC (rev 1551) @@ -0,0 +1,48 @@ +/* + Jameleon - An automation testing tool.. + Copyright (C) 2005 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA +*/ +package net.sf.jameleon.event; + +public class TestTestCaseListener implements TestCaseListener { + + public boolean beginTestCaseCalled, endTestCaseCalled; + public TestCaseEvent beginTestCaseEvent, endTestCaseEvent; + public int numBeginTestCaseCalled, numEndTestCaseCalled; + + public void beginTestCase(TestCaseEvent event) { + beginTestCaseCalled = true; + beginTestCaseEvent = event; + numBeginTestCaseCalled++; + } + + public void endTestCase(TestCaseEvent event) { + endTestCaseCalled = true; + endTestCaseEvent = event; + numEndTestCaseCalled++; + } + + public void reset(){ + beginTestCaseCalled = false; + beginTestCaseEvent = null; + endTestCaseCalled = false; + endTestCaseEvent = null; + numBeginTestCaseCalled = 0; + numEndTestCaseCalled = 0; + } +} + Property changes on: trunk/jameleon-core/tst/java/net/sf/jameleon/event/TestCaseListenerTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java 2007-05-29 03:51:51 UTC (rev 1550) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java 2007-05-29 04:06:26 UTC (rev 1551) @@ -22,6 +22,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import net.sf.jameleon.util.JameleonUtility; +import net.sf.jameleon.util.Configurator; import java.io.File; import java.io.StringWriter; @@ -58,7 +59,7 @@ c.set(Calendar.HOUR_OF_DAY, 10); c.set(Calendar.MINUTE, 23); c.set(Calendar.SECOND, 32); - File f = reporter.getResultsDir(BASE_DIR, c); + File f = HtmlResultsReporter.getResultsDir(BASE_DIR, c); assertEquals("resultsDir", JameleonUtility.fixFileSeparators( "jameleon_test_results/2007-May-18__10-23-32AM"), f.getPath()); } @@ -68,27 +69,19 @@ Writer writer = new StringWriter(); reporter.setWriter(writer); assertTrue("writer", writer == reporter.getWriter()); + assertEquals("Default results header", HtmlResultsReporter.DEFAULT_HEADER_TEMPLATE, reporter.getTestResultsHeaderTemplate()); } public void testOutputHeader() throws Exception{ - reporter.outputHeader(BASE_DIR, Calendar.getInstance()); + Configurator config = Configurator.getInstance(); + config.setValue("organization", "sf"); + config.setValue("environment", "foo"); + reporter.outputHeader(Calendar.getInstance()); StringWriter writer = (StringWriter)reporter.getWriter(); String header = writer.toString(); assertTrue("The writer was populated with something", header.length() > 0); - assertTrue("The file should contain an html tag", header.indexOf("<html>") >= 0); - reporter.setWriter(new StringWriter()); - reporter.outputHeader(BASE_DIR, Calendar.getInstance()); - header = reporter.getWriter().toString(); - assertEquals("The # of chars in writer after another call", 0, header.length()); - + assertTrue("The writer should contain an org", header.indexOf("Jameleon Test Case Results") >= 0); + assertTrue("The file should contain an html tag", header.indexOf("Jameleon Test Case Results") >= 0); } -// public void testBeginTestCase1stTime(){ -// TestCaseTag tct = new TestCaseTag(); -// tct.setName("htmlResultsTCName"); -// -// reporter.beginTestCase(new TestCaseEvent(tct)); -// StringWriter writer = (StringWriter)reporter.getWriter(); -// } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-29 12:03:33
|
Revision: 1553 http://svn.sourceforge.net/jameleon/?rev=1553&view=rev Author: engrean Date: 2007-05-29 05:03:32 -0700 (Tue, 29 May 2007) Log Message: ----------- The footer is now also included. Modified Paths: -------------- trunk/jameleon-core/res/TestResultsHeader.txt trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java Added Paths: ----------- trunk/jameleon-core/res/TestResultsFooter.txt Added: trunk/jameleon-core/res/TestResultsFooter.txt =================================================================== --- trunk/jameleon-core/res/TestResultsFooter.txt (rev 0) +++ trunk/jameleon-core/res/TestResultsFooter.txt 2007-05-29 12:03:32 UTC (rev 1553) @@ -0,0 +1,21 @@ +</table> +<hr/> +<table cellspacing="1" cellpadding="0" border="1" bordercolor="#224466" width="100%"> +<tr> +<th>Total Execution Time</th> +<th>Total Tests Executed</th> +<th>Total Tests Passed</th> +<th>Total Tests Failed</th> +<th>% Passed</th> +</tr> +<tr> +<td id="totalTime">$totalTime</td> +#set ($totalRun = $totalPassed + $totalFailed) +<td id="totalRun">$totalRun</td> +<td id="totalPassed">$totalPassed</td> +<td id="totalFailed">$totalFailed</td> +<td id="percentPassed">$percentPassed</td> +</tr> +</table> +<br/> +</body></html> \ No newline at end of file Property changes on: trunk/jameleon-core/res/TestResultsFooter.txt ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/jameleon-core/res/TestResultsHeader.txt =================================================================== --- trunk/jameleon-core/res/TestResultsHeader.txt 2007-05-29 10:29:10 UTC (rev 1552) +++ trunk/jameleon-core/res/TestResultsHeader.txt 2007-05-29 12:03:32 UTC (rev 1553) @@ -22,7 +22,8 @@ #if ($organization) Organization: ${organization}<br/> #end -#if ($environment)Environment: $!{environment}<br/> +#if ($environment) +Environment: ${environment}<br/> #end <br/> <table cellspacing="1" cellpadding="0" border="1" bordercolor="#224466" width="100%"> Modified: trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java 2007-05-29 10:29:10 UTC (rev 1552) +++ trunk/jameleon-core/src/java/net/sf/jameleon/reporting/HtmlResultsReporter.java 2007-05-29 12:03:32 UTC (rev 1553) @@ -1,10 +1,10 @@ package net.sf.jameleon.reporting; -import net.sf.jameleon.event.TestCaseEvent; -import net.sf.jameleon.event.TestCaseListener; import net.sf.jameleon.exception.JameleonException; +import net.sf.jameleon.util.Configurator; import net.sf.jameleon.util.TemplateProcessor; -import net.sf.jameleon.util.Configurator; +import net.sf.jameleon.util.JameleonUtility; +import net.sf.jameleon.result.TestCaseResult; import java.io.File; import java.io.IOException; @@ -18,11 +18,16 @@ * Writes the HTML results out to a file. This class writes both the main results * as well as the individual testcase docs. */ -public class HtmlResultsReporter implements TestCaseListener { +public class HtmlResultsReporter { private Writer writer; private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MMMMM-dd__hh-mm-ssaaa"); public static final String DEFAULT_HEADER_TEMPLATE = "TestResultsHeader.txt"; + public static final String DEFAULT_FOOTER_TEMPLATE = "TestResultsFooter.txt"; private String testResultsHeaderTemplate = DEFAULT_HEADER_TEMPLATE; + private String testResultsFooterTemplate = DEFAULT_FOOTER_TEMPLATE; + private int numPassed; + private int numFailed; + private Calendar startTime; public void setWriter(Writer writer) { this.writer = writer; @@ -40,17 +45,17 @@ /** * Output the header to the writer - * @param c the time to record in the header of the file + * @param startTime the time to record in the header of the file * @throws JameleonException when the results could not be written to */ - protected void outputHeader(Calendar c) throws JameleonException { + protected void outputHeader(Calendar startTime) throws JameleonException { try { TemplateProcessor processor = new TemplateProcessor(testResultsHeaderTemplate); Configurator config = Configurator.getInstance(); Map params = new HashMap(); params.put("organization", config.getValue("organization")); params.put("environment", config.getValue("testEnvironment")); - params.put("startTime", c.getTime()); + params.put("startTime", startTime.getTime()); writer.write(processor.transformToString(params)); } catch (IOException e) { @@ -59,6 +64,29 @@ } /** + * Output the footer to the writer + * @param endTime the time to record in the header of the file + * @throws JameleonException when the results could not be written to + */ + protected void outputFooter(Calendar endTime) throws JameleonException { + try { + TemplateProcessor processor = new TemplateProcessor(testResultsFooterTemplate); + Map params = new HashMap(); + params.put("totalPassed", new Integer(numPassed)); + params.put("totalFailed", new Integer(numFailed)); + params.put("totalTime", JameleonUtility.executionTimeToString(endTime.getTimeInMillis() - + startTime.getTimeInMillis())); + + String percentagePassed = TestCaseResult.getPercentagePassed(numPassed + numFailed, numFailed); + params.put("percentPassed", percentagePassed); + + writer.write(processor.transformToString(params)); + } catch (IOException e) { + throw new JameleonException("Could not write results to main HTML results file: "+e.getMessage()); + } + } + + /** * Gets the template for the overall results header file * @return the template for the overall results header file */ @@ -74,17 +102,32 @@ this.testResultsHeaderTemplate = testResultsHeaderTemplate; } - /** - * Currently does nothing. - * @param event - The test case event that spawned this - */ - public void beginTestCase(TestCaseEvent event) {} - /** - * Records the test case results - * @param event - The test case event that spawned this - */ - public void endTestCase(TestCaseEvent event) { + public String getTestResultsFooterTemplate() { + return testResultsFooterTemplate; + } + public void setTestResultsFooterTemplate(String testResultsFooterTemplate) { + this.testResultsFooterTemplate = testResultsFooterTemplate; } + + public void incrementPassed(int numPassed) { + this.numPassed += numPassed; + } + + public int getNumPassed() { + return numPassed; + } + + public void incrementFailed(int numFailed) { + this.numFailed += numFailed; + } + + public int getNumFailed() { + return numFailed; + } + + public void setStartTime(Calendar startTime) { + this.startTime = startTime; + } } Modified: trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java =================================================================== --- trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java 2007-05-29 10:29:10 UTC (rev 1552) +++ trunk/jameleon-core/tst/java/net/sf/jameleon/reporting/HtmlResultsReporterTest.java 2007-05-29 12:03:32 UTC (rev 1553) @@ -21,8 +21,8 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import net.sf.jameleon.util.Configurator; import net.sf.jameleon.util.JameleonUtility; -import net.sf.jameleon.util.Configurator; import java.io.File; import java.io.StringWriter; @@ -51,6 +51,12 @@ reporter.setWriter(new StringWriter()); } + public void tearDown() throws Exception { + if (reporter.getWriter() != null) { + reporter.getWriter().close(); + } + } + public void testGetResultsDirectory(){ Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 2007); @@ -70,18 +76,55 @@ reporter.setWriter(writer); assertTrue("writer", writer == reporter.getWriter()); assertEquals("Default results header", HtmlResultsReporter.DEFAULT_HEADER_TEMPLATE, reporter.getTestResultsHeaderTemplate()); + reporter.setTestResultsHeaderTemplate("foo"); + assertEquals("results header", "foo", reporter.getTestResultsHeaderTemplate()); + assertEquals("Default results footer", HtmlResultsReporter.DEFAULT_FOOTER_TEMPLATE, reporter.getTestResultsFooterTemplate()); + reporter.setTestResultsFooterTemplate("foo"); + assertEquals("results footer", "foo", reporter.getTestResultsFooterTemplate()); } + public void testIncrementPassed(){ + assertEquals("initial # passed", 0, reporter.getNumPassed()); + reporter.incrementPassed(5); + assertEquals("# passed", 5, reporter.getNumPassed()); + } + + public void testIncrementFailed(){ + assertEquals("initial # failed", 0, reporter.getNumFailed()); + reporter.incrementFailed(5); + assertEquals("# failed", 5, reporter.getNumFailed()); + } + public void testOutputHeader() throws Exception{ Configurator config = Configurator.getInstance(); config.setValue("organization", "sf"); - config.setValue("environment", "foo"); - reporter.outputHeader(Calendar.getInstance()); + config.setValue("testEnvironment", "foo"); + Calendar startTime = Calendar.getInstance(); + reporter.outputHeader(startTime); StringWriter writer = (StringWriter)reporter.getWriter(); String header = writer.toString(); assertTrue("The writer was populated with something", header.length() > 0); - assertTrue("The writer should contain an org", header.indexOf("Jameleon Test Case Results") >= 0); - assertTrue("The file should contain an html tag", header.indexOf("Jameleon Test Case Results") >= 0); + assertTrue("The writer should contain an org", header.indexOf("Start time: "+startTime.getTime()+"<br/>") > 0); + assertTrue("The file should contain an organization", header.indexOf("Organization: sf<br/>") >= 0); + assertTrue("The file should contain an environment", header.indexOf("Environment: foo<br/>") >= 0); } + public void testOutputFooter() throws Exception{ + reporter.incrementPassed(12); + reporter.incrementFailed(12); + Calendar startTime = Calendar.getInstance(); + Calendar endTime = Calendar.getInstance(); + endTime.set(Calendar.SECOND, startTime.get(Calendar.SECOND) + 3); + reporter.setStartTime(startTime); + reporter.outputFooter(endTime); + StringWriter writer = (StringWriter)reporter.getWriter(); + String results = writer.toString(); + assertTrue("The writer was populated with something", results.length() > 0); + assertTrue("execution time " + results, results.indexOf("<td id=\"totalTime\">0h 0m 3") >= 0); + assertTrue("total executed", results.indexOf("<td id=\"totalRun\">24") > 0); + assertTrue("total passed", results.indexOf("<td id=\"totalPassed\">12") > 0); + assertTrue("total failed", results.indexOf("<td id=\"totalFailed\">12") > 0); + assertTrue("percent passed", results.indexOf("<td id=\"percentPassed\">50%") > 0); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <en...@us...> - 2007-05-31 15:45:16
|
Revision: 1555 http://svn.sourceforge.net/jameleon/?rev=1555&view=rev Author: engrean Date: 2007-05-31 08:44:26 -0700 (Thu, 31 May 2007) Log Message: ----------- Fixed Bug #1728882 - <wait> tag delay is applied even after a failure Modified Paths: -------------- trunk/jameleon-core/src/java/net/sf/jameleon/WaitTag.java trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml Added Paths: ----------- trunk/jameleon-core/tst/xml/framework/waitTagFail.xml trunk/jameleon-core/tst/xml/framework/waitTagSuccess.xml Modified: trunk/jameleon-core/src/java/net/sf/jameleon/WaitTag.java =================================================================== --- trunk/jameleon-core/src/java/net/sf/jameleon/WaitTag.java 2007-05-29 12:03:52 UTC (rev 1554) +++ trunk/jameleon-core/src/java/net/sf/jameleon/WaitTag.java 2007-05-31 15:44:26 UTC (rev 1555) @@ -18,16 +18,14 @@ */ package net.sf.jameleon; -import org.apache.commons.jelly.JellyTagException; -import org.apache.commons.jelly.MissingAttributeException; -import org.apache.commons.jelly.XMLOutput; +import net.sf.jameleon.function.FunctionTag; /** * Wait for the given number of milliseconds. * This tag may be used anywhere inside the testcase tag. * @jameleon.function name="wait" */ -public class WaitTag extends JameleonTagSupport { +public class WaitTag extends FunctionTag { /** * The number of milliseconds to wait for @@ -35,14 +33,13 @@ */ protected long delayTime; - public void doTag(XMLOutput out) throws MissingAttributeException, JellyTagException{ - synchronized (this){ - try { - this.wait(delayTime); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } + //Remove functionId as a required attribute + public void setup(){ + getFunctionalPoint().getAttribute("functionId").setRequired(false); } + public void testBlock(){ + delay(delayTime); + } + } Modified: trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml =================================================================== --- trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml 2007-05-29 12:03:52 UTC (rev 1554) +++ trunk/jameleon-core/tst/xml/acceptance/fineGrainedTests.xml 2007-05-31 15:44:26 UTC (rev 1555) @@ -21,7 +21,24 @@ <test-case-author>Christian Hargraves</test-case-author> <test-case-level>FUNCTIONAL</test-case-level> <application-tested>framework</application-tested> + <execute-jameleon-script + functionId="The wait tag delays as expected" + script="tst/xml/framework/waitTagSuccess.xml" + testCaseName="waitTagSuccess" + checkOutcomePassed="true" + executionTimeGreaterThan="300" + /> + + <execute-jameleon-script + functionId="The wait tag doesn't delay when a previous error occured" + script="tst/xml/framework/waitTagFail.xml" + testCaseName="waitTagFail" + checkOutcomeFailed="true" + executionTimeLessThan="100" + /> + + <execute-jameleon-script functionId="The test case fails with the correct # when useCSV=true" script="tst/xml/framework/test_case_use_csv_true.xml" testCaseName="test_case_use_csv_true" Added: trunk/jameleon-core/tst/xml/framework/waitTagFail.xml =================================================================== --- trunk/jameleon-core/tst/xml/framework/waitTagFail.xml (rev 0) +++ trunk/jameleon-core/tst/xml/framework/waitTagFail.xml 2007-05-31 15:44:26 UTC (rev 1555) @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> +<testcase xmlns="jelly:jameleon"> + <test-case-summary> + Tests that the wait tag doesn't wait when a previous error has occured + </test-case-summary> + <test-case-author>Christian Hargraves</test-case-author> + <test-case-level>ACCEPTANCE</test-case-level> + <functional-point-tested>wait</functional-point-tested> + <application-tested>framework</application-tested> + <test-case-bug>1728882</test-case-bug> + + <ju-assert-true functionId="cause a failure" + test="false" + msg="fail here"/> + <wait delayTime="300"/> +</testcase> Property changes on: trunk/jameleon-core/tst/xml/framework/waitTagFail.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + native Added: trunk/jameleon-core/tst/xml/framework/waitTagSuccess.xml =================================================================== --- trunk/jameleon-core/tst/xml/framework/waitTagSuccess.xml (rev 0) +++ trunk/jameleon-core/tst/xml/framework/waitTagSuccess.xml 2007-05-31 15:44:26 UTC (rev 1555) @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + Jameleon - An automation testing tool.. + Copyright (C) 2007 Christian W. Hargraves (en...@ho...) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> +<testcase xmlns="jelly:jameleon"> + <test-case-summary> + Tests that the wait tag waits for the time defined. + </test-case-summary> + <test-case-author>Christian Hargraves</test-case-author> + <test-case-level>ACCEPTANCE</test-case-level> + <functional-point-tested>wait</functional-point-tested> + <application-tested>framework</application-tested> + <test-case-bug>1506393</test-case-bug> + + <wait delayTime="300"/> +</testcase> Property changes on: trunk/jameleon-core/tst/xml/framework/waitTagSuccess.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |