Predefined path execution

36 views
Skip to first unread message

Anatoli Tsoi

unread,
Dec 7, 2023, 8:43:27 AM12/7/23
to GraphWalker
Hi there!

In my project when test fails we save the executionPath to be able to reproduce fails. 

But I haven't found any specific ways to reproduce execution of specific path (let's say sequence of elements' names).

Is there any in build mechanism to run my tests using execution path? 

class SomeTest() : BaseTest() {
private val startModelPath: Path = Paths.get("./src/test/resources/graphwalker/com/astraeus/models/StartModel.json")
private val profileModelPath: Path = Paths.get("./src/test/resources/graphwalker/com/astraeus/models/ProfileModel.json")

@Test
@TestRailCase("123123")
fun test() {
val elements: MutableList<String> = mutableListOf(
"v_AppIsOff",
"e_RunApp",
"v_MainPage",
"e_GoToProfile",
"v_ProfilePage",
"v_ProfilePage",
"e_GoToNotifications"
)
val startModel = StartModelImplementation(application)
val profileModel = ProfileModelImplementation(application)

TestBuilder()
.addContext(startModel, startModelPath, DebugGenerator(DebugCondition(elements)))
.addContext(profileModel, profileModelPath, DebugGenerator(DebugCondition(elements)))
.execute()
}
}

Kristian Karl

unread,
Dec 8, 2023, 3:39:02 AM12/8/23
to GraphWalker
Hi Antoli,

Yes, it's possible.
Have a look at the wiki article  predefined_path( predefined_path )

Kristian Karl

unread,
Dec 8, 2023, 7:37:20 AM12/8/23
to GraphWalker
There is a 2nd way of achieving the same. It is maybe easier to use.
  • When graphwalker is executing a test that fails, have a look for what seed was being used.
    java -jar graphwalker-cli-4.3.1.jar -d INFO offline -g etClinic.json
    {"currentElementName":"e_StartBrowser"}

    13:30:32.341 [main] INFO org.graphwalker.core.generator.SingletonRandomGenerator - Seed: 15759390000698
    :
  • Note the -d INFO added to the command line. This will print out the number used to seed the random generator.
    If that seed is re-used like:
    java -jar graphwalker-cli-4.3.1.jar -d INFO offline --seed 15759390000698 -g PetClinic.json  
    13:34:11.548 [main] INFO org.graphwalker.core.generator.SingletonRandomGenerator - Seeded: 15759390000698
    {"currentElementName":"e_StartBrowser"}
    :
  • This will make graphwalker generate the same path.
    See How to seed your test



Reply all
Reply to author
Forward
0 new messages