GraphWalker / graphwalker-project

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

Functions in graphwalker not working when containing semicolon #116

Closed AliKarpuzoglu closed 7 years ago

AliKarpuzoglu commented 7 years ago

Hi, This is a follow up on a bug reported by @sisso19 here https://github.com/KristianKarl/GraphWalker/issues/23 After using graphwalker and the built in javascript functionality for a while, I have found some Issues when using functions, specifically when using semicolon in them(e.g. when using multiple statements). It seems as if the semicolon are used as a split for the different actions in the graphwalker, which makes for-loops apparently impossible. A function with more than one line is also not usable because of this Here are two examples for those errors. for loop multiple statement

KristianKarl-zz commented 7 years ago

@nilols Do you remember why we decided to split by semicolons?

nilols commented 7 years ago

I think it's due to the model parser, the core module doesn't care if it's only one statement or more, the Action class only see it as a script. But the parser needs to know when a action stops and something else starts, so to get this working with yEd the parser needs to be updated to support this.

nilols commented 7 years ago

One workaround is to have the code in java and then just call the java method from JavaScript, or create the JavaScript function in the context from Java and then just call the function from JavaScript.

KristianKarl-zz commented 7 years ago

When it comes to model parsing, that should be fixed by the new web editor

Sigurthorb commented 7 years ago

What is stopping you from executing the entire javascript section in a single eval function call?

KristianKarl-zz commented 7 years ago

Nothing. The challenge is parsing the javascript part from the graphml file created by yEd. We're using Antlr4 for the parsing part. The test part of an edge and vertex holds quite a few data that needs to be extracted. That makes it a bit complicated.

nilols commented 7 years ago

@AliKarpuzoglu should be fixed now