Upgrading
Upgrading from TestBalloon 0.7.x to 0.8.0🔗
Removal of deprecations🔗
- Replace class declarations for top-level test suites with properties.
- Change code using
dispatcherWithParallelism(). - Replace
aroundAllwithtestConfig = TestConfig.aroundAll { ... }. - Replace
testConfigassignments in test suite bodies withtestSuite(..., testConfig = ...). - Replace the
TEST_INCLUDEenvironment variable withTESTBALLOON_INCLUDE_PATTERNS.
Android host-side (unit) tests🔗
- Remove the
-jvmsuffix from each dependency"de.infix.testBalloon:testBalloon-framework-core-jvm:$testBalloonVersion". - Add a dependency on JUnit 4:
"junit:junit:4.13.2"
Custom test functions🔗
Use TestSuiteScope instead of TestSuite🔗
Change extension functions like TestSuite.myCustomTest() to TestSuiteScope.myCustomTest(). This makes them compatible with the new fixture scopes and other custom scopes.
Note
While this change may not be necessary initially (if you do not yet use TestSuiteScope), applying it right away avoids incompatibilities later on. Please change all usages.
Prefer test-level fixtures over custom test functions🔗
The following change is optional, but simplifies your code:
testSuite("Multiple tests with fresh state") {
@TestRegistering
fun test(name: String, action: suspend Service.() -> Unit) =
this.test(name) {
val service = Service().apply {
signIn(userName = "siobhan", password = "ask")
}
service.action()
signOut()
}
test("deposit") {
deposit(Amount(20.0))
assertEquals(Amount(40.99), accountBalance())
}
test("withdraw") {
withdraw(Amount(20.0))
assertEquals(Amount(0.99), accountBalance())
}
}
testSuite("Multiple tests with fresh state") {
testFixture {
Service().apply {
signIn(userName = "siobhan", password = "ask")
}
} closeWith {
signOut()
} asContextForEach {
test("deposit") {
deposit(Amount(20.0))
assertEquals(Amount(40.99), accountBalance())
}
test("withdraw") {
withdraw(Amount(20.0))
assertEquals(Amount(0.99), accountBalance())
}
}
}
TestConfig changes🔗
- Change
TestInvocation.SEQUENTIALtoTestConfig.Invocation.Sequential. - Change
TestInvocation.CONCURRENTtoTestConfig.Invocation.Concurrent. - Change
TestExecutionTraversaltoTestConfig.ExecutionTraversal. - Change
TestExecutionScopetoTest.ExecutionScope.
Other changes🔗
- Change
TestSuite.FixturetoTestFixture. - Change
TestElementEventtoTestElement.Event. - Change
TestPermittoTestConfig.Permit. - Change members of
TestPlatform.Typefrom SCREAMING_SNAKE_CASE to PascalCase.