2 ms·
This seems a bit too fluent, but most Testing APIs for Java and C# seem to be heavily into fluent styles (everyone else seems to avoid them). I'm designing an
by seanmcdirmid 5y ago
This seems a bit too fluent, but most Testing APIs for Java and C# seem to be heavily into fluent styles (everyone else seems to avoid them).
I'm designing an internal library myself that does the same thing using Kotlin's EDSL support (you can specify the "this" type of a function) and splits test logic up into required, act, and provided blocks. E.g.
required {
// will be made true for test
check(something)
}
act {
// the act under test
click(someButton)
}
provided {
// will be verified for test
check(something)
}
The interesting thing here is that the polarity of the required and provided blocks can be flipped (check the required is true, and if it is make the provided true) to do fakes/mocks. Well, it is still something I'm working on.
- weitzj 5y agoSounds like the Testing Robots Pattern which I first heard from Jake Wharton. Looks really nice https://jakewharton.com/testing-robots/ https://jakewharton.com/testing-robots/