GraphWalker with Cypress or Selenium with JS

49 views
Skip to first unread message

Hamza Abbas

unread,
Apr 6, 2023, 9:25:34 AMApr 6
to GraphWalker
Hello, we as an organization are exploring graph walker for model based testing. I haven't been able to figure it out yet but can we use graph walker for creation and execution if tests which will be written wither with cypress or selenium using javascript?

Kristian Karl

unread,
Apr 11, 2023, 9:48:11 AMApr 11
to GraphWalker
Hello!

Yes, that could be done launching graphwalker as REST or a  WebSocket service. Have look at:
I don't have JS examples, but have  a check out

Hamza Abbas

unread,
May 17, 2023, 9:14:39 AMMay 17
to GraphWalker
Hello Kristian,

Thanks for your response. I have one follow up question in this regard, Can i parse my graphml model created from yED through websocket as opposed to what's mentioned over here which states  The model must use JSON notation for a GraphWalker model. https://github.com/GraphWalker/graphwalker-project/wiki/Websocket%3A-start

Kristian Karl

unread,
May 22, 2023, 5:37:14 AMMay 22
to GraphWalker
Hi Hamza,

If you want to upload models using the Websocket or REST api, you need to use JSON notation.
If that's your case, you can convert your graphml models to json. Please have a look at https://github.com/GraphWalker/graphwalker-project/wiki/Convert

For REST you can launch graphwalker and use graphml, like:
java -jar graphwalker-cli.jar offline -s RESTFUL -m Login.graphml "a_star(reached_vertex(v_Browse))"

For Websocket, only json notation is implemented.

Best Kristian

Hamza Abbas

unread,
May 22, 2023, 6:37:21 AMMay 22
to Kristian Karl, GraphWalker
Thanks for the clarification Kristian. I have a follow up on this even after converting it to a json file i get this error that 

'JSONObject["gw3"] not found'. I want to understand more about the usage of this tag and is there a way that directly my graphml file after being converted to JSON could be read by the tool.


--
You received this message because you are subscribed to the Google Groups "GraphWalker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to graphwalker...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/graphwalker/14035112-b59b-49a7-b55c-8de334faee71n%40googlegroups.com.

Taxfix AG

Köpenicker Str. 122
10179 Berlin, Germany

Taxfix.de 
Taxfix in Play Store 
Taxfix in App Store

Vorstand: Martin Ott (Vorstandsvorsitzender) | Lino Teuteberg
Aufsichtsratsvorsitzender: Mathis Büchi Ginzbourg
Sitz: Berlin, Amtsgericht Charlottenburg HRB 248584 B

Please consider the impact on the environment before printing this email.

Diese E-Mail einschließlich evtl. angehängter Dateien enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind und Sie diese E-Mail irrtümlich erhalten haben, dürfen Sie weder den Inhalt dieser E-Mails nutzen noch dürfen Sie die evtl. angehängten Dateien öffnen und auch nichts kopieren oder weitergeben/verbreiten. Bitte verständigen Sie den Absender und löschen Sie diese E-Mail und evtl. angehängte Dateien umgehend.

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you receive this in error, please contact the sender and delete the material from any computer.

Hamza Abbas

unread,
May 22, 2023, 6:42:55 AMMay 22
to Kristian Karl, GraphWalker
For example if i create the graph through graphwalker studio rather than yED would that create the JSON file in the format graphwalker would be able to read i.e include the gw3 tag.

Kristian Karl

unread,
May 22, 2023, 7:31:08 AMMay 22
to GraphWalker
In a websocket command start  the keyword  gw3 in means that a model is following, like in: Websocket: start.


Hamza Abbas

unread,
May 22, 2023, 10:13:41 AMMay 22
to GraphWalker
Yes i do get that the model needs to be in gw3 tag. But once i have created the model from yED in graphml and then converted it into a json the gw3 tag is not there meaning i have to do this manually everytime i create a model. My ask is there a way to convert my graph directly into a model that is within the gw3 tag?

Kristian Karl

unread,
May 22, 2023, 4:58:33 PMMay 22
to GraphWalker
Ah, I think I understand you grievance now.

So, the bigger picture is that yEd's graphml format is deprecated but kept for backwards compatibility, but it's not supported everywhere, such as the web socket API.
 - A user should use Graphwalker Studio editor when creating and editing models.
 - If you prefer to use yEd's editor you need to add a step of converting the model into json and then insert/add it in a websocket start command.

It's a bit awkward I understand, even if the process could be somewhat automated.
Message has been deleted

Hamza Abbas

unread,
May 25, 2023, 11:25:50 AMMay 25
to GraphWalker
Hey Kristian,

Thanks a lot for all the info. I have finally get it working with JavaScript. What i have done is basically used Graphwalker Rest API. First i create a JavaScript interface with empty functions for each edge and vertex in the GraphWalker model automatically through script. Then give each function a definition with selenium functions (basically the only manual step). Then i load the model and generator through rest api and keep doing getNext and calling the relevant function until hasNext gets false.

Do you think this a good grass root implementation to start with for model based testing or you something missing in the base of implementation.

Kristian Karl

unread,
May 29, 2023, 5:24:55 AMMay 29
to GraphWalker
Hi Hamza,

Great that you got it to work. Also interesting to hear you that come up with a solution that involves JavaScript interfaces.  This is very similar to what I have done, but in java.

I think you're approach is very good. Using interfaces you create an abstraction level between the models and the implementation part. The abstraction gives you the opportunity of separation of concerns. A tester can focus on the modelling of the tests, and developers can implement the interfaces.

The challenge is as always, striking a balance when moving theses tests into the CI pipeline. They can't run for too long, and they should not introduce flakiness. The purpose of theses tests when moved into CI/CD, should be about verifying features and functionality - not primarily finding bugs.

If your goal is to use model-based testing for finding bugs, they should run outside the CI. Perhaps on a schedule.

One challenge with model-based testing, is that when it finds bugs or problems, they may be harder to troubleshoot. Make sure to have a setup that facilitates this process. It could be; how to save logs or test results, screen dumps etc

Think of this use case: A developer pushes a PR. The CI systems builds and tests the system. One of the model-based tests fails.
* How easy is it for the developer to understand the failure and troubleshoot it?

Best of luck, Kristian
Reply all
Reply to author
Forward
0 new messages