Return-Path: Delivered-To: apmail-ws-tuscany-dev-archive@locus.apache.org Received: (qmail 86642 invoked from network); 3 Feb 2008 10:43:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Feb 2008 10:43:24 -0000 Received: (qmail 62104 invoked by uid 500); 3 Feb 2008 10:43:15 -0000 Delivered-To: apmail-ws-tuscany-dev-archive@ws.apache.org Received: (qmail 62062 invoked by uid 500); 3 Feb 2008 10:43:15 -0000 Mailing-List: contact tuscany-dev-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tuscany-dev@ws.apache.org Delivered-To: mailing list tuscany-dev@ws.apache.org Received: (qmail 62053 invoked by uid 99); 3 Feb 2008 10:43:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Feb 2008 02:43:15 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ant.elder@gmail.com designates 209.85.146.177 as permitted sender) Received: from [209.85.146.177] (HELO wa-out-1112.google.com) (209.85.146.177) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Feb 2008 10:42:47 +0000 Received: by wa-out-1112.google.com with SMTP id k22so2268938waf.18 for ; Sun, 03 Feb 2008 02:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; bh=ugHRjzKfmXr7OqC1oZfkkD1YddosSQhVCcsSJlA7EeA=; b=wPzWTtGbfWs3I5BBISiQjiHJXjCE5Vf14bfz/lurEAvTGgKf1vZlSuPnB0V1yeDeXwf9G7uqUZQdD+M3GDpzeBGIU7uMYr4OfWvVJ/Z+SbY3ihEEc0hk3S/8tPvyz3fAJOhwFW5+NtvMIBXtr7KBNscEMiHr+8xCQsuXx/ceVZs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=xmO9cyMZkMz2mXvAkRU0w5iFrcD9qSea/DwBxs8v7Ky7zeMLSuRTkaq1EAPVpA7+gcGPaLREL4+AiKgfHAETrYYH04d2mdbSmthRBYw9xR+4UfqRxkKvP7li+osWtI27FYuwXpHqH9BBdBCLpvu+11cs8UXusx+QK3ywJkuSVDg= Received: by 10.114.183.1 with SMTP id g1mr5696445waf.3.1202035374203; Sun, 03 Feb 2008 02:42:54 -0800 (PST) Received: by 10.70.30.4 with HTTP; Sun, 3 Feb 2008 02:42:54 -0800 (PST) Message-ID: <71e1b5740802030242m411ac8c2tba423d15d8aa4c15@mail.gmail.com> Date: Sun, 3 Feb 2008 10:42:54 +0000 From: "ant elder" Reply-To: antelder@apache.org To: tuscany-dev@ws.apache.org Subject: Re: [PROPOSAL] Automate itests for WAR packaging In-Reply-To: <003601c864f9$b92f0580$7faf4109@rfengt60p> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1814_28658791.1202035374082" References: <003601c864f9$b92f0580$7faf4109@rfengt60p> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_1814_28658791.1202035374082 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Feb 1, 2008 5:41 PM, Raymond Feng 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//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 > +1 to automated testing of the samples, demos and tutorials. Sounds like you've already done a lot of work on this, but i don't understand why this really complicated custom framework is necessary, what does it give that we need which the standard cargo and htmlunit testing wont provide? ...ant ------=_Part_1814_28658791.1202035374082--