0

I have been very much confused about the ways I can make my code to traverse a graph for Model Based Testing using graphwalker.

I have constructed a graph (e2e.graphml) using yEd and I have copied that file to my project in Eclipse. I have also created an interface with the methods for every edge and vertex. Next, I have created an implementation class for my interface in which I have provided little functionality that needs to be performed while traversing that edge or vertex. Next, I have executed a functional test as follows:

@Test()
public void runFunctionalTest() throws IOException {
    Context context = new MyClass();
    TestBuilder builder = new TestBuilder().setContext(context);
    builder.setModel(MODEL_PATH);
    context.setPathGenerator(new RandomPath(newReachedVertex("v_Success")));
    builder.setStart("v_Start");
    builder.execute();
}

Here, MODEL_PATH is the variable I have used to provide the location or path to my yEd file. Whenever I run this test, none of the edges or the vertex are traversed and it the error log is as follow:

java.lang.NullPointerException
at org.graphwalker.core.condition.ReachedStopConditionBase.validate(ReachedStopConditionBase.java:52)
at org.graphwalker.core.condition.ReachedStopConditionBase.setContext(ReachedStopConditionBase.java:48)
at org.graphwalker.core.generator.PathGeneratorBase.setContext(PathGeneratorBase.java:49)
at org.graphwalker.core.machine.ExecutionContext.setPathGenerator(ExecutionContext.java:179)
at gw.MyClass.runFunctionalTest(MyClass.java:277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

It gives error while generating path. Please help if I am implementing something in a wrong manner. Thanks!!

Dorin
  • 2,482
  • 2
  • 22
  • 38
Mahi
  • 1
  • 1
  • Can you share e2e.graphml? – Dorin Jan 04 '19 at 10:16
  • I recommend you run graphwalker offline with the graphml file. Start in the beggining with a very simple file with 2 nodes and make it work. `java -jar graphwalker-cli-3.4.2.jar offline --model e2e.graphml "random(edge_coverage(100))"` – Dorin Jan 04 '19 at 10:18

0 Answers0