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.sngrekov
05/12/2018, 10:32 AMpatjackson52
05/14/2018, 12:37 AMraniejade
05/14/2018, 8:52 AMMarat Iskhakov
05/15/2018, 2:18 PMrook
05/15/2018, 5:13 PMraniejade
05/22/2018, 6:41 AMmemoized
in https://github.com/spekframework/spek/issues/411, it is basically memoized
under the hood. It feels a bit redundant now since you can also do TCK-like tests with memoized
. Thoughts?robfletcher
05/22/2018, 1:15 PMloginService
would look like. The hole I always found in SubjectSpek
for TCK tests was that it’s not possible to reference dependencies (defined in abstract base spec) in a subject
block in a derived spec. Is that no longer a problem?robfletcher
05/22/2018, 1:16 PMrobfletcher
05/22/2018, 9:11 PMraniejade
05/23/2018, 6:57 AMmemoized
.
object QueueSpecs: Spek({
fun Suite.queueTests() {
val queue by memoized<Queue>()
val clock by memoized<MutableClock>()
val deadletterCallback by memoized<DeadMessageCallback>()
...
}
describe("RedisQueue") {
val clock by memoized { MutableClock() }
val deadLetterCallback by memoized { ... }
val queue by memoized { createQueue(clock, deadLetterCallback) }
queueTests()
}
})
robfletcher
05/23/2018, 3:38 PMdave08
05/30/2018, 5:07 AMrook
06/01/2018, 3:07 PMon
if it’s just a one-off anywaydave08
06/05/2018, 3:54 PMdave08
06/05/2018, 3:59 PMdave08
06/05/2018, 4:03 PMgiven
, but retain that for the on
and the it
dave08
06/05/2018, 4:04 PMevery
on the same function twice gives an error unless the mock is reset...dave08
06/05/2018, 4:05 PMgabriel.pereira.au
06/07/2018, 10:20 AMrobfletcher
06/25/2018, 10:23 PMgildor
06/26/2018, 1:56 AMrobfletcher
06/26/2018, 5:12 PMrobstoll
06/29/2018, 8:10 PMHamza
07/07/2018, 11:24 AManyone able to pitch in why i can't see any symbol for me to run a test? Here are my dependencies:▾
Hamza
07/07/2018, 11:24 AMPasted image at 2018-07-07, 6:24 PM▾
raniejade
07/07/2018, 11:25 AMHamza
07/07/2018, 11:25 AMHamza
07/07/2018, 11:25 AMHamza
07/07/2018, 11:25 AM