The Way it WorksSelfEsteem has 2 pieces. The first piece generates an html file with all of your test results inside of an applet tag. The second piece is an applet that simply displays those test results. Therefore to use SelfEsteem, you have to generate that html file as part of your build process, then put the generated file up somewhere for people to look at along with the applet.
UsageSetting up SelfEsteem should be really easy, let's take a look at the steps involved: story fileIn my projects, every acceptance test belongs to a story, and every story belongs to an iteration. This seems to work pretty well, if you don't like the terminoly you can call them whatever you want, e.g. phases and usecases Now create a file that lists all your iterations, and within each iteration, the stories that belong to that iteration. Something like this: Iteration 4 -Story RecordAtAnyPoint -Story MarathonWebsite -Story DisplayNewOpenSaveFile Iteration 5 -Story MeaningfulStackTraces -Story LineHighlightingOnPlayRecord -Story RecommendSyntax -Story CoalesceEvents test casesIn order to associate tests to stories, you will have to use a convention for test names. Every acceptance test's name will be of the form : story-name/test-name If you use the junit tag in ant, the next part is simple, run the tests, and generate xml output. SelfEsteem expects it to look like this: <testsuite errors="1" failures="0" name="marathon.AllTests" tests="1" time="0.0"> <properties> <property name="java.vm.version" value="1.3.1_03-b03"></property> </properties> <testcase name='Story RecordAtAnyPoint/RecordAtAnyPoint' time="6.0"/> <testcase name='Story DisplayNewOpenSaveFile/Open & Savetest' time="6.0"/> <testcase name='Story DisplayNewOpenSaveFile/NewFileTest' time="6.0"> <error message='nyi' type='TestException'>TestException: nyi at New File Test(file:/C:/build/newFileTest.gui:13) java.awt.TestException: Not yet implemented at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1237) at java.awt.Component.getLocationOnScreen(Component.java:1211) at javax.swing.JPopupMenu.show(JPopupMenu.java:785) </error> </testcase> </testsuite> output templateSelfEsteem needs an output template so it knows what you want around the lines that it will supply. This is a pretty simple one. <html> <head><title>SelfEsteem</title></head> <body> <applet archive='selfesteem-applet.jar' code='net.sourceforge.selfesteem.applet.SelfEsteem' width='700' height='700' {{{lines}}} > </applet> </body> </html> adding SelfEsteem to your buildNow that you have all these files, you can generate an html file for SelfEsteem to display. From the console, that will look like this: java -cp selfesteem.jar net.sourceforge.selfesteem.Serializer outputtemplate.html output.html stories.txt testResults1.xml testResults2.xml To add it to your ant build file, just do this: Anyone want to write an ant task, I got lazy when this worked. <target name="selfesteem" depends="test"> <java classname='net.sourceforge.selfesteem.Serializer' fork='true'> <classpath refid="test.classpath"/> <arg value='outputtemplate.html'/> <arg value='output.html'/> <arg value='stories.txt'/> <arg value='testResults1.xml'/> <arg value='testResults2.xml'/> </java> <target> where
Take a look at the example to see what the generated files and output will look like. |