Junit hosted under smartfrog
Steve Loughran <[email protected]>
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
Apart from the detail that dynamic JAR loading only works with the
command line daemon, not to one started by ant, we have smartfrog hosted
junit
1. listeners can be console, buffer (For testing), or to XML
2. XML listener saves to a file per test suite per host; the name attr
of the test suite is used for filing
3. we take a package and a (nestable) list of classes, and run them.
4 you can have as many test suites in a test runner as you like; they
can be conditional.
5. you can tell the test runner whether or not to run the tests on
startup, and whether a failed test should trigger failed liveness. I
will add termination too.
6. state is also added to attributes of the test runner and test suites,
testsRun, testsFailed, ..., which can be used to analyse the results.
I've attached the XML output; will do an XSLT to make it useful, and do
this as the followon from every test run (so the reports come together
during the run)
This is nearly ready for use. Some real usages will no doubt tune the
behaviour, but it is probably ready for anyone who has some things to
test on different machines...
-steve
#include "/org/smartfrog/services/junit/components.sf"
broken false;
sfConfig extends LocalJUnitTestRunner {
//buffer the results
listener extends XmlListener {
outputDirectory LAZY PROPERTY java.io.tmpdir;
}
tests extends JUnitTestSuite {
package "org.smartfrog.services.junit.test.targets";
name "MostTests";
classes [
"ThrowingTest",
"FunnyCharactersTest",
"OutputTest"];
}
brokentests extends JUnitTestSuite {
package "org.smartfrog.services.junit.test.targets";
name brokentests
classes [
"BrokenTest",
];
if broken;
}
}
tests.xml
(text/xml, 15.2 KB)
<?xml version="1.0" encoding="UTF-8" ?> <testsuite hostname="chamonix" suitename="tests" utc="1101401281354" started="Thu Nov 25 16:48:01 GMT 2004" > <fail classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" duration="1" > <text> testAmpersand(org.smartfrog.services.junit.test.targets.FunnyCharactersTest) </text> <fault> <classname> junit.framework.AssertionFailedError </classname> <message> [&] </message> <localizedMessage> [&] </localizedMessage> <stack> <frame classname="junit.framework.Assert" method="fail" file="Assert.java" line="47" native="false" /> <frame classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" method="testAmpersand" file="FunnyCharactersTest.java" line="30" native="false" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke0" file="NativeMethodAccessorImpl.java" line="-2" native="true" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke" file="NativeMethodAccessorImpl.java" line="39" native="false" /> <frame classname="sun.reflect.DelegatingMethodAccessorImpl" method="invoke" file="DelegatingMethodAccessorImpl.java" line="25" native="false" /> <frame classname="java.lang.reflect.Method" method="invoke" file="Method.java" line="324" native="false" /> <frame classname="junit.framework.TestCase" method="runTest" file="TestCase.java" line="154" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="127" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <fail classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" duration="1" > <text> testAngleBrackets(org.smartfrog.services.junit.test.targets.FunnyCharactersTest) </text> <fault> <classname> junit.framework.AssertionFailedError </classname> <message> [<] </message> <localizedMessage> [<] </localizedMessage> <stack> <frame classname="junit.framework.Assert" method="fail" file="Assert.java" line="47" native="false" /> <frame classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" method="testAngleBrackets" file="FunnyCharactersTest.java" line="34" native="false" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke0" file="NativeMethodAccessorImpl.java" line="-2" native="true" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke" file="NativeMethodAccessorImpl.java" line="39" native="false" /> <frame classname="sun.reflect.DelegatingMethodAccessorImpl" method="invoke" file="DelegatingMethodAccessorImpl.java" line="25" native="false" /> <frame classname="java.lang.reflect.Method" method="invoke" file="Method.java" line="324" native="false" /> <frame classname="junit.framework.TestCase" method="runTest" file="TestCase.java" line="154" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="127" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <fail classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" duration="1" > <text> testIllegalChar(org.smartfrog.services.junit.test.targets.FunnyCharactersTest) </text> <fault> <classname> junit.framework.AssertionFailedError </classname> <message> [#] </message> <localizedMessage> [#] </localizedMessage> <stack> <frame classname="junit.framework.Assert" method="fail" file="Assert.java" line="47" native="false" /> <frame classname="org.smartfrog.services.junit.test.targets.FunnyCharactersTest" method="testIllegalChar" file="FunnyCharactersTest.java" line="38" native="false" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke0" file="NativeMethodAccessorImpl.java" line="-2" native="true" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke" file="NativeMethodAccessorImpl.java" line="39" native="false" /> <frame classname="sun.reflect.DelegatingMethodAccessorImpl" method="invoke" file="DelegatingMethodAccessorImpl.java" line="25" native="false" /> <frame classname="java.lang.reflect.Method" method="invoke" file="Method.java" line="324" native="false" /> <frame classname="junit.framework.TestCase" method="runTest" file="TestCase.java" line="154" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="127" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <fail classname="org.smartfrog.services.junit.test.targets.ErrorInTeardownTest" duration="1" > <text> testNothing(org.smartfrog.services.junit.test.targets.ErrorInTeardownTest) </text> <fault> <classname> java.lang.IllegalArgumentException </classname> <message> tearDown() </message> <localizedMessage> tearDown() </localizedMessage> <stack> <frame classname="org.smartfrog.services.junit.test.targets.ErrorInTeardownTest" method="tearDown" file="ErrorInTeardownTest.java" line="37" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="130" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <fail classname="org.smartfrog.services.junit.test.targets.ThrowingTest" duration="2" > <text> testThrowing(org.smartfrog.services.junit.test.targets.ThrowingTest) </text> <fault> <classname> java.lang.RuntimeException </classname> <message> This was meant to happen </message> <localizedMessage> This was meant to happen </localizedMessage> <stack> <frame classname="org.smartfrog.services.junit.test.targets.ThrowingTest" method="testThrowing" file="ThrowingTest.java" line="37" native="false" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke0" file="NativeMethodAccessorImpl.java" line="-2" native="true" /> <frame classname="sun.reflect.NativeMethodAccessorImpl" method="invoke" file="NativeMethodAccessorImpl.java" line="39" native="false" /> <frame classname="sun.reflect.DelegatingMethodAccessorImpl" method="invoke" file="DelegatingMethodAccessorImpl.java" line="25" native="false" /> <frame classname="java.lang.reflect.Method" method="invoke" file="Method.java" line="324" native="false" /> <frame classname="junit.framework.TestCase" method="runTest" file="TestCase.java" line="154" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="127" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <fail classname="org.smartfrog.services.junit.test.targets.ErrorInSetupTest" duration="1" > <text> testNothing(org.smartfrog.services.junit.test.targets.ErrorInSetupTest) </text> <fault> <classname> java.lang.IllegalArgumentException </classname> <message> fail in setUp() </message> <localizedMessage> fail in setUp() </localizedMessage> <stack> <frame classname="org.smartfrog.services.junit.test.targets.ErrorInSetupTest" method="setUp" file="ErrorInSetupTest.java" line="35" native="false" /> <frame classname="junit.framework.TestCase" method="runBare" file="TestCase.java" line="125" native="false" /> <frame classname="junit.framework.TestResult$1" method="protect" file="TestResult.java" line="106" native="false" /> <frame classname="junit.framework.TestResult" method="runProtected" file="TestResult.java" line="124" native="false" /> <frame classname="junit.framework.TestResult" method="run" file="TestResult.java" line="109" native="false" /> <frame classname="junit.framework.TestCase" method="run" file="TestCase.java" line="118" native="false" /> <frame classname="junit.framework.TestSuite" method="runTest" file="TestSuite.java" line="208" native="false" /> <frame classname="junit.framework.TestSuite" method="run" file="TestSuite.java" line="203" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="testSingleClass" file="JUnitTestSuiteImpl.java" line="352" native="false" /> <frame classname="org.smartfrog.services.junit.JUnitTestSuiteImpl" method="runTests" file="JUnitTestSuiteImpl.java" line="294" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="executeTests" file="TestRunnerComponent.java" line="273" native="false" /> <frame classname="org.smartfrog.services.junit.TestRunnerComponent" method="run" file="TestRunnerComponent.java" line="237" native="false" /> <frame classname="java.lang.Thread" method="run" file="Thread.java" line="534" native="false" /> </stack> </fault> </fail> <pass classname="org.smartfrog.services.junit.test.targets.OutputTest" duration="3" > <text> testOut(org.smartfrog.services.junit.test.targets.OutputTest) </text> </pass> <pass classname="org.smartfrog.services.junit.test.targets.OutputTest" duration="3" > <text> testErr(org.smartfrog.services.junit.test.targets.OutputTest) </text> </pass> <summary tests="8" failures="3" errors="3" /> </testsuite>