migrate away from Spek to kotlin-test
We want to move away from Spek as test-runner as we consider this project dead and it makes more and more problems in conjunction with intellij and gradle. Hence, we migrate the tests in atrium-specs to kotlin-test.
see sub-issues. This issue serves to give an overall view what steps need to be done in the sub issues (this way we can refine the steps at a single place):
Following the things you need to do:
first commit
atrium-specs
- [ ] rename XyExpectationsSpec to AbstractXyExpectationsTest
atrium-api-fluent/-infix
- [ ] rename XyExpectationsSpec to XyExpectationsTest
- [ ] if the XyExpectationsTest contains multiple include (such as ShortcutSpec and BuilderSpec) then split the class into two (or more)
git commit -a -m 'rename ...Spec to ...Test to retain history'
second commit
atrium-specs
- [ ] add
@Suppress("FunctionName")aboveabstract class AbstractXyExpectationsTest - [ ] let AbstractXyExpectationsTest extend ExpectationFunctionBaseTest
- [ ] append to parameters with type
Fun/Featurethe suffixSpec(as example renametoContaintotoContainSpec) - [ ] in case the parameters are
Pair<(String -> String), ...>and afterwards assignsecondto a val, then add the suffixSpecto the val (e.g.val toContainExactly = xyPair.second=>val toContainExactlySpec = xyPair.second) - [ ] you can remove the
describePrefix: String = "[Atrium] "parameter (if defined) - [ ] transform the tests (compare AbstractArrayAsListExpectationsTest, AbstractComparableExpectationsTest, or AbstractExtractSubjectTest)
with the ..Spec variant
- [ ] if the Spec contains
include(... SubjectLessSpecrefactor to@TestFactory fun subjectLessTest() = subjectLessTestFactory( - [ ] if the Spec contains
include(... AssertionCreatorSpecrefactor to@TestFactory fun expectationCreatorTest() = expectationCreatorTestFactory( - [ ] replace
unifySignaturewithtestFactoryForFeatureNonFeature(see AbstractCollectionExpectationsTest) - [ ] replace nonNullableCases with testFactoryNonNullable (see AbstractIterableNotToContainValuesExpectationsTest)
- [ ] replace
describe("iterable ${xyz()....}")withdescribeIterable(::xyz) - [ ] replace
contextwithdescribe
- [ ] if the Spec contains
api-fluent
- [ ] if the XyExpectationsTest is an
objectthen useclassinstead - [ ] let XyExpectationsTest extend AbstractXyExpectationsTest and adapt
- [ ] rewrite ambiguityTest:
- add
@Testand removeprivate(if private) - use a proper
expect(...)instead ofnotImplemented() - make sure the expectations stated hold (introduce further
var .. .= expect()if necessary) - Remove explicit type parameters in
funX<...>(they used to be necessary but should no longer, was fixed in Kotlin)
- add
- [ ] if there is no ambiguityTest, then add the following (this way intellij shows the run gutter for this class):
@Test fun trigger_run_gutter() = Unit
- [ ] rewrite ambiguityTest:
api-infix
- [ ] if the XyExpectationsTest is an
objectthen useclassinstead - [ ] let XyExpectationsTest extend AbstractXyExpectationsTest and adapt
- [ ] rewrite ambiguityTest:
- add
@Testand removeprivate(if private) - use a proper
expect(...)instead ofnotImplemented() - make sure the expectations stated hold (introduce further
var .. .= expect()if necessary) - Remove explicit type parameters in
funX<...>(they used to be necessary but should no longer, was fixed in Kotlin)
- add
- [ ] if there is no ambiguityTest, then add the following (this way intellij shows the run gutter for this class):
@Test fun trigger_run_gutter() = Unit
- [ ] rewrite ambiguityTest:
@hubtanaka, @ragul-engg, @shytnik-igor, @vlsi, @wordhou I could use your help migrating one of those, feel free to assign an issue to yourself if you have time and are in the mood 🙂