Cucumber-JVM Upgrade

A troubleshooting note on fixing broken Cucumber HTML report generation by upgrading interdependent Cucumber-JVM libraries together. It documents the required dependency updates and runner annotation changes needed to restore successful test execution.

Coveros Staff

September 16, 2013

I recently ran into an issue when compiling my html friendly cucumber reports. For larger tests run, when attempting to view the reports generated in the cucumber-html-report, the screen appeared blank. After some debugging, I noticed that the reports.js file generated was abruptly terminated. The true cause of the issue is still unknown; my best guess is it was a sizing limitation due to memory utilization, or possibly something else.

Solution

Upon some more Google searching, I noticed that the version of cucumber-html.jar I was not the latest. I upgraded my jar from 0.2.2 to 0.2.3, hoping this might resolve my error. Unfortunately, this caused all of my tests to stop working, as there were some interdependencies. In addition to that one jar being upgraded, the below files were also upgraded to the specified version.

  • gherkin-2.12.1
  • cucumber-junit-1.1.5
  • cucumber-java-1.1.5
  • cucumber-core-1.1.5

Additionally, the jar cucumber-jvm-deps needs to be added. I used version 1.0.3. Finally, I had to update my cucumber runner which kicked off all of my tests. The ‘json-pretty’ format is no longer supported, and needs to be removed. The @Cucumber.Options is deprecated, and can be replaced with @CucumberOptions.

package dental.delta.definitions;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
	features = {"src/comix/cosmic/features/CheckTitles.feature"},
		glue = {"comix.cosmic.definitions"},
		format = {"pretty",
			"html:target/cucumber-html-report",
			"junit:target/cucumber-junit-report/allcukes.xml"},
		tags = {"@Smoke"}
)

public class CucumberTestRunner {
}

After all of these changes my test runs returned to normal, and the output files were generated as expected. As my tests continue to grow, I will continue to monitor this issue, and hopefully the issue will remain resolved.

Coveros Staff

Coveros Staff

This post represents the collective insights of the Coveros team. Our staff consists of software experts who bring deep experience in secure agile development, DevOps, testing, and software quality. Over the past 20 years, Coveros has trained more than 30,000 professionals and worked with half of the Fortune 100 companies on mission-critical software development challenges. We draw on this extensive experience to share practical insights, proven strategies, and real-world solutions that help organizations build better software faster and more securely.