Arquillian Algeron Extension 1.0.0.Alpha6 Released

The Arquillian team is proud to announce the 1.0.0.Alpha6 release of the Arquillian Algeron Extension 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 Algeron Extension
Version 1.0.0.Alpha6 view tag
Release date 2017-02-10
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.algeron

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

Release notes and resolved issues 4

Enhancement
Bug

Thanks to the following list of contributors: Alex Soto

Arquillian Algeron Extension 1.0.0.Alpha5 Released

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

Arquillian Pact has been rebranded to Arquillian Algeron. This is an extension for writing contract-driven tests.

Currently we are providing you seamless integration with well known Pact framework but more integrations will come in next releases.

What’s new

Arquillian Pact has been rebranded to Arquillian Algeron

Now Arquillian Pact is under the umbrella of Consumer Driven Contract project called Arquillian Algeron.

This rebranding has influenced the structure of Arquillian Pact. To migrate from Arquillian Pact to Arquillian Algeron Pact, you need will have to:

  • Artifact Id has changed from arquillian-pact-consumer-core and arquillian-pact-provider-core to arquillian-algeron-pact-consumer-core and arquillian-algeron-pact-provider-core.
  • Contract loaders has been renamed and relocated to a common place, so instead of @PactFolder now it is @ContractsFolder. In general all loaders annotations has been renamed by replacing the Pact element to Contracts.
  • Pact publisher is not configured anymore in pact-consumer extension but in algeron-consumer. You can read about it at Consumer Publisher section
  • Pact Loader has been renamed to Contracts Retriever.
  • Base package is not org.arquillian.pact anymore but org.arquillian.algeron.pact – this might be relevant if you have already started exploring SPIs.

Allow user to define states like Cucumber expressions

You can pass as state expressions following Cucumber approach, so for example you can pass next state in consumer:

public PactFragment createFragment(PactDslWithProvider builder) {
  builder.given("I have 36 cukes in my belly")
         ...
}

And you can get it on provider side using:

@State("I have (\\d+) cukes in my belly")
public void stateMethod(int numberOfCukes) {
  this.numberOfCukes = numberOfCukes;
}

You can read more about this feature at Pact States section

AssertJ integration

A custom assertj assertion has been created so asserting contracts using Target in provider side could be done in a readable way instead of calling a method.

@ArquillianResource
URL webapp;

@ArquillianResource
Target target;

@Test
public void should_provide_valid_answers() {
  assertThat(target).withUrl(webapp).satisfiesContract();
}

You can read more about this feature at AssertJ Integration section

Retrieving/Loading contracts can be configured using annotations and in arquillian.xml

Consumer can publish contracts when the contract is generated. Its configuration parameters are set in arquillian.xml. But on the provider side, contracts used for verification were configured using annotations.

To make things more standard, now retrievers can be configured using annotations or as publishers in arquillian.xml too. For example:

<extension qualifier="algeron-provider">
  <property name="retrieverConfiguration">
          provider: folder
          contractsFolder: <folder where contracts are stored>
    </property>
</extension>

You can read more about this feature at Retrievers as Configuration section

Integration between Pact Provider and Arquillian Reporter

Now if you have Arquillian Recorder dependency on your classpath and you set @VerificationReports to use recorder as reporting format, the result of the verification of the provider is reported in Arquillian Recorder too.

You can read more about this feature at Arquillian Recorder Reporter integration

PactVerification value is not mandatory

When you want to write a consumer test you need to specify that the method tests a consumer contract by using @PactVerification annotation and setting which provider you are verifying. In case of using @Pact annotation on the class level, this information can be redundant (the value of the annotation). For example you can do:

@RunWith(Arquillian.class)
@Pact(provider="test_provider", consumer="test_consumer")
public class ClientGatewayTest {

  @Test
  @PactVerification
  public void should_return_message() throws IOException {
    assertThat(clientGateway.getMessage(), is("{\"responsetest\": true, \"name\": \"harry\"}"));
  }
}

Notice that now you don’t need to set the provider in @PactVerification annotation since it is retrieved from class level.

Bug fixing

Test does not fail when contract is not verified

If multiple interactions are validated in provider side within same test, Arquillian takes only in consideration the first interaction result as final test result. To fix this a new Arquillian Core has been released (1.1.12). We encourage all users to use Arquillian Core 1.1.12 as the minimum version to avoid this problem. Notice that this also applies to previous versions of Arquillian Pact/Algeron.

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.Alpha5 view tag
Release date 2017-01-05
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.algeron

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

Release notes and resolved issues 6

Enhancement
Bug

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

Arquillian Algeron Extension 1.0.0.Alpha4 Released

The Arquillian team is proud to announce the 1.0.0.Alpha4 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 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 Algeron 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 Algeron Extension 1.0.0.Alpha3 Released

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 Algeron Extension 1.0.0.Alpha2 Released

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