GraphWalker / graphwalker-project

This is the repo for the Model-based testing tool GraphWalker.
http://graphwalker.org
MIT License
323 stars 116 forks source link

Stop conditions non correctly processed if 3 conditions present #341

Open fcorvace opened 2 months ago

fcorvace commented 2 months ago

Hello, I'm trying to run a model, and the generator needs three conditions, but it seems that only one gets considered. The condition is the same as one listed in the examples: Random((vertex_coverage(100) and reached_vertex(myVertex)) or time_duration(90)) What happens is that it stops immediately at the reached vertex, ignoring the other conditions. Any other combination of just 2 of those conditions seems to work correctly, but when I add a third one, only the reached vertex seems to be considered, no matter in which order I place the conditions, or if I use the text "or" and "and" or the operators "||" and "&&".

KristianKarl commented 2 months ago

Thanks for the report, I'll have a look at it!

KristianKarl commented 2 months ago

Interesting! I could reproduce it running:

time java -jar graphwalker-cli/target/graphwalker-cli-4.3.3-SNAPSHOT.jar offline --model ./graphwalker-io/src/test/resources/json/SuperLarge.json "Random((vertex_coverage(100) and reached_vertex(v_Graph179)) or time_duration(20))"
{"currentElementName":"e_Edge001"}
{"currentElementName":"v_Node004"}
{"currentElementName":"e_Edge001"}
{"currentElementName":"v_Node003"}
{"currentElementName":"e_Edge004"}
{"currentElementName":"v_Node002"}
{"currentElementName":"e_Edge003"}
{"currentElementName":"v_Node001"}
{"currentElementName":"e_Edge002"}
{"currentElementName":"v_Graph179"}

real    0m8,482s
user    0m9,311s
sys     0m0,158s

It should not have stopped at v_Graph179 since vertex_coverage(100) is not yet fulfilled.

KristianKarl commented 2 months ago

I created a PR #342 that might fix the problem. However I need to do some more testing before I feel comfortable enough merging this PR. The feature using more complex AND / OR constructions can never have worked as intended. I'm a bit surprised that it has not surfaced earlier. Nice catch @fcorvace!