Class JooTestMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="test",
          defaultPhase=TEST,
          threadSafe=true)
    public class JooTestMojo
    extends AbstractSenchaMojo
    Executes JooUnit tests. Unpacks all dependency to its output directory, generates a tests app which runs the script 'run-tests.js'. This runs JooUnit's BrowserRunner with the given TestSuite. Then the Test Mojo starts a Jetty on a random port between jooUnitJettyPortLowerBound and jooUnitJettyPortUpperBound and prints out the resulting test app URL.

    Tests are executed in one of three ways:

    1. If available, PhantomJS is started with a script that loads the test app and stores the test result in the report file in XML format.
    2. Otherwise, the Mojo tries to start a browser via the Selenium server given by jooUnitSeleniumRCHost with the test app URL and tries to collect the test result through Selenium.
    3. Another option is to set the system property interactiveJooUnitTests (mvn test -DinteractiveJooUnitTests), which simply halts Maven execution and gives you the opportunity to load and debug the test app in a browser.
    Option 1 and 2 respect the configured jooUnitTestExecutionTimeout (ms) and interrupt the tests after that time, resulting in a test failure.
    • Field Detail

      • testOutputDirectory

        @Parameter(defaultValue="${project.build.testOutputDirectory}")
        protected File testOutputDirectory
        Directory whose joo/classes sub-directory contains compiled test classes.
    • Constructor Detail

      • JooTestMojo

        public JooTestMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException