Arquillian Pact Extension 1.0.0.Alpha4 Released

The Arquillian team is proud to announce the 1.0.0.Alpha4 release of the Arquillian Pact Extension component!

Arquillian Pact is an extension for writing contract-driven tests providing you seamless integration with well known Pact framework.

What’s new

@Pact annotation can be used on the class level

You can use @Pact annotation on the class level, so method that defines a pact fragment just need to return PactFragment object. In case of setting this annotation both on the class and method level, the one defined on the method will take precedence.

Pact Publisher properties configuration

You can configure Pact Publisher properties using Java System properties or Environment variables using Arquillian syntax. Any property value can be set using Java system property ${name:defaultValue} or using environment variable ${env.name:defaultValue}. defaulValue will be used if referred property is not defined.

Bug fixing

Using skipDeployment with WildFly Swarm returns a NPE

Skipping deployment for WildFly Swarm was resulting with NPE. This is because our URL provider was conflicting with the one Swarm implements (#44).

Pact Publisher is not called when used with Gradle

Pact Publisher is not called when used with Gradle due to a bug in Gradle. Since Publisher reacts to AfterSuite and this event is not emitted when running in Gradle, we changed it to AfterClass. This has a slight impact on the performance as publishing pacts happens after each test execution instead of being triggered once in a bulk after the whole test suite execution (#43).

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 Pact Extension
Version 1.0.0.Alpha4 view tag
Release date 2016-11-07
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.pact

  • org.arquillian.pact » arquillian-pact-consumer-api jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-core jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-spi jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-git-publisher jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-api jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-core jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-spi jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-pact-broker-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-maven-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-git-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-git jar javadoc pom
  • org.arquillian.pact » arquillian-pact-configuration jar javadoc pom

Release notes and resolved issues 4

Bug

Thanks to the following list of contributors: Alex Soto, Bartosz Majsak

Arquillian Pact Extension 1.0.0.Alpha3 Released

The Arquillian team is proud to announce the 1.0.0.Alpha3 release of the Arquillian Pact Extension component!

Arquillian Pact is an extension for writing contract-driven tests which provides integration with Pact framework.

What’s new

Skipping the deployment

In case of consumer driven contracts, there are two kinds of tests – consumer tests and provider tests. Usually in your CI environment you want to run provider tests against two different scenarios:

Against a master branch of provider to detect if provider team has already implemented all the functionalities defined in your contracts.

Against (pre)production. If you support deploying consumer independently of a provider, then you need to ensure that if you deploy new consumer with the new contracts to (pre)production everything will be still working and you haven’t introduced any regressions.

In both cases, the test itself is exactly the same. There is only one slight difference in both cases which how you set up your test environments. In the first scenario, you want to deploy the latest provider code. One way of doing it is using Arquillian container control and @Deployment method to create the package, start the container and deploy it. But in the latter case, when you want to run contract test against provider that is already deployed on (pre)production environment, you don’t need to deploy anything nor control the lifecycle of any container. For this reason we provided skipDeployment flag.

skipDeployment default value by default is set to false, which means that the test will behave as it usually does, but when it is set to true, Arquillian is going to ignore anything related to container lifecycle. To use this strategy your test needs to be defined as `@RunAsClient`. You can think of it as a dynamic way of converting an Arquillian container test into Arquillian standalone test.

Let’s see an example:

@RunWith(Arquillian.class)
@Provider("test_provider")
@PactFolder("pacts")
@RunAsClient
public class MyServiceProviderTest {

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        return ShrinkWrap.create(WebArchive.class).addClass(MyService.class);
    }

    @ArquillianResource
    @Environment("myservice.url")
    URL webapp;

    @ArquillianResource
    Target target;

    @Test
    public void should_provide_valid_answers() {
        target.testInteraction(webapp);
    }

}

Given previous test, if skipDeployment is false, this test will behave like:

  1. Start chosen application server (Wildfly, TomEE, Tomcat, …​)
  2. Package and Deploy MyService
  3. Enrich webapp URL with the one provided by application server. @Environment reference is ignored.
  4. Executes contract test against deployed application.
  5. Undeploy and stop everything.

But if you set skipDeployment to true, lifecycle is slightly different:

  1. Enrich webapp URL with Java system property or environment variable named myservice.url set in @Environment.
    # Executes contract tests against URL provided by @Environment.

There is no additional “behind the scenes” Arquillian magic involved. Notice that with a simple attribute you can enable/disable how Arquillian behaves regarding the deployment lifecycle, and how you can reuse same test (DRY) for different scenarios.

You can read more about this feature in Pact documentation

Provider states with parameters introduced in Version 3 of Pact Spec

You can also use parameters for defining pact states. This feature is introduced in version 3 of pact contract files.

In consumer part you can add states with parameters doing:

Map<String, Object> stateParams = new HashMap<>();
stateParams.put("name", "Alexandra");

return builder
        .given("test state", stateParams)
        .uponReceiving("ConsumerTest test interaction")
        .path("/")
        .method("GET")
        .willRespondWith()
        .status(200)
        .headers(header)
        .body("{\"responsetest\": true, \"name\": \"harry\"}")
        .toFragment();

Notice that you are using given passing state name and parameters.

Then in provider side:

 @State("test state")
public void testStateMethod(Map<String, Object> params) {
    assertThat(params).containsEntry("name", "Alexandra");
}

Pact Publisher mechanism

Arquillian Pact also offers additional ways to of publishing “pact” contract files comparing to what Pact itself is providing. With Pact you usually need to relay on the build tool to publish “pact” files. Pact offers a Maven and Gradle plugin for publishing contracts to Pact Broker, but if you want to use Git repository or sharing contracts through an arbitrary folder, then you’ll need to start hacking the build tool which is not always as easy as it should be :)

In Arquillian Pact we have defined a Pact Publishing SPI so you can implement your own publisher. We currently support three different publishers – Folder, URL[POST method] and Git.

For example to use it with Folder Publisher, arquillian.xml might look like:

<?xml version="1.0"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://jboss.org/schema/arquillian"
            xsi:schemaLocation="http://jboss.org/schema/arquillian
    http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <extension qualifier="pact-consumer">
        <property name="pactPublishConfiguration">
            provider: folder
            outputFolder: /mypacts
        </property>
    </extension>

</arquillian>

With this configuration and setting publishContracts to true, Arquillian Pact copies generated contracts to outputFolder.

It is important to note that by default publishContracts configuration attribute is false. This means that when you run any consumer contract test, contracts are not published. publishContracts configuration attribute should be only set to true if and only if you are publishing a new version of a consumer, and this will be done by your CI/CD environment.

You can set outputFolder value using Java system property.

You can read more about this feature in Pact documentation

Bug fixing

GitPactLoader – password field as passphrase bug

GitPactLoader was using password field as passphrase which is totally wrong since passphrase of a private key is not a password. issue-31

GitPactLoader – always using default key

GitPactLoader was always using default key instead of the one in current user home directory.

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 Pact Extension
Version 1.0.0.Alpha3 view tag
Release date 2016-11-03
Released by Bartosz Majsak
Compiled against

Published artifacts org.arquillian.pact

  • org.arquillian.pact » arquillian-pact-consumer-api jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-core jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-spi jar javadoc pom
  • org.arquillian.pact » arquillian-pact-consumer-git-publisher jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-api jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-core jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-spi jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-pact-broker-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-maven-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-provider-git-loader jar javadoc pom
  • org.arquillian.pact » arquillian-pact-git jar javadoc pom
  • org.arquillian.pact » arquillian-pact-configuration jar javadoc pom

Release notes and resolved issues 8

Enhancement
Bug

Thanks to the following list of contributors: Alex Soto, Bartosz Majsak, Eddú Meléndez Gonzales

Arquillian Recorder 1.1.5.Final Released

The Arquillian team is proud to announce the 1.1.5.Final release of the Arquillian Recorder component!

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 Recorder
Version 1.1.5.Final view tag
Release date 2016-11-02
Released by Bartosz Majsak
Compiled against

Published artifacts org.arquillian.extension

  • org.arquillian.extension » arquillian-recorder-api jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-spi jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-reporter-api jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-reporter-spi jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-reporter-impl jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-screenshooter-api jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-screenshooter-spi jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-screenshooter-impl-base jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-video-api jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-video-spi jar javadoc pom
  • org.arquillian.extension » arquillian-recorder-video-impl-base jar javadoc pom
  • org.arquillian.extension » arquillian-desktop-video-recorder jar javadoc pom

Release notes and resolved issues 2

Enhancement

Thanks to the following list of contributors: Bartosz Majsak, Hemani, Dipak Pawar, Alex Soto

Arquillian Container SE 1.0.1.Final Released

The Arquillian team is proud to announce the 1.0.1.Final release of the Arquillian Container SE component!

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 Container SE
Version 1.0.1.Final view tag
Release date 2016-11-01
Released by Tomas Remes
Compiled against

Published artifacts org.jboss.arquillian.container

  • org.jboss.arquillian.container » container-se-api jar javadoc pom
  • org.jboss.arquillian.container » container-se-managed jar javadoc pom
  • org.jboss.arquillian.container » container-se-server jar javadoc pom
  • org.jboss.arquillian.container » container-se-tests jar javadoc pom

Thanks to the following list of contributors: Tomas Remes, Martin Kouba, Bartosz Majsak

Arquillian OSGi 2.2.0.Final Released

The Arquillian team is proud to announce the 2.2.0.Final release of the Arquillian OSGi component!

What is Arquillian OSGi?

ShrinkWrap is the simplest way to create archives in Java. Using the fluent and intuitive ShrinkWrap API, developers may assemble JARs, WARs, and EARs to be deployed directly by Arquillian during testing.

Release details

Component Arquillian OSGi
Modules
Version 2.2.0.Final view tag
Release date 2016-10-18
Released by Thomas Diesler
Compiled against

Published artifacts org.jboss.arquillian.protocol

  • org.jboss.arquillian.protocol » arquillian-protocol-osgi jar javadoc pom
  • org.jboss.arquillian.testenricher » arquillian-testenricher-osgi jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-osgi jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-osgi-tests jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-jbosgi-embedded jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-felix-embedded jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-equinox-embedded jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-karaf-managed jar javadoc pom
  • org.jboss.arquillian.container » arquillian-container-karaf-remote jar javadoc pom

Thanks to the following list of contributors: Thomas Diesler, Tomas Turek, Steve Storck, Martin Basovnik