The idea behind the SiteMesh testsuite is that a full unit test can be performed on SiteMesh for all servers in one step. Whenever any changes are made, the full test-suite should be re-run. When new features are added, the test-suite should be modified and then SiteMesh modified until the tests pass again.
It consists of:
- A web application that demonstrates all aspects of SiteMesh.
- A set of unit tests built on top of JUnit and HttpUnit that check the correct output is being generated from the web-app.
- A configurable deployment system that shall automate deployment of the web-app to lots of different app-servers/servlet-engines.
- A configurable test-runner that shall run the unit tests against the web-apps deployed on the various servers.
What are the standalone tests?
The standalone tests consist at this moment mostly out of tests that try to break the HTMLPageParser by throwing a whole lot of very badly written HTML pages at it. Take a look at the testsuite/parser-tests directory for the testcases. Make sure you read the readme.txt file in that directory before you start writing your own tests. Here is a small overview of what we currenly test for:
- not using html or body tags, see test5.txt, test6.txt and test15.txt
- upper/lower case tag combinations, see test8.txt
- not enclosing the attribute with double quotes (")
- specifying a title more than once (the first one is used), see test11.txt
- empty tags (<> and < >), see test10.txt
- xmp tags, see test17.txt
If you would like to ignore certain tests (because they would break (fail) the nightly build), put the file name in the ignore.txt file.
Each time a modification is made to SiteMesh or the test-suite run 'ant test-standalone' (it will recompile and use the modified SiteMesh sources).
How do I test on multiple containers?
First, install all the app-servers/servlet-engines you wish to test with. The servers don't need to be on the same machine - so long as you can access the directory the web-apps are to be deployed to, they can be on other machines on the network.
Build the web-app with 'ant webapp-build'. Deploy the resulting .war file in the dist directory to each server. Fire up all the servers (and leave them running). Make sure they are not all trying to listen on the same port :)
Edit tests.xml. For each server, an entry should be made saying where the web-app is deployed to on the filesystem (the app can be a .war, .ear or unpacked directory) and what the URL to access it is.
Each time a modification is made to SiteMesh or the test-suite a two step process must be performed:
- Run 'ant deploy' to rebuild the web-app and redeploy it to each server.
- Run 'ant test' to run the testsuite against the new server.
It is important that the deployment process has completed on all servers before running the second step - this takes longer on some servers.