Arquillian Drone Extension 1.1.0.CR3 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.1.0.CR3 release of the Arquillian Drone Extension component!

After some thought we realized that the current options for configuration (and implementation for that matter) were too complicated. While browserCapabilities allowed you to ignore the implementing class of WebDriver, you were still required to remember how to set up various capabilities.

We dropped the capability configuration support as you know it from CR1 and CR2 and replaced it with something much easier to use. You can now set up the capabilities directly as they come from WebDriver.

Some of the highlights in this release

Direct capability mapping. Think of any WebDriver capability, such as opera.no_restart or acceptSSLCerts, you can now specify them directly in arquillian.xml:

arquillian.xml
<extension qualifier="webdriver">
    <property name="browserCapabilities">firefox</property>
    <property name="opera.no_restart">true</property>
    <property name="acceptSSLCerts">false</property>
</extension>

Deprecated Arquillian Drone system properties configuration in favor of the system properties configuration provided by Arquillian Core. The old style of system properties still work, but using them will produce warnings in the log and will be removed completely in a later version.

In the previous arquilian.xml snippet, browserCapabilities would map to arquillian.webdriver.browser.capabilities. The correct way to override this property is now arq.extension.webdriver.browserCapabilities. With the new properties handling you can also provide the properties in a file by spcifying the file name in the arquillian.properties system property.

The same apply to the qualifiers support. Given the following arquillian.xml snippet you would now use arq.extension.webdriver-myqualifier.browserCapabilities instead of the legacy arquillian.webdriver.myqualifier.browser.capabilities:

arquillian.xml
<extension qualifier="webdriver-myqualifier">
    <property name="browserCapabilities">chrome</property>
</extension>

We hope that this will make Arquillian Drone easier to use, especially for people who have already tried to use browserCapabilities.

We look forward to hearing your feedback about this release in the community forums!

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 Drone Extension
Version 1.1.0.CR3 view tag
Release date 2012-09-10
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-drone-bom pom
  • org.jboss.arquillian.extension » arquillian-drone-selenium-depchain pom
  • org.jboss.arquillian.extension » arquillian-drone-webdriver-depchain pom
  • org.jboss.arquillian.extension » arquillian-drone-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-configuration jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-impl jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-selenium-server jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-selenium jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-drone-webdriver jar javadoc pom

Release notes and resolved issues 7

Component Upgrade
  • ARQ-1088 - Upgrade and align AS7 versions in Drone tests
Bug
  • ARQ-1047 - RemoteAddress nor Remote property does not trigger remote webdriver
  • ARQ-1064 - Can't set WebDriver capability with name containing '_'
  • ARQ-1075 - Problem with Drone when configuring WebDriver via Capabilities interface
  • ARQ-1090 - Remove chromeSwitches from tests
  • ARQ-1091 - Make capability setting in Drone easier

Thanks to the following list of contributors: Karel Piwko, Lukas Fryc, Jan PapouĊĦek, Aslak Knutsen

Arquillian Persistence Extension 1.0.0.Alpha5 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha5 release of the Arquillian Persistence Extension component!

We are back with a bunch of handy new additions and some bug fixes, so keep on reading..

Big kudos goes to Tomas Hradec for his great contribution on the “JPA Cache Eviction” support. You can now control your second level cache directly from the Arquillian tests. I would also like to thank Adrian Gonzalez, Alex Holmansky, Anton Shaykin and Christoph Rohr for their feedback which led us to fix some minor annoyances and shortcomings of APE. We are proud of the vibrant and active community around Arquillian!

Some of the highlights in this release

Instead of relying on the JPA provider you can now use your custom scripts to create the schema and populate data for each test. The only thing you have to do is decorate your test class with the following annotation:

@CreateSchema({"create-schema.sql", "populate-data.sql"})

Thanks to Tomas Hradec we have taken control over the Second Level JPA cache eviction. This initial implementation gives you a possibility to evict the cache before or after your test. Just specify which persistence unit(s) should be used by APE:

@JpaCacheEviction(entityManager = { "java:comp/env/MyPersistenceUnit" })

One of the shortcomings of the previous versions was the fact that you were always forced to provide the data source name explicitly. Either through arquillian.xml or by using the @DataSource annotation. With Alpha 5 you won’t have to. If you only use one data source in the test case, it will be inferred automatically from the persistence.xml used by your test.

You can also tell DBUnit which schema needs to be used for seeding the database. Just add the schema property to your arquillian.xml configuration as illustrated in the snippet below:

arquillian.xml
<extension qualifier="persistence-dbunit">
    <property name="schema">ape</property>
</extension>

We’ve also extended our test suite by adding the following databases to our continuous integration pipeline

  • MySQL 5.5.24
  • PostgreSQL 9.1.4

Important change: We renamed two properties used in arquillian.xml giving them more appropriate names:
initStatement became scriptsToExecuteBeforeTest
cleanupStatement became scriptsToExecuteAfterTest
Moreover you can now specify list of scripts (or files) seperated by comma.

We look forward to hearing your feedback about this release in the community forums!

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 Persistence Extension
Version 1.0.0.Alpha5 view tag
Release date 2012-08-31
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-persistence-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-impl jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-integration-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-integration-tests-testng jar javadoc pom

Release notes and resolved issues 23

Enhancement
  • ARQ-763 - Introduce TestNG tests
  • ARQ-873 - Provide flexible maven configuration for handling combination of different containers and databases
  • ARQ-877 - Improve DBUnit cleanup handling
  • ARQ-882 - Should be possible to specify data insert strategy per @Test
  • ARQ-885 - Improve init/cleanupStatement handling
  • ARQ-1017 - Update APE to Core 1.0.1.Final
  • ARQ-1084 - Fix failing tests in JDK7
Feature Request
  • ARQ-884 - Should be possible to globally define columns to be excluded when comparing data sets.
  • ARQ-899 - Should be able to read data source name from persistence.xml attached to test archive
  • ARQ-900 - Should be able to prepare database using custom scripts
  • ARQ-1029 - Arquillian Persistence Extension: Use specific Schema
  • ARQ-1058 - Implement JPA Cache eviction control
  • ARQ-1065 - Improve SQL script handling
Bug
  • ARQ-872 - Integration tests are failing with Glassfish 3.1.2 embedded
  • ARQ-901 - NPE when using @Cleanup(strategy=CleanupStrategy.USED_ROWS_ONLY)
  • ARQ-1083 - Closing connection might cause memory leak
  • ARQ-1294 - Caught exception in beforeCompletion()
Sub-task
  • ARQ-878 - Make default cleanup phase globally configurable
  • ARQ-879 - Change default cleanup strategy back to AFTER test execution
  • ARQ-881 - Should be possible to exclude arbitrary tables from cleanup procedure
  • ARQ-886 - Rename properties to more meaningful ones
  • ARQ-887 - Allow to use to more than one SQL script file

Thanks to the following list of contributors: Bartosz Majsak, Aslak Knutsen, Tomas Hradec

Arquillian Spring Framework Extension 1.0.0.Beta1 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Beta1 release of the Arquillian Spring Framework Extension component!

The first Beta release of the Arquillian Spring extension is here.

Some of the highlights in this release

Client side application context registration
Spring transaction support

Client side tests with Spring

So far the Spring extension has only allowed application context creation and bean injection to occure when the tests were deployed in a container. We wanted to bring the same functionality to the client side. With the two new annotations @SpringClientConfiguration and @SpringClientAnnotationConfiguration it is now possible to set up the application context and inject beans into Arquillian tests that are running on the client.

An example of use would be to test a deployed REST service using the Spring RestTemplate configured in the client context.

@RunWith(Arquillian.class)
@SpringClientConfiguration("applicationContext-rest.xml")
public class ClientRestServiceTestCase {

    @Deployment(testable = false)
    @OverProtocol("Servlet 3.0")
    public static Archive createTestArchive() {
        return Deployments.createWebApplication()
                .addAsWebInfResource("mvc/web.xml", "web.xml")
                .addAsWebInfResource("service-servlet.xml");
    }

    @ArquillianResource
    private URL contextPath;

    @Autowired
    private RestTemplate restTemplate;

    @Test
    public void testGetEmployees() {

        Employee result = restTemplate.getForObject(contextPath + "/Employees/1", Employee.class);

        assertEquals("The returned employee has invalid name.", "John Smith", result.getName());
    }
}

Spring transaction support

The recent release of the Arquillian Transaction Extension allow us to control the transactional behavior of our test methods. With the help of the Spring Extension you can now control your Spring configured transaction manager using the same API. The set up is done in the normal Spring way by defining a transaction manager in the application context.

applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

   <!-- Creates local entity manager factory -->
   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
       <property name="persistenceUnitName" value="ArquillianTestUnit"/>
   </bean>

   <!-- Enables the declarative transaction support -->
   <tx:annotation-driven transaction-manager="txManager"/>

   <!-- Creates transaction manager -->
   <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
       <property name="entityManagerFactory" ref="entityManagerFactory"/>
   </bean>

</beans>

You define which transaction manager to use in your test class via the manager attribute on the @Transactional annotation.

@RunWith(Arquillian.class)
@Transactional(manager = "txManager")
@SpringConfiguration("applicationContext.xml")
public class JpaEmployeeRepositoryTestCase {

    @Autowired
    private EmployeeRepository employeeRepository;

    @PersistenceContext
    private EntityManager entityManager;

    @Test
    public void testSave() {

        Employee employee = new Employee();
        employee.setName("Test employee");

        employeeRepository.save(employee);

        List<Employee> result = entityManager.createQuery("from Employee").getResultList();

        assertEquals("Two employees were expected.", 1, result.size());
    }
}

Migrating from 1.0.0.Alpha2

  • Artifact arquillian-container-spring has been renamed to arquillian-service-container-spring

We look forward to your feedback on this new release on the community forums!

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 Spring Framework Extension
Version 1.0.0.Beta1 view tag
Release date 2012-08-17
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-common jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-2.5 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-3 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-container-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-inject jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-javaconfig jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-2.5-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-3-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-spring jar javadoc pom

Release notes and resolved issues 3

Arquillian Transaction Extension support and Client side ApplicationContext creation

Feature Request
  • ARQ-958 - Provide support for Spring transactions
  • ARQ-985 - Register the Spring Extension on client side.

Thanks to the following list of contributors: Jakub Narloch, Aslak Knutsen

Arquillian Transaction Extension 1.0.0.Alpha1 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

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

Motivation

Until this point, the only special transaction support in Arquillian has come from the Arquillian Persistence Extension. But as the extension universe expand, the need for other extensions to interact with transactions expand as well. To avoid you having to deal with the individual extensions transaction support in different ways, different apis, we concluded it was time to make Transactions it’s own top level extension.

Usage

The current API takes a declarative approach to configure the transactional behavior of the Test case. By annotating the TestClass or the TestMethod with @Transactional you control how the transaction should be handled after TestMethod execution.
Should Arquillian COMMIT, ROLLBACK or DISABLE the transaction for this method?

Example:

@RunWith(Arquillian.class)
@Transactional
public class GreeterTestClass {

    public void defaultTest() throws Exception {
        // test code
    }

    @Transactional(TransactionMode.ROLLBACK)
    public void rollbackTest() throws Exception {
        // test code
    }
}

SPI integration

The extension itself does not come with any implementation for a concrete transaction API, the implementations will be provided by separate modules. During execution, the transactional handling is delegated to a TransactionProvider service implementation which is registered within Arquillian. The SPI defines a set of transaction lifecycle events ((Before|After)Transaction(Started|Ended)) and a separate transactional scope (@TransactionScope) which is bound to the executing transaction.

Implementations

Besides the JTA implementation provided by the Arquillian Persistence Extension, the next extensions which will provide support is the Spring Extension. More details to come.

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 Transaction Extension
Version 1.0.0.Alpha1 view tag
Release date 2012-08-13
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-transaction-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-bom pom

Release notes and resolved issues 2

The basic setup for rollback/commit on a TestClass with multiple Manager implementation

Feature Request
  • ARQ-1033 - Extract the transaction support out of Arquillian Persistence Extension

Thanks to the following list of contributors: Aslak Knutsen, Jakub Narloch

Arquillian Spring Framework Extension 1.0.0.Alpha2 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha2 release of the Arquillian Spring Framework Extension component!

This release contain many improvements on the existing extension, but also some new features.

Some of the highlights in this release

Warp Spring MVC Extension
Spring Embedded Container
Separated the integration capabilities

Testing Spring MVC with Warp

Arquillian Warp is a powerful tool that let you run the functional tests against your web front end and at the same time verify the internal state of your application. With this release we are introducing the Warp extension for testing Spring MVC applications that run in a real servlet container.

Let’s dive into an example of how to test a Spring MVC application using Arquillian Warp. First we need to prepare the application descriptor.

web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">

    <servlet>
        <servlet-name>welcome</servlet-name>
        <servlet-class>org.jboss.arquillian.warp.extension.spring.servlet.WarpDispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>welcome</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

</web-app>

You’ll notice that instead of using Spring’s DispatcherServlet we instead use the WarpDispatcherServlet.

And the testing code:

LoginControllerTestCase.java
@WarpTest
@RunWith(Arquillian.class)
public class LoginControllerTestCase {

    @Drone
    WebDriver browser;

    @ArquillianResource
    URL contextPath;

    @Test
    @RunAsClient
    public void testLoginValidationErrors() {
        browser.navigate().to(contextPath + "login.do");

        Warp.execute(new ClientAction() {

            @Override
            public void action() {

                browser.findElement(By.id("loginForm")).submit();
            }
        }).verify(new LoginControllerValidationErrorsVerification());
    }

    @Test
    @RunAsClient
    public void testLoginSuccess() {
        browser.navigate().to(contextPath + "login.do");
        browser.findElement(By.id("login")).sendKeys("warp");
        browser.findElement(By.id("password")).sendKeys("warp");

        Warp.execute(new ClientAction() {

            @Override
            public void action() {

                browser.findElement(By.id("loginForm")).submit();
            }
        }).verify(new LoginSuccessVerification());
    }

    public static class LoginControllerValidationErrorsVerification extends ServerAssertion {

            private static final long serialVersionUID = 1L;

            @SpringMvcResource
            private ModelAndView modelAndView;

            @SpringMvcResource
            private Errors errors;

            @AfterServlet
            public void testGetLogin() {

                assertEquals("login", modelAndView.getViewName());
                assertNotNull(modelAndView.getModel().get("userCredentials"));
                assertEquals("Two errors were expected.", 2, errors.getAllErrors().size());
                assertTrue("The login hasn't been validated.", errors.hasFieldErrors("login"));
                assertTrue("The password hasn't been validated.", errors.hasFieldErrors("password"));
            }
        }

    public static class LoginSuccessVerification extends ServerAssertion {

        private static final long serialVersionUID = 1L;

        @SpringMvcResource
        private ModelAndView modelAndView;

        @SpringMvcResource
        private Errors errors;

        @AfterServlet
        public void testGetLogin() {

            assertEquals("welcome", modelAndView.getViewName());
            assertFalse(errors.hasErrors());
        }
    }
}

In the above example we are using Arquillian Drone to navigate to the login page of our application and then filling in the login form with our user credentials.

The internal state of the DispatcherServlet is caught in a SpringMvcResult object which can be injected into the ServerAssertion. We can also inject other required objects like the ModelAndView.

Spring Embedded Container

Each development cycle may end in repeatedly re-running the integration tests, each time taking significant amount of time. The embedded container was thought to aid this situation. Running the tests embedded will decrease the execution time from seconds to milliseconds. It will help testing business objects, but since it’s not a full servlet container you won’t be able to use it for testing servlet requests in a web application.

Migrating from 1.0.0.Alpha1

1.0.0.Alpha2 comes with a couple significant changes from the previous version.

  • The Spring integration functionality has been separated out to its own module and is now part of the arquillian-service-integration-spring-inject module, and additional the arquillian-service-integration-spring-inject and the arquillian-service-integration-spring-javaconfig that does not target any specific Spring version, but rather provide functionality like XML or Java-based configuration.
  • The arquillian-service-deployer-spring module’s can still be used for autopackging the Spring artifacts.
  • The @SpringAnnotatedConfiguration has been renamed to @SpringAnnotationConfiguration.

Roadmap

The next release is planned to include Spring transaction support and will introduce even better Warp integration on the client side in order make REST testing even simpler.

We look forward to hearing your feedback about this release in the community forums!

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 Spring Framework Extension
Version 1.0.0.Alpha2 view tag
Release date 2012-07-21
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-common jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-2.5 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-3 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-container-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-inject jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-javaconfig jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-2.5-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-3-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-spring jar javadoc pom

Release notes and resolved issues 5

Spring Embedded Container + Warp

Feature Request
  • ARQ-219 - Implement an embedded Spring container
  • ARQ-945 - Extract Spring Integration out of Spring Deployer
  • ARQ-978 - Provide Warp with extension for testing SpringMVC.
Task
  • ARQ-1019 - Spring Extension: Update the Arquiilian Core to 1.0.1

Thanks to the following list of contributors: Jakub Narloch, Aslak Knutsen