All Projects → valfirst → jbehave-junit-runner

valfirst / jbehave-junit-runner

Licence: MIT license
Integrate JBehave better with JUnit. Reports all Stories, Scenarios and Steps as JUnit Suites and Test Cases.

Programming Languages

java
68154 projects - #9 most used programming language
Gherkin
971 projects

Projects that are alternatives of or similar to jbehave-junit-runner

osgi-test
Testing support for OSGi. Includes JUnit 4 and JUnit 5 support and AssertJ support.
Stars: ✭ 22 (-68.57%)
Mutual labels:  junit, junit4
ForgeModdingSkeleton
Skeletons for building Forge mods
Stars: ✭ 21 (-70%)
Mutual labels:  junit, junit4
rules4android
A collection of JUnit 4 Rules for Android Developers 🔬
Stars: ✭ 23 (-67.14%)
Mutual labels:  junit, junit4
parameterized-suite
Provides a new Runner for JUnit 4 that combines the features of Suite and Parameterized
Stars: ✭ 19 (-72.86%)
Mutual labels:  junit, junit4
justtestlah
Dynamic test framework for web and mobile applications
Stars: ✭ 43 (-38.57%)
Mutual labels:  junit, junit4
Resume-Maker
Resume Maker is tool where you can generate your resume for free. It has functionality like dynamic preview, color themes, responsive ,etc.
Stars: ✭ 40 (-42.86%)
Mutual labels:  hacktoberfest2021
instaUnfollow
Check people don't follow you back on Instagram.
Stars: ✭ 50 (-28.57%)
Mutual labels:  hacktoberfest2021
junit-report-rs
JUnit compatible XML reports in Rust
Stars: ✭ 15 (-78.57%)
Mutual labels:  junit
SpotMusicGen
A Program that creates a Spotify playlist from a YouTube Playlist
Stars: ✭ 47 (-32.86%)
Mutual labels:  hacktoberfest2021
Commandline-Games-hacktoberfest
A repository to share command line games. An opportunity to start and learn about open source code contributions flow.
Stars: ✭ 16 (-77.14%)
Mutual labels:  hacktoberfest2021
keycloak-admin-client
PHP Client to connect to Keycloak admin rest apis
Stars: ✭ 57 (-18.57%)
Mutual labels:  hacktoberfest2021
GuildWars2 APIViewer
Guild Wars 2 API Viewer: An Android application used for viewing various Guild Wars 2 API endpoint responses. Developed utilizing MVVM architecture, in conjunction with Databinding, Dagger 2, Retrofit 2, and RxJava 2.
Stars: ✭ 53 (-24.29%)
Mutual labels:  junit4
sunshine
Sunshine allows you to manage suits of your automated tests directly from Java code.
Stars: ✭ 12 (-82.86%)
Mutual labels:  junit4
react-in-out-textarea
A simple React.js User Interface Component that is like Google Translate with full TypeScript Support
Stars: ✭ 28 (-60%)
Mutual labels:  hacktoberfest2021
learn-js
A repo dedicated to the introductory concepts of JavaScript
Stars: ✭ 35 (-50%)
Mutual labels:  hacktoberfest2021
Fenice-Network
Building the job search portal which helps both recruiters and job seekers to get perfect jobs.
Stars: ✭ 20 (-71.43%)
Mutual labels:  hacktoberfest2021
ogrants
Open grants list
Stars: ✭ 96 (+37.14%)
Mutual labels:  hacktoberfest2021
Alfred
A friendly Toolkit for Beginner CTF players
Stars: ✭ 39 (-44.29%)
Mutual labels:  hacktoberfest2021
Frontend-Animations
Frontend Animation Projects.🚀
Stars: ✭ 20 (-71.43%)
Mutual labels:  hacktoberfest2021
Algorithms
A repository by Codechef@MUST for data structures and algorithms
Stars: ✭ 19 (-72.86%)
Mutual labels:  hacktoberfest2021

JBehave JUnit Integration

jbehave-junit-runner CI Coverage Status Quality Gate Codacy Badge Maven Central Javadocs Known Vulnerabilities MIT licensed FOSSA Status

This little project is designed to make JBehave stories & scenarios show up in the JUnit view in Eclipse and potentially other IDEs that support custom test runners.

Installation

The project consists of only a handful of classes and is easy to use.

Using Maven

The easiest way is to include it in your acceptance test project(s) by ways of a Maven dependency. Binary, Sources and Javadocs are all available from Maven Central.

<dependency>
    <groupId>com.github.valfirst</groupId>
    <artifactId>jbehave-junit-runner</artifactId>
    <version>2.3.1</version>
</dependency>

Note that the JBehave library is set to scope provided in the POM, because any project using this Runner will naturally have their own version of JBehave already.

Current development SNAPSHOT versions are available from Sonatype's Nexus for Open Source projects.

Without Maven

If you cannot or do not want to use Maven, just add the library to your classpath.

Also make sure you add the dependencies of this library to the classpath as well. They can be seen in the pom.xml. For convenience, they are listed here, too:

  • jbehave-core (4.1+)
  • junit (4.12)

Your project will of course have JBehave already, just make sure it is version 4.1 or above.

Usage

Once it is on your classpath, the runner can be used to visualize the structure and the successes/failures of your JBehave acceptance tests.

Enabling

You will probably already have one or more classes that extend the default JBehave JUnitStories class. Just add this annotation:

@RunWith(JUnitReportingRunner.class)
public class MyAcceptanceTests extends JUnitStories {
    ...
}

Usually, this is everything you have to do. If you want to, you can use a little helper method to configure the configured Embedder so that it works nicely together with the JUnitReportingRunner.

JUnitReportingRunner.recommendedControls(configuredEmbedder());

This tells JBehave to use only one thread, and don't throw any exceptions when generating views or otherwise wrapping the execution up. This would confuse JUnit considerably, rendering the AfterStories Suite incomplete.

Caveats

There are a few issues you might encounter upon first installation and integration into your project. To alleviate these, the following are a few common pitfalls.

java.lang.NoSuchMethodException: ...storyPaths()

If you run into problems like this

java.lang.NoSuchMethodException: MyAcceptanceTests.storyPaths()
    at java.lang.Class.getDeclaredMethod(Class.java:1937)
    at org.jbehave.scenario.finegrained.junit.monitoring.JUnitReportingRunner.<init>(JUnitReportingRunner.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    ....

you are likely extending a custom base class which was probably introduced to provide some common methods for all your test classes. This is perfectly fine, however in case you pulled up the storyPaths() method into that common base class, you

  1. either need to make it public OR
  2. override it in all descendants of that base class (just calling the super implementation is fine).

This is due to a reflection issue and might be fixed in future versions.

java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription

If you see JUnit throw an error soon after a test starts, that looks like this

java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;
    at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.createDescriptionFrom(JUnitDescriptionGenerator.java:43)
    at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.buildDescriptionFromStories(JUnitReportingRunner.java:152)
    at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.<init>(JUnitReportingRunner.java:73)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    ...

you most probably have an old version of JUnit on your classpath that does not have that method signature yet. Verify that you are using a recent version of JUnit and that it is not hidden by an older version which might hide it by being declared first on the classpath.

Example output

Once you are all set, you use the regular Run As -> JUnit Test command in Eclipse. The JUnit view should appear and display something like this:

Screenshot

Reporting Issues

In case you run into problems or have ideas on how to improve this piece of software, please do not hesitate to open an issue in the issue tracker, here on GitHub.

To make things easier (and quicker) for yourself (and us), please provide the following pieces of information in your ticket:

  • The version you are using (e. g. "1.0.0" or "1.0.1-SNAPSHOT as of 2012-05-25")
  • If possible, a stack trace of the error.
  • Ideally, a limited test case that allows us to reproduce the problem locally. This is indeed the best way to get a bug fixed quickly, because we'll have something specific to work on.
  • Any information about your environment that might be helpful, e. g. your JBehave version, which operating system, etc.

It might also be a good idea to try, if your particular problem has been fixed already in the latest snapshot release.

And, of course, we'd also very much appreciate pull requests for fixes that you have already made yourself. After all, this is where open source shines most :)

Credits

This project is based on the original implementation by Mark Burnett, located at http://code.google.com/p/jbehave-junit-monitor/ which worked with earlier versions of JBehave.

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].