Pom-based is pretty simple and we are using Tomcat in that case:
http://svn.trails.codehaus.org/browse/~raw,r=844/trails/trunk/trails/examples/simple/pom.xml.
Setting up the container in abstract base test class doesn't have much to do
with Maven, but the advantage is that you can run everything in-process and
from your IDE.

Kalle


On Sat, Apr 26, 2008 at 1:33 PM, Marco Mistroni <[EMAIL PROTECTED]> wrote:

> Kalle,
>  i have started up cargo in my own test coz when i deployed my .war using
> jetty,
> it was always complaining on missing jar files (all related to my war
> application)
>
> i did a research and found that there was a bug in jetty 'embedded
> container' as it
> was not able to load certain classes from classpath
> this happened when i started to use selenium tests about 5 months ago
>
> i'll appreciate if you can share ur pom.xml, as my original idea was to
> use
> jetty too....
>
> thanks and regards
>  marco
>
> On Sat, Apr 26, 2008 at 8:43 PM, Kalle Korhonen <
> [EMAIL PROTECTED]>
> wrote:
>
> > An interesting approach. In my container-based integration testing, I've
> > either configured all in the pom and used the maven cargo plugin to
> start
> > up
> > the container in pre-integration-test phase, then stop it in
> > post-integration-test, or when I've wanted to do everything in-process
> and
> > in-code, I've created a JUnit base test class and held a Jetty instance
> in
> > a
> > static property (so it survives through repeated setUp/tearDowns). I
> don't
> > see what using Cargo buys you if you are setting up everything in code.
> >
> > Kalle
> >
> >
> > On Sat, Apr 26, 2008 at 10:22 AM, Marco Mistroni <[EMAIL PROTECTED]>
> > wrote:
> >
> > > hi all,
> > >  i am running my UAT tests in mvn2 using Cargo and selenium .
> > > Due to problems using cargo plugin (when it started it was not able to
> > > find
> > > some jars for my webapp), i have written a base test
> > > which starts cargo and selenium.
> > > Problem i have now is that cargo starts/stops at every setUP and
> > tearDown.
> > > Even though tests are ran automatically, i am  trying to use a
> mechanism
> > > so tha cargo is started only once and it is stopped only once during
> > hwole
> > > lifecycle of my tests.
> > >
> > > Wiuth JUnit3, i am unable to find  a method that gets called only once
> > > (sort
> > > of SetUpFixture) for the whole junit session...
> > >
> > > anyone could give help hee?
> > >
> > > here' smy AbstractSeleniumTest  for reference
> > >
> > > public abstract class AbstractSeleniumTest extends SeleneseTestCase {
> > >    protected DefaultSelenium selenium;
> > >    private  Logger log = Logger.getLogger(this.getClass());
> > >    private InstalledLocalContainer container;
> > >
> > >    public void setUp() throws Exception {
> > >        System.err.println("--SettingUp Fixture....");
> > >        startCargo();
> > >        selenium = createSeleniumClient("http://localhost:8080/";);
> > >        selenium.start();
> > >    }
> > >
> > >
> > >
> > >    public void tearDown() throws Exception {
> > >        stopCargo();
> > >        selenium.stop();
> > >
> > >    }
> > >
> > >    protected DefaultSelenium createSeleniumClient(String url) throws
> > > Exception {
> > >        return new DefaultSelenium("localhost", 4444, "*firefox", url);
> > >    }
> > >
> > >    private void startCargo() throws Exception {
> > >        // (1) Optional step to install the container from a URL
> pointing
> > > to
> > > its distribution
> > >        System.err.println("--- Starting cargo.. ......");
> > >        Installer installer = new ZipURLInstaller(
> > >            new URL("
> > >
> > >
> >
> http://www.apache.org/dist/tomcat/tomcat-5/v5.5.25/bin/apache-tomcat-5.5.25.zip
> > > "));
> > >        installer.install();
> > >
> > >        // (2) Create the Cargo Container instance wrapping our
> physical
> > > container
> > >        LocalConfiguration configuration =
> > >            (LocalConfiguration) new
> > > DefaultConfigurationFactory().createConfiguration(
> > >            "tomcat5x", ContainerType.INSTALLED,
> > > ConfigurationType.STANDALONE);
> > >        container =
> > >            (InstalledLocalContainer) new
> > > DefaultContainerFactory().createContainer(
> > >                "tomcat5x", ContainerType.INSTALLED, configuration);
> > >        container.setHome(installer.getHome());
> > >
> > >        // (3) Statically deploy some WAR (optional)
> > >        configuration.addDeployable(new WAR("target/BudgetWeb.war"));
> > >
> > >        // (4) Start the container
> > >        container.start();
> > >    }
> > >
> > >    private void stopCargo() throws Exception {
> > >        container.stop();
> > >    }
> > >
> > > thanks and regards
> > >   Marco
> > >
> >
>

Reply via email to