tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond Feng" <enjoyj...@gmail.com>
Subject [PROPOSAL] Automate itests for WAR packaging
Date Fri, 01 Feb 2008 17:41:46 GMT

(Sorry for the long text, I make it availabe on our WIKI too: 

In our WAR packaging scheme, we package SCA artifacts with Tuscany runtime 
jars in a WAR so that it can be deployed to a web container such as Tomcat, 
Jetty or Geronimo. In release 1.1, we already have 5-6 samples as web 

1) Most of the validation of web applications is done manully before a 
release. This is time-consuming and error prone.
2) Our integration tests are not performed in the WAR packaging scheme. 
Trying samples is a smoke test. If we can run the itests in a web 
application, we'll get much more coverage.

To address the above issues, I propose that we add the following 

1) Provide an option to wrap itests into web applications with little effort 
to convert the test cases
2) Automate the steps to start/stop a web container and deploy web 
applications to the container
3) Automate the testing of our JUnit-based test cases in the web application

I did some prototyping and here is what I have achieved so far:

1) Add some code to 
(tuscany-host-webapp) to intercept the HTTP requests to a special path 
"/junit". The control is then delegated to a new class WebTestRunner that 
knows how to find and run the JUNIT test cases and produce the results of 
the test (for example, number of runs, failures and errors, similar with 
what maven surefire plugin does). The report is sent back to the web client.

With this, we can run the plain JUNIT test cases in the web application by 
connecting to a URL like http://localhost:8080/<app-name>/junit.

2) Adjust the sample-calculator-webapp to validate the idea
* Add a test case calculator.CalculatorTestCase
* Configure the maven-war-plugin in the pom.xml to include the test classes 
as a jar into the WAR (WEB-INF/test-lib/)
* Change the junit dependency from test to runtime so it will be packaged 
into the WAR

3) Run the maven build as ususal, produce a WAR, deploy to Tomcat, browse to 
http://localhost:8080/sample-calculator-webapp/junit, and see the test 
results in the browser. To run a selected list of test cases, 

This seems to be non-invasive as we already configure the servlet filter for 
web applications. The regular URLs to JSPs or web services stay the same. We 
don't have to change the test case code too much.

I also went a bit further:

1) Developed a maven plugin to trigger the web-based junit tests and analyze 
the results
2) Configure the pom.xml with cargo plugin to start an embedded Jetty 
server, deploy the WAR, trigger the web-based junit tests, and stop the 

Now I have a complete automation. To avoid repeating the pom configuration 
for each itest, we can add a profile in the parent pom to support this 

For Tuscany itests, we also have to figure out a way to avoid the 
conflicting bootstrap in the J2SE and web.

Your feedback is welcome.


To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org

View raw message