iamsteveholmes
11/05/2015, 8:17 PMhastebrot
11/05/2015, 9:28 PMhastebrot
11/05/2015, 10:16 PMhastebrot
11/05/2015, 10:16 PMafterOn()
in https://github.com/JetBrains/spek/issues/39hastebrot
11/05/2015, 10:17 PMclass FooSpec : Spek() { init {
given("") {
beforeOn { print("1") }
on("") {
print("2")
it("") {
print("3a")
}
it("") {
print("3b")
}
}
}
}}
this outputs "123a3b" (and something with teamcity[...]
), but should output "123a123b" (or "123b123a" 😃).hastebrot
11/05/2015, 10:21 PMhastebrot
11/05/2015, 11:28 PMRunner
needs to know at least the name of the first test within the suite or it will create a test description and name it <no name>
.hastebrot
11/06/2015, 3:41 AMhastebrot
11/06/2015, 3:49 AMvalue
should be 1
or 11
within the `test()`s.
In case of 1
it would need to
- first run the upper part of suite("define suite)
,
- then suiteSetup()
,
- then test("define foo test")
- and then the lower part of suite("define suite")
.
I personally think the bevavior with value == 1
is better and suiteCleanup()
should handle the teardown. But it could be the case, that we need to stick to the value == 11
behavior, because some lambdas within suite("define suite")
have to be evaluated first.hastebrot
11/06/2015, 4:23 AMhhariri
di3mex
11/06/2015, 5:35 PMiamsteveholmes
11/06/2015, 5:53 PMhastebrot
11/06/2015, 7:36 PMI think the idea of spek is to have a native-to-kotlin specification testing libraryyeah, Spock uses a lot of "magic" syntax. AST transformations for
when:
, then:
and mock()
and Spek uses extension functions, which are easier to handle implemenation-wisehastebrot
11/06/2015, 7:39 PMSpecification
classes is a bit restrictivehastebrot
11/06/2015, 7:40 PMwhere:
to repeat cases) could also be an advantagedi3mex
11/06/2015, 8:03 PMiamsteveholmes
11/06/2015, 11:05 PMiamsteveholmes
11/09/2015, 4:20 PMiamsteveholmes
11/09/2015, 4:20 PMhastebrot
11/09/2015, 11:25 PMSpecification
, Given
, On
, It
. they are necessary in combination with function extensions (T.() -> Unit
) to express the hierarchical structure of specifications. their implementations also store recordedActions
, beforeActions
, afterActions
. in the prototype I build I wanted to use a traversable, hierarchical data structure Node<T>
and find a way to populate()
it from the specification and transform()
it so that a call to traverse()
is only required to "execute" the suites and tests in correct order. which means the "actions" are stored in the tree structuren differently and we can remove subtrees to get rid of allocated memory.hastebrot
11/09/2015, 11:26 PMNode
. it is also possible to propagate and transform the tree Node
after Node
. this is required because propagating a subtree means we also execute some parts of the specification itself.iamsteveholmes
11/10/2015, 3:03 PMGiven
, On
, It
Nodes or describe
nodes depending on your tastehastebrot
11/11/2015, 10:27 AMit()
or Mocha's `describe()`/ it()
) or even reflection (for @mhshams proposed scenario methods) and define rules how to populate()
the tree and how to transform()
it. then traverse()
will provide something like a visitor pattern and provide information which kind of node it is (SPEK_GIVEN
, SPEK_ON
, ...).Czar
11/11/2015, 10:28 AMhastebrot
11/11/2015, 2:41 PMwhere:
block.hastebrot
11/11/2015, 2:53 PMgiven("...") {
given("...") {}
}
and direct assertions (like Spock's expect:
)
given("...") {
it("...") {}
}
are not supported.hastebrot
11/11/2015, 3:03 PMgiven()
expression it is possible to call another given()
, but this expression will be ignored.jkbbwr
11/17/2015, 1:06 PMjkbbwr
11/17/2015, 1:06 PM