tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond Feng" <enjoyj...@gmail.com>
Subject Re: [PROPOSAL] Automate itests for WAR packaging
Date Sun, 03 Feb 2008 07:13:08 GMT

I committed what I have under r617959, 617960 and 617961. There are three 
key changes:

1) Add some logic to TuscanyServletFilter to run the test cases in the web 
2) Add a maven plugin to trigger the junit tests on the web server and 
analyze the results
3) Convert itest-services to use the web-based unit testing

For 3), you can run "mvn clean install". The build will generate a WAR (in 
addition to the jar), start an embedded Jetty, deploy the WAR, connect to 
the web app to run test cases and produce the results, and then shutdown the 

You can also run "mvn -Pgeronimo,webapp" to test it against an existing 
Geronimo server. Change geronimo.home property in the pom.xml to set it to 
your geronimo root.


----- Original Message ----- 
From: "Luciano Resende" <luckbr1975@gmail.com>
To: <tuscany-dev@ws.apache.org>
Sent: Saturday, February 02, 2008 3:42 PM
Subject: Re: [PROPOSAL] Automate itests for WAR packaging

> Great Raymond,
>   I very interested in using this approach to automate the execution
> of our iTests in a web app container. I playing a little with some
> iTests to try to make them ready to use this. From my initial
> investigations, I couldn't really change the packaging schema for a
> given project based on a maven profile, so, I decided to create a new
> webapp project, that then includes the original iTests as
> dependencies, other then this, most of the configuration can be
> centralized on a parent pom. I still trying to see the best way to
> include the test cases, that was generated in a separate jar (a second
> artifact from a given module), into the web app....
> BTW, Would you mind committing it so I can start playing with a
> end-to-end scenario for the iTests too ?
> On Feb 1, 2008 9:41 AM, Raymond Feng <enjoyjava@gmail.com> wrote:
>> Hi,
>> (Sorry for the long text, I make it availabe on our WIKI too:
>> http://cwiki.apache.org/confluence/display/TUSCANYWIKI/Automation+of+itests+in+web+applications).
>> 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
>> applications.
>> 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
>> capabilities:
>> 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
>> "org.apache.tuscany.sca.host.webapp.TuscanyServletFilter"
>> (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,
>> http://localhost:8080/sample-calculator-webapp/junit?test1,test2.
>> 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
>> server.
>> 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
>> scheme.
>> 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.
>> Thanks,
>> Raymond
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> -- 
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org

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

View raw message