Arquillian Algeron Extension 1.0.0.Alpha3 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.Alpha3 release of the Arquillian Algeron Extension component!

Important note: This extension was called Arquillian Pact before version 1.0.0.Alpha5, so you should use this name when pulling dependencies from Maven Central.

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 Algeron 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: Bartosz Majsak, Alex Soto, Eddú Meléndez Gonzales

Arquillian Recorder 1.1.5.Final 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.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 Cube Q 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 Cube Q Extension component!

This release of Arquillian Cube Q contains one new, but important feature – ability to add randomness on selected toxics values using mathematical distributions. Currently uniform distribution and log-normal distribution are supported.

Example using Log Normal distribution

networkChaos.on("pingpong", 8080)
    .latency(logNormalLatencyInMillis(2000, 0.3))
    .exec(times(2), () -> {
        URL url = new URL("http://" + ip + ":" + 8081 + "/hw/HelloWorld");
        String response = IOUtil.asString(url.openStream());
    });

In the example above, latency times are distributed in using a log-normal distribution with median of 2 seconds and 0.3 as sigma value. Then for each iteration of the test, a new value is calculated and send to toxiproxy.

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 Cube Q Extension
Version 1.0.0.Alpha2 view tag
Release date 2016-10-13
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.cube.q

  • org.arquillian.cube.q » arquillian-cube-q-api jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-spi jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-core jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-toxic jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-pumba jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-simianarmy jar javadoc pom

Release notes and resolved issues 2

Enhancement

Thanks to the following list of contributors: Alex Soto

Arquillian Warp 1.0.0.Alpha8 Released

The Arquillian team is proud to announce the 1.0.0.Alpha8 release of the Arquillian Warp 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 Warp
Version 1.0.0.Alpha8 view tag
Release date 2016-10-11
Released by Matous Jobanek
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-warp-bom pom
  • org.jboss.arquillian.extension » arquillian-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-impl jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-jsf jar javadoc pom

Release notes and resolved issues 8

Component Upgrade
  • ARQ-1988 - Warp HTTPCore 4.3 dependency conflict with latest Drone Alpha5
  • ARQ-2013 - Update Arquillian, Drone, Resolver, JaCoCo and JUnit to newer version
Enhancement
  • ARQ-1237 - Warp: use PortProber to determine free ports for proxy
  • ARQ-2026 - Client activity failures should have more priority over server activities
  • ARQ-2029 - Tell us the HTTP method in debug mode
Feature Request
  • ARQ-1272 - Warp: avoid need for user-defined serialVersionUID
Bug
  • ARQ-1923 - Cannot build Warp 1.0.0.Alpha7 with OpenJDK 8
  • ARQ-2014 - When warp is on classpath then almost every non-warp arquillian test fails

Thanks to the following list of contributors: Matous Jobanek, Christian Schulz, Lukas Fryc, Aslak Knutsen

Arquillian Algeron 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 Algeron Extension component!

Important note: This extension was called Arquillian Pact before version 1.0.0.Alpha5, so you should use this name when pulling dependencies from Maven Central.

Arquillian Pact is an extension that provides an integration between Arquillian and Pact.

What’s new

Maven Loader

Now you can use your own Maven artifact to store contracts (pacts files). Then provider will resolve the artifact and use the files included there.

To use it simply import following dependency:

<dependency>
  <groupId>org.arquillian.pact</groupId>
  <artifactId>arquillian-pact-provider-maven-loader</artifactId>
</dependency>

For example, this is how you can get contracts from a jar file stored in Maven repository. It is important to note that Arquillian Pact always takes the latest version of jar in case of not specifying one concrete version.

@PactMavenDependency(value = "org.superbiz:contract:[1.0,]")
public class MavenLoaderTest {}

Git Loader

You can also fetch your contracts from Git repository. The provider will clone/pull the repo and execute the contracts found there.

To use it simply import following dependency:

<dependency>
  <groupId>org.arquillian.pact</groupId>
  <artifactId>arquillian-pact-provider-git-loader</artifactId>
</dependency>

For example, this is how you can get contracts form a public Git repository:

@PactGit("https://github.com/lordofthejars/starwarspact.git")
public class GitLoaderTest {}

Check @PactGit annotation to see the options for configuring authentication or set a concrete directory inside Git repository.

Output Directory

When writing consumer tests you can now use pactReportDir configuration property to set where contracts are stored.

For example, this is how you can generate contracts into target/contracts directory.

<extension qualifier="pact-consumer">
  <property name="pactReportDir">target/contracts</property>
</extension>

Enrichments

You can use two new Target methods for executing provider tests:

@ArquillianResource
Target target;

target.testInteraction();

Or setting the URL directly instead of configuring it.

@ArquillianResource
Target target;

@ArquillianResource
URL webapp;

target.testInteraction(webapp);

In Alpha1, you need to pass as arguments to testInteraction method the current consumer and the current interaction. These values were injected in test using @CurrentConsumer and @CurrentInteraction annotations.

With these two new methods it is not necessary you enrich the test anymore. Of course these enrichments still work and you can still use methods where consumer and interaction are required if you want more control on the execution.

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 Algeron Extension
Version 1.0.0.Alpha2 view tag
Release date 2016-09-29
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-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

Release notes and resolved issues 5

Enhancement

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