https://github.com/hgcummings/jarspec
RSpec (or Jasmine/Mocha) style tests for native Java 8
https://github.com/hgcummings/jarspec
java test-automation test-driven-development test-framework test-runner testing testing-framework testing-tools
Last synced: 6 months ago
JSON representation
RSpec (or Jasmine/Mocha) style tests for native Java 8
- Host: GitHub
- URL: https://github.com/hgcummings/jarspec
- Owner: hgcummings
- License: mit
- Created: 2014-07-12T00:20:37.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-09-16T07:11:06.000Z (almost 9 years ago)
- Last Synced: 2025-07-24T00:56:17.350Z (11 months ago)
- Topics: java, test-automation, test-driven-development, test-framework, test-runner, testing, testing-framework, testing-tools
- Language: Java
- Homepage:
- Size: 802 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 
## What?
[RSpec](http://rspec.info/) (or [Jasmine](http://jasmine.github.io/2.0/introduction.html)/[Mocha](http://mochajs.org/)) style tests for native Java 8, a bit like the following:
```java
@RunWith(JarSpecJUnitRunner.class)
public class MinimalSpec implements Specification {
@Override
public SpecificationNode root() {
return describe("This specification",
it("contains a statement with a test", () -> assertTrue(true))
);
}
}
```
## Why?
Allows for more expressive test names without very_long_underscore_ridden_test_method_names, and for more flexible test structure. Java 8 features such as lambda expressions make this possible with less boilerplate. See [wiki/Motivation](https://github.com/hgcummings/jarspec/wiki/Motivation) for more.
## How?
1. Add JarSpec to your project dependencies. See below for Maven and [the dependency info page](http://hgc.io/jarspec/2.0.0/dependency-info.html) for other build tools.
2. Start writing specs! See [wiki/Implementing Specifications](https://github.com/hgcummings/jarspec/wiki/Implementing-Specifications) for more details, or the [project's own tests](https://github.com/hgcummings/jarspec/tree/master/src/test/java/io/hgc/jarspec) for examples.
### Using Maven [](http://search.maven.org/#search|gav|1|g:"io.hgc"%20AND%20a:"jarspec")
Add the dependency to your pom:
```xml
....
io.hgc
jarspec
2.0.0
test
....
```
Configure SureFire to pick up classes named `*Spec` (although you can stick with the default `*Test` convention if you prefer):
```xml
...
org.apache.maven.plugins
maven-surefire-plugin
2.20
**/*Spec.java
...
```
## When?
The current release on Maven Central is stable. See [open milestones](https://github.com/hgcummings/jarspec/milestones) for further planned features. Releases numbers follow the [Semantic Versioning](http://semver.org/) specification for backwards compatibility.
---
###### Developer resources: [Test results](http://hgc.io/jarspec/2.1.0-SNAPSHOT/surefire-report.html) [](https://travis-ci.org/hgcummings/jarspec) [Coverage report](http://hgc.io/jarspec/2.1.0-SNAPSHOT/jacoco/index.html) [](https://coveralls.io/r/hgcummings/jarspec?branch=master) [Task board](https://huboard.com/hgcummings/jarspec)