Last active
May 11, 2021 08:59
-
-
Save stoichoandreev/b14319197a90129a71e90eacfe0b1020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sniper.bdd.robo.BaseRobot | |
import java.util.concurrent.TimeUnit | |
/** | |
* Use the method to run single unit 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_UNIT_TEST( | |
robot: T, | |
block: TestRun<T>.() -> Unit | |
) : TestRun<T> { | |
val startTime = System.nanoTime() | |
println("*** UNIT TEST start ***") | |
val testRun = TestRun(robot, true) | |
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