Red Hat
Sep 12, 2013
by Arquillian Project Team

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian Extension QUnit component!

This is the first release of the Arquillian QUnit extension which aims to automate QUnit JavaScript unit testing.

Highlighted Features

Integration with JUnit

This means that the extension integrates transparently with the JUnit testing framework and therefore can be easily used in continuous integration environments. Each QUnit test is considered to be a JUnit test. In case of failures, the failed assertions are reported as if it were a JUnit test.

Execute QUnit Test Suites using CLI or from IDE

You can execute one or more QUnit Test Suites using CLI or from your favorite IDE using the normal JUnit integration.

Getting Started

To start using the Arquillian QUnit extension, add the following dependency to your project:

pom.xml
<dependency>
          <groupId>org.jboss.arquillian.extension</groupId>
          <artifactId>arquillian-qunit</artifactId>
          <version>1.0.0.Alpha1</version>
      </dependency>

Writing Arquillian QUnit test classes

To create an Arquillian QUnit test class, annotate the test class with the @RunWith(QUnitRunner.class) and @QUnitResources annotations. The @QUnitResources annotation’s value should be the path of the folder which contains all the QUnit resources and dependencies which are required for your QUnit tests execution. For each QUnit Test Suite that you would like to execute, create a method and annotate it with the @QUnitTest annotation. The annotation’s value should be the QUnit Test Suite path, relative to the @QUnitResources path. On the below example, the src folder contains all the resources required from our QUnit tests in order to be executed and our QUnit Test Suite (qunit-tests.html) is included inside the src/test/resources/qunit-assets folder.

MyTestClass.java

      @RunWith(QUnitRunner.class)
      @QUnitResources("src/")
      public class MyTestClass {

      
        @QUnitTest("test/resources/qunit-assets/qunit-tests.html")
        public void myQUnitSuiteTest() {
          // empty body
        }
      }

Here’s a complete example:

ArquillianQUnitTestCase.java

      @RunWith(QUnitRunner.class)
      @QUnitResources("src/test/resources/assets")
      public class ArquillianQUnitTestCase {

      
          @Deployment
          public static Archive<?> createDeployment() {
              return ShrinkWrap.create(WebArchive.class, "rest-service.war")
                      .addClasses(Car.class, CarService.class, CarRepository.class, JaxRsActivator.class)
                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
          }

      
          @QUnitTest("tests/rest-service/qunit-tests-ajax.html")
          @InSequence(1)
          public void qunitAjaxTest() {
              // empty body - only the annotations are used
          }

      
          @QUnitTest("tests/generic/qunit-assertions.html")
          @InSequence(2)
          public void qunitAssertionsTest() {
              // empty body - only the annotations are used
          }
      }

You might want to see some showcases:

Showcase 1 contains a sample example which deploys a REST service along with the QUnit tests.

Showcase 2 shows how to execute QUnit tests on TravisCI

Showcase 3 depicts how Arquillian Qunit Extension can be used to test JavaScript code which uses the AngularJS JavaScript MVW framework

We look forward to your feedback on this release in our community forums or the #arquillian channel on FreeNode!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian Extension QUnit
Version 1.0.0.Alpha1 view tag
Release date 2013-08-27
Released by Karel Piwko
Compiled against
  • Arquillian Core – 1.1.1.Final
  • Arquillian Graphene – 2.0.0.Alpha4
  • Selenium – 2.33.0

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-qunit-api jar pom
  • org.jboss.arquillian.extension » arquillian-qunit jar pom

Release notes and resolved issues 1

Initial prototype release

Feature Request
  • ARQ-591 - Create extension for running JavaScript unit tests by Drone

Thanks to the following list of contributors: Tolis Emmanouilidis , Lukas Fryc , Karel Piwko , Lukas Fryc