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