Upgrading to Cucumber Web Bridge 1.1.0.RELEASE

If you want to upgrade to CWB 1.1.0.RELEASE a couple of things you need to take into account.  1.1 is the new development main line, 1.0 (CTF) will no longer be supported.

Library changes

  • Packages have been renamed and restructured to allow for separate modules, Maven artifacts have been renamed as well.
    • Important for custom steps: AbstractSteps has been split into AbstractCoreSteps and AbstractSahiSteps.  Migrating old SAHI based projects probably should switch to AbstractSahiSteps.
  • Standard step classes are now available as beans so you can more easily reuse steps
  • Separate package to allow for REST webservice testing
  • Upgraded dependency on Cucumber 1.1.8 and Spring framework 4
  • More debug logging output possible with the special ConsoleReporter and IntelliJReporter

The new maven artifacts you should use:

<dependency>
	<groupId>com.foreach.cwb</groupId>
	<artifactId>cwb-core</artifactId>
	<version>1.1.O.RELEASE</version>
	<scope>test</scope>
</dependency>
<!-- Only include SAHI if you want to use SAHI steps -->
<dependency>
	<groupId>com.foreach.cwb</groupId>
	<artifactId>cwb-sahi</artifactId>
	<version>1.1.O.RELEASE</version>
	<scope>test</scope>
</dependency>
<!-- Only include REST if you want to use the REST webservice tests -->
<dependency>
	<groupId>com.foreach.cwb</groupId>
	<artifactId>cwb-rest</artifactId>
	<version>1.1.O.RELEASE</version>
	<scope>test</scope>
</dependency>

IntelliJ IDEA integration

Upgrade to IntelliJ 13 (the community edition should work).  It is no longer necessary to add the library as sources in your IntelliJ project.  Sometimes IntelliJ 13 does not detect the right glue when running a scenario or feature, and if you want to use the new IntelliJReporter for extended logging you must put it manually in the run configuration as well.

We have built a custom version of the IntelliJ cucumber-java plugin that should help overcome these issues, it is attached in a zip file to this blog post. This is a work in progress, but it would be handy if people could test drive it.

Installing the custom plugin
  • Shutdown IntelliJ
  • Download the cucumber-java.zip file and unzip in ${user.home}\.IntelliJIdea13\config\plugins
  • Start Intellij, when going to Settings -> Plugins and looking for cucumber, you should see Cucumber for Java installed with version 1000.1
Configuring the run configuration

The custom plugin allows you to specify a glue and formatter in the default configuration, these will then automatically be used when creating a new run configuration (possibly you have to delete existing ones).

Maven build script

You can remove the section related to maven-dependency-plugin since this is obsolete with IntelliJ 13.  You can also remove the test sources source.jar from your IntelliJ project.

The integration-test script should be modified to include the right glue (com.foreach.cuke) and use the new ConsoleReporter.  The latter will give you extended logging on the build server.

Note that the Maven builds recently switched to using a forked process due to encoding issues. Do not forget to pass all necessary system properties to the forked process.

Example maven task for project with additional glue
 <plugin>
	<artifactId>maven-antrun-plugin</artifactId>
	<version>1.7</version>
	<executions>
		<execution>
			<phase>integration-test</phase>
			<configuration>
				<tasks>
					<java classname="cucumber.api.cli.Main" fork="yes">
						<!-- Respect UTF-8 encoding AND fork the cucumer JVM http://confluence.projects.foreach.be/x/ngGNAQ -->
						<sysproperty key="file.encoding" value="UTF-8"/>
						<sysproperty key="environment" value="${environment}"/>
						<sysproperty key="browser" value="${browser}"/>
						<sysproperty key="nopause" value="${nopause}"/>
						<classpath refid="maven.test.classpath"/>
						<arg line="--format com.foreach.cuke.core.formatter.ConsoleReporter"/>
						<arg line="--format html:${project.build.directory}/cucumber/${report.output.dir}plain-html-reports"/>
						<arg line="--format junit:${project.build.directory}/cucumber/${report.output.dir}cucumber-report.xml"/>
						<arg line="--format json:${project.build.directory}/cucumber/${report.output.dir}cucumber-report.json"/>
						<arg line="--glue com.foreach.cuke"/>
						<arg line="--glue be.mediafin.tests"/>
						<arg line="--tags ~@ignore"/>
						<arg line="--tags ${tags}"/>
						<arg line="${project.basedir}/features/${features}"/>
					</java>
				</tasks>
			</configuration>
			<goals>
				<goal>run</goal>
			</goals>
		</execution>
	</executions>
</plugin>