raniejade
05/12/2018, 10:12 AM2.x.
Firstly, dependency group id and package prefix is now org.spekframework.spek2. Idea is to allow running 1.x and 2.x tests side-by-side.
For DSLs, we decided to split it into two styles (https://github.com/spekframework/spek/issues/374): Specification (rspec, Jasmine - https://github.com/spekframework/spek/issues/394) and Gherkin styles (https://github.com/spekframework/spek/issues/396). A glimpse of the two styles below:
class SetSpec: Spek({
describe("a set") {
val mySet by memoized { ... }
context("when empty") {
it("should have a size of 0") { ... }
it("should throw an NoSuchElementException when ...") { ... }
}
}
})
class MyFeatureSpec: Spek({
Feature("My Feature") {
val myFeature by memoized { ... }
Scenario("Some scenario") {
Given("some precondition") { ... }
And("another precondition") { ... }
When("some action") { ... }
And("another action") { ... }
Then("some testable outcome") { ... }
And("another testable outcome") { ... }
}
}
})
The DSLs are built on top of Spek core (group, action and test), this means that you can implement your own DSL.
On the IDE side, there will be a new IntelliJ Plugin. We have introduced (https://github.com/spekframework/spek/issues/246) several meta annotations for IDE consumption. Marking an extension method with @Synonym will tell the plugin that said method is runnable. Making describe runnable in the IDE for example:
@Synonym(SynonymType.GROUP)
@Descriptions(Description(DescriptionLocation.VALUE_PARAMETER, 0))
fun GroupBody.describe(description: String, pending: Pending = <http://Pending.No|Pending.No>, body: Suite.() -> Unit) {
createSuite(description, pending, body)
}
Lastly, another major goal for 2.x is to prepare for multiplatform support. We have separated the core parts of Spek into a common module and platform specific code (runners for example) into its own module.
Everything that I have mentioned, except for the DSL changes, are in the 2.x branch already. Running common module tests from Gradle is already supported, see https://github.com/spekframework/spek/tree/2.x/integration-test. The IntelliJ plugin will also support it (with some limitations) once https://github.com/spekframework/spek/pull/407 lands.
Finally, I'm very sorry for the delays, there has been a lot of changes in my life these past few months that I had to prioritize first.