You can use the addStep function to add automatic steps which should be performed. Asserts can also be added as steps.
addStepcreates a step that runs a method. Completes successfully if no exceptions are caught.addRepeatStepTODO creates a step that runs a method a specified amount of times. Completes successfully if no exceptions are caught.addWaitStepTODO adds a step that waits a specified amount of time before continuing to the next step.addAssertcreates a step that fails if the specified value does not return true.addWaitUntiladds a step that attempts to run until a condition becomes true, or fails when it times out.
addStep("Create user") {
user = User("Maya", 22)
}
addStep("Fetch country") {
user.fetchCountryFromIPAddress().thenAccept { country ->
userCountry = country
}
}
addWaitUntil("Wait until country is fetched", timeout = 10.seconds) {
userCountry != null
}
addAssert("Country is Czech Republic") { userCountry == "Czech Republic" }repositories {
maven {
name = "devOS"
url = uri("https://mvn.devos.one/releases")
}
}
dependencies {
implementation("cz.lukynka:astral:0.7")
}