-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I believe the current DSL can be improved. E.g.:
class StatefulTest extends TestSuite with State:
setup:
- "an empty cart" Cart() as "myCart":
- "another empty cart" Cart() as "anotherCart":
where:
- tabular:
+
* | "beachChair" | "sunScreen" | "total":
-
"quantity" | 2 | 3 | 5 :
"price" | 2 | 3 | 5 :
then:
- sequentially:
- "add two items" using "myCart" '{_.add(CartItem("Beach chair", data["beachChair"]["quantity"]))}:
- parallelly:
- ....
- ....
- sequentially:
- ....
- ....
- "add another three items" '{state["myCart"].add(CartItem("Sunscreen", data["sunScreen"]["quantity"]))}:
expect:
- "contains 5 items" '{state["myCart"].totalQuantity == data["total"]["quantity"]} and:
- "costing" using "myCart" '{_.totalPrice == data["total"]["price"]}:
lastly:
- "do some cleanup" using (_.close())For table tests can they be specified like:
class MaxTest extends TestSuite with Stateless:
expect:
- "Max of a and b" '{ Math.max(data["a"], data["b"]) == data["c"] }
where:
- tabular:
+
| "a" | "b" | "c":
-
| 1 | 3 | 3 :
| 7 | 4 | 7 :
| 0 | 0 | 0 :Metadata
Metadata
Assignees
Labels
No labels