graphwalker / graphwalker-project Goto Github PK
View Code? Open in Web Editor NEWThis is the repo for the Model-based testing tool GraphWalker.
Home Page: http://graphwalker.org
License: MIT License
This is the repo for the Model-based testing tool GraphWalker.
Home Page: http://graphwalker.org
License: MIT License
Redirect graphwalker.org to graphwalker.github.io
I don't think that Travis has java 8 for openjdk available I guess.
https://travis-ci.org/GraphWalker/graphwalker-project/jobs/44332675
The unit tests that verifies empty strings starts failing.
A null pointer exception is generated when building a model read from json, using GSON.
Attached patch will generate the problem.
My guess is that new vertices are created from the source and target vertices in edges. They are 'duplicated', and thus do not match the vertices in the vertex list kept by the model.
We need to be abled to exclude models from source generation. The maven plugin graphwalker-maven-plugin has no exclude functionality. (Am I right?) This is needed, when we test incorrect model files, as we do in the cli module.
Testing the graphwalker-cli module today generates following build errors (look for ERROR):
[krikar@localhost graphwalker-cli]$ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphWalker Command Line Interface 3.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- license-maven-plugin:1.6:check-file-header (check-license) @ graphwalker-cli ---
[INFO] Will search files to update from root /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src
[INFO] Will search files to update from root /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/target/generated-sources
[INFO] - adding license header on file /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src/test/resources/json/SmallModel.json
[INFO] Scan 19 files header done in 87.329ms.
[INFO]
* uptodate header on 18 files.
* add header on 1 file.
[INFO]
[INFO] --- license-maven-plugin:1.6:update-file-header (update-license) @ graphwalker-cli ---
[INFO] Will search files to update from root /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src
[INFO] Will search files to update from root /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/target/generated-sources
[INFO] Scan 18 files header done in 31.317ms.
[INFO] All files are up-to-date.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ graphwalker-cli ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ graphwalker-cli ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- graphwalker-maven-plugin:3.2.0-SNAPSHOT:generate-test-sources (generate-test-sources) @ graphwalker-cli ---
[INFO] Error: Generate /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src/test/resources/graphml/IncorrectModels/singleVertex.graphml
[ERROR] extraneous input '1' expecting {<EOF>, '/', 'BLOCKED', 'REQTAG', NestedBrackets, Identifier}, in string '1_badName'
[INFO] Error: Generate /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src/test/resources/graphml/IncorrectModels/badEdgeName.graphml
[ERROR] no viable alternative at input '1', in string '1_badName'
[INFO] Error: Generate /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src/test/resources/graphml/IncorrectModels/badVertexName.graphml
[ERROR] no viable alternative at input '1', in string '1'
[INFO] Error: Generate /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/src/test/resources/graphml/IncorrectModels/wrongVertexSyntax.graphml
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ graphwalker-cli ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 18 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ graphwalker-cli ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ graphwalker-cli ---
[INFO] Surefire report directory: /home/krikar/dev/mbt/gw3/graphwalker-project/graphwalker-cli/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.graphwalker.cli.IncorrectModelsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.582 sec
Running org.graphwalker.cli.IOErrorsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.477 sec
Running org.graphwalker.cli.WebSocketServerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.512 sec
Running org.graphwalker.cli.CorrectModelsTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.128 sec
Results :
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.692s
[INFO] Finished at: Wed Dec 17 08:14:03 CET 2014
[INFO] Final Memory: 62M/687M
[INFO] ------------------------------------------------------------------------
[krikar@localhost graphwalker-cli]$
Is it possible during the execution access the coverage metrics?! Will be great to publish that in logs during the execution.
These 2 tests fails:
Full exception log:
org.graphwalker.io.factory.ContextFactoryException: No suitable context factory found
at org.graphwalker.io.factory.ContextFactoryScanner.get(ContextFactoryScanner.java:84)
at org.graphwalker.io.factory.ContextFactoryScanner.get(ContextFactoryScanner.java:74)
at org.graphwalker.io.factory.ContextFactoryScannerTest.dot(ContextFactoryScannerTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
org.graphwalker.io.factory.ContextFactoryException: No suitable context factory found
at org.graphwalker.io.factory.ContextFactoryScanner.get(ContextFactoryScanner.java:84)
at org.graphwalker.io.factory.ContextFactoryScanner.get(ContextFactoryScanner.java:74)
at org.graphwalker.io.factory.ContextFactoryScannerTest.graphml(ContextFactoryScannerTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
When running a test, it should be possible to connect to the test using websocket and get the models associated wit the test visualized in studio. This is already possible today as from PR 85 (#85)
Nest task would be to enable a user to pause an execution from Studio. Also to step, and make it run normally, and slow it down using the "Execution Delay" slider.
There are some tests that really verifies IO specific features, and thus should be in that module.
Some of our models use hashmaps and arraylists. I don't understand how the syntax changed between v2.6.2 and v3.2.1. For example, the following works fine in the earlier version but not in the latter:
eA / List myArrayList = new ArrayList();
eB [ !myArrayList.contains("Cat") ] / myArrayList.add("Cat");
Load multiple models and start executing GraphWalker using the REST API.
When calling getStatistics, it will only return stats for one model, not all of them.
It might be nice if we modified the Model class so that we could easily build variations on a common model for testing purposes. i.e. something like this:
Model baseModel = new Model()
.addEdge(edge1)
Model firstVariant = baseModel.but().withEdge(edge2); // model with edges 1 and 2
Model secondVariant = baseModel.but().withEdge(edge3); // model with edges 1 and 3
The method naming doesn't have to be like this, it's just what I'm familiar with. Let's discuss and then I could potentially make a separate pull request for that.
By the way, the idea for this comes from this blog post.
Use cases for how to work with GW should be properly documented.
We have some tests, that arguably could be moved out of the maven test build lifecycle.
The unit tests should be fast. We have some tests that takes seconds to run, rather than milliseconds.
I have a suggestion, that we move those specific tests to a different build lifecycle, "mvn verify".
This would allow us to have and create longer running tests, but still have fast unit tests.
@nilols are you ok that I move those slow tests into the verify cycle? On the Travis CI side, the the verify cycle would be mandatory for a build to pass.
When running selftest.graphml
from Studio and using Quick random path generator, the execution sometimes get's in a infinite loop, with these 2 elements.
When running from command line:
gw offline -m selftest.graphml "quick_random(edge_coverage(100))"
it works as expected.
Hi!
In the previous version of GraphWalker, there were command line options for generating stubs for the tests. Where are those options now?
Hi,
I am trying to integrate Graphwalker machine based model based testing for a python based web application.
I have downloaded jar - dev standalone CLI - branch 3.2.1 from link provided in documentation and started GraphWalker with command java -jar graphwalker-3.2.1.jar -d ALL online -p 8887.
Per API documentation, for a getNext request the following response is expected
Request:
{
"type": "getNext"
}
Response:
{
"type": "getNext",
"id": "Element id",
"name": "Element name"
"success": boolean,
"msg": "If success is false, a message will returned",
}
But upon testing this in http://www.websocket.org/echo.html I am getting the following response from graphwalker machine
SENT: {"type":"getNext"}
RESPONSE: {"visitedCount":1,"id":"e0","type":"visitedElement"}
RESPONSE: {"success":true,"type":"getNext"}
full trace:
RESPONSE: {"success":true,"type":"loadModel"}
SENT: {"type":"start"}
RESPONSE: {"success":true,"type":"start"}
SENT: {"type":"hasNext"}
RESPONSE: {"success":true,"hasNext":true,"type":"hasNext"}
SENT: {"type":"getNext"}
RESPONSE: {"visitedCount":1,"id":"e0","type":"visitedElement"}
RESPONSE: {"success":true,"type":"getNext"}
Could you please let me know if I am missing some thing.
Thanks in advance.
Cheers,
Ravi
Epic for the webeditor implementation
Checking out the repository from the drive root:
c:
cd \
git clone https://github.com/GraphWalker/graphwalker-project.git
results in an error because a file name is too long for Windows:
fatal: cannot create directory at 'graphwalker-studio/src/main/webapp/scripts/tags/node_modules/riot/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/braces/node_modules/expand-range/node_modules/fill-range/node_modules/is-number': Filename too long
This problem occurs on a Windows 8 system.
Improve the feedback from GW to a user.
Simplifying for eulerization for example
Is it possible to print execution plan without running the tests? Just for making possible a confirmation that graph stop conditions are reachable?!
I have a graph in which specific route should be executed only on the last loop/cycle. Is it possible to hint graphwalker to point that specific edge/vertex should stay last in list of possible selections for next step, especially if in graph still exists untouched edges or vertexes.
The TestBuilder::execute always returns nullsince it's hard coded: https://github.com/GraphWalker/graphwalker-project/blob/master/graphwalker-java/src/main/java/org/graphwalker/java/test/TestBuilder.java#L84
The example on http://graphwalker.org/docs/workflow needs this method to work.
I think will be good to include Chinese Postman Problem algorithm into library.
Short introduction: http://cs.swan.ac.uk/~csharold/cpp/index.html
More complete info: https://en.wikipedia.org/wiki/Route_inspection_problem
implementation:
http://cs.swan.ac.uk/~csharold/cpp/CPP.java
mvn graphwalker:test -Dtest=“MyTest” -Dgenerator=“random_path(vertex_coverage(100))”
The unit test in core below will fail.
diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java
index 1dc8f2d..461b1ee 100644
--- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java
+++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/SimpleMachineTest.java
@@ -136,6 +136,20 @@ public class SimpleMachineTest {
assertThat(context.getProfiler().getTotalVisitCount(), is(5L));
}
+ @Test
+ public void executeActionWithVariableNameContext() {
+ Vertex vertex1 = new Vertex();
+ Vertex vertex2 = new Vertex();
+ Model model = new Model()
+ .addEdge(new Edge().setSourceVertex(vertex1).setTargetVertex(vertex2))
+ .addEdge(new Edge().setSourceVertex(vertex2).setTargetVertex(vertex1));
+ model.addAction(new Action("context = 1;"));
+ Context context = new TestExecutionContext(model, new RandomPath(new EdgeCoverage(100)));
+ context.setNextElement(vertex1);
+ Machine machine = new SimpleMachine(context);
+ assertThat(machine.getCurrentContext().getKeys().containsKey("context"), is(true));
+ }
+
@Test(expected = MachineException.class)
public void honorGuard() {
Vertex vertex1 = new Vertex();
A graph converted to json should have the models array.
Add a method to org.graphwalker.java.test.Result which returns a json formated string with detailed statistics for a test run.
We should also have a method that can supply the same information during a test, not only after a test run.
Following error is caught:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
at org.graphwalker.core.machine.AccessModelTest.read(AccessModelTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Following patch is a fix for that. But how to solve it for other versions of jdk?
diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/machine/AccessModelTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/machine/AccessModelTest.java
index d3d3fdd..e6b7093 100644
--- a/graphwalker-core/src/test/java/org/graphwalker/core/machine/AccessModelTest.java
+++ b/graphwalker-core/src/test/java/org/graphwalker/core/machine/AccessModelTest.java
@@ -19,7 +19,7 @@ public class AccessModelTest {
@Test
public void read() {
ExecutionContext context = createContext();
- Assert.assertThat((Double)context.getAttribute("x"), is(1.0));
+ Assert.assertThat((Integer)context.getAttribute("x"), is(1));
}
@Test
Patch https://github.com/GraphWalker/graphwalker-patch-repo/blob/master/semiColonBug.patch reproduces the problem
I don't think that Travis has java 8 for openjdk available I guess.
https://travis-ci.org/GraphWalker/graphwalker-project/jobs/44332675
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.