Skip to content

Instantly share code, notes, and snippets.

@stoichoandreev
Last active May 11, 2021 08:58
Show Gist options
  • Save stoichoandreev/d9f737212113aed10af3c3af2d8e3844 to your computer and use it in GitHub Desktop.
Save stoichoandreev/d9f737212113aed10af3c3af2d8e3844 to your computer and use it in GitHub Desktop.
import com.sniper.bdd.robo.BaseRobot
import java.util.concurrent.TimeUnit
/**
* Use the method to run single UI test
* @param robot - Set your test robot (should extend BaseRobot)
* @param block - the block of code which needs to be executed in our test. Usually we need to place inside all steps for the test
* @return - TestRun data class instance, which includes the test name and the robot instance
*/
fun <T: BaseRobot>RUN_UI_TEST(
robot: T,
block: TestRun<T>.() -> Unit
) : TestRun<T> {
val startTime = System.nanoTime()
println("*** UI TEST start ***")
val testRun = TestRun(robot, false)
block(testRun)
val difference = System.nanoTime() - startTime
println("*** time -> ${ TimeUnit.NANOSECONDS.toMillis(difference) } ms ***")
println("-----------------------------------------------------------------------------------------------")
return testRun
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment