A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.
Clone or download
Latest commit ca1ff62 Mar 26, 2018



Build Status Codecov MIT License Download Gitter

A colorful BDD-style test runner for Java

Spectrum is inspired by the behavior-driven testing frameworks Jasmine and RSpec, bringing their expressive syntax and functional style to Java tests. It is a custom runner for JUnit, so it works with many development and reporting tools out of the box.

Spectrum with Eclipse via JUnit

Getting Started

Spectrum 1.2.0 is available as a package on JCenter and Maven Central.


Spectrum supports Specification-style tests similar to RSpec and Jasmine:

public class Specs {{

  describe("A list", () -> {

    List<String> list = new ArrayList<>();


    it("should be empty by default", () -> {
      assertThat(list.size(), is(0));

    it("should be able to add items", () -> {

      assertThat(list, contains("foo", "bar"));


And also Gherkin-style tests similar to Cucumber:

public class Features {{

  feature("Lists", () -> {

    scenario("adding items", () -> {

      Variable<List<String>> list = new Variable<>();

      given("an empty list", () -> {
        list.set(new ArrayList<>());

      when("you add the item 'foo'", () -> {

      and("you add the item 'bar'", () -> {

      then("it contains both foo and bar", () -> {
        assertThat(list.get(), contains("foo", "bar"));



For more details and examples, see the documentation.

Can I Contribute?

Yes please! See CONTRIBUTING.md.