Description
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 alternatives and similar libraries
Based on the "Testing" category.
Alternatively, view Spectrum alternatives based on common mentions on social networks and blogs.
-
Apache JMeter
Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services -
TestContainers
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. -
MockServer
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding). -
PowerMock
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable. -
Pact JVM
JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project. -
Scott Test Reporter
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java -
pojo-tester
Java testing framework for testing pojo methods. It tests equals, hashCode, toString, getters, setters, constructors and whatever you report in issues ;)
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Spectrum or a related project?
README
Spectrum
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](docs/junit-screenshot.png)
<!---freshmark main output = input.replace(/\b\d+.\d+.\d+\b/g, '{{stableVersion}}'); -->
Getting Started
Spectrum 1.2.0 is available as a package on JCenter and Maven Central.
Examples
Spectrum supports Specification-style tests similar to RSpec and Jasmine:
@RunWith(Spectrum.class)
public class Specs {{
describe("A list", () -> {
List<String> list = new ArrayList<>();
afterEach(list::clear);
it("should be empty by default", () -> {
assertThat(list.size(), is(0));
});
it("should be able to add items", () -> {
list.add("foo");
list.add("bar");
assertThat(list, contains("foo", "bar"));
});
});
}}
And also Gherkin-style tests similar to Cucumber:
@RunWith(Spectrum.class)
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'", () -> {
list.get().add("foo");
});
and("you add the item 'bar'", () -> {
list.get().add("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](./CONTRIBUTING.md).
<!---freshmark /main -->
*Note that all licence references and agreements mentioned in the Spectrum README section above
are relevant to that project's source code only.