GraphWalker / graphwalker-project

This is the repo for the Model-based testing tool GraphWalker.

Home Page:http://graphwalker.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why the folder of generated-test-sources does not contains any path information ? only a cache.json

JICJ opened this issue · comments

commented

cache.json contents :{"D:\MBT\graphwalker-example-master\java-amazon\src\test\resources":{"modified":0,"### generated":false}}

commented

for example the project of java-amazon ,when i run the "mvn graphwalker:test" .

I'm not sure what you mean with path information. Would you mind to elaborate?

But, the folder target/generated-test-sources is only used when unit tests are executed. That is, when @Test are found in the src/test folder in your project.

In the case of java-amazon project, the code generated by graphwalker will be found in target/generated-sources.

commented

First ,thank you very much . when one generator ,like random( some stop condition(s) ) is used in the test, during this period,the track which this generator traverses a model is the information i mean . I hope to record the random manner information .(Navigate through the model in a completely random manner.)

Using the Amazon Shopping Cart test as an example, you could do it (as I understand your use case), like this: (I will use Windows in this example)

  1. Download latest graphwalker-cli from http://graphwalker.github.io/#download
  2. Open a command prompt
git clone https://github.com/GraphWalker/graphwalker-example.git
cd graphwalker-example\java-amazon
java -jar graphwalker-cli-4.2.0.jar offline -m src\main\resources\org\graphwalker\ShoppingCart.graphml "random(vertex_coverage(100))"
  1. The output would be the path through the model, as decided by the random generator:
{"currentElementName":"e_StartBrowser"}
{"currentElementName":"v_BrowserStarted"}
{"currentElementName":"e_EnterBaseURL"}
{"currentElementName":"v_BaseURL"}
{"currentElementName":"e_SearchBook"}
{"currentElementName":"v_SearchResult"}
{"currentElementName":"e_ShoppingCart"}
{"currentElementName":"v_ShoppingCart"}
{"currentElementName":"e_SearchBook"}
{"currentElementName":"v_SearchResult"}
{"currentElementName":"e_ClickBook"}
{"currentElementName":"v_BookInformation"}
{"currentElementName":"e_SearchBook"}
{"currentElementName":"v_SearchResult"}
{"currentElementName":"e_ClickBook"}
{"currentElementName":"v_BookInformation"}
{"currentElementName":"e_ShoppingCart"}
{"currentElementName":"v_ShoppingCart"}
{"currentElementName":"e_SearchBook"}
{"currentElementName":"v_SearchResult"}
{"currentElementName":"e_ClickBook"}
{"currentElementName":"v_BookInformation"}
{"currentElementName":"e_AddBookToCart"}
{"currentElementName":"v_OtherBoughtBooks"}
commented

Can it be online?thank you very much!

Yes. When generating an online path, the steps needs to be consumed as they are generated.
Either by directly the using the GraphWalker API - see the Amazon example.
Or using a REST client or Websocket

commented

So the output will not show as offline, when I run test online. Is it right?

GraphWalker will write a log to stdout when in online mode.
However, it will not look the same as in the offline case above.
But if your use case is to see what path the online mode generated, you can see that

commented

Thank you very much !Firstly, I want to know if you will plan to do something for recording the path , like writting the path the online mode generated in a file. As far as I'm concerned ,it is a important feature for the testers .Secondly, the report in the folder 'graphwalker-reports' is unfriendly to testers. As a QA,I would like to read a UI view , like a format of HTML. And the report might contains the class Result 's fields information.

The generated path is written to stdout, so it's just a matter to redirect stdout to a file of your liking.
In the Amazon example:
mvn graphwalker:test > test.log

Regarding graphwalker-reports when designed, it tries to follow the format of unit test reports. Other than that, we have not plans to do anything more elaborate on the reporting.
If someone would like to take a stab and improve the reporting to be more UI friendly, we would be happy receive pull requests for that.

commented

Could you please tell me where the code GraphWalker will write a log to stdout when in online mode. I want to have a try to record the stdout to a file.

commented

I want to implement a method that can return path info of the model online .And I can analy the path info after the test is over,which is more friendly to QA.

commented

?

Hi JICJ,

  1. Regarding the XML reports, have you tried using a tool to convert the reports to the format you like e.g. https://github.com/inorton/junit2html I have not used it myself and there might be other tools that better suite your needs but it seems to be able to convert junit XML to html

  2. Regarding analysis of the path taken and such, have you seen the Observer interface, if you implement that you should be able to access the Profiler

commented

Hi nilols,
Thank you very much,firstly.I will have a try right now.

commented

Acturally,the key I focus on is that the report contains the class Result 's fields information. The UI friendly is not important.
image
image

commented

Hi nilols,
Be familiar with this project's framework is a bit difficult for me, which may take long time. Now I want to use the GraphWalker to our test project in order to improve the test coverage. would you achieve it? That will be very great!

Like with all frameworks it will take time to get familiar with it, and the point of view of what's important might be different between users. But in general, questions should be asked in the forum and not as issues.

When this version of GraphWalker was built we added interfaces so that users could extend the functionality, so e.g. if you want to create your own PathGenerator or StopCondition you could do that, here is an example. If you would like to hook into the test execution you could use the Observer that I mentioned before, here is an example that visualise the execution in GraphStream. If you would like to act at specific points during the execution you could have a look at the annotations, here is an example. And if you would like to report result in a different way, then the xml report, then the data is available in the profiler.

I guess you can't share work related projects but if you create a simple project, so that I can see how your workflow is and you explain a bit what you are missing I could give you some pointers.

And if you do any cool things, that you would like to share then just do a PR =)

commented

Tnak you very much nilols! I will spend more time on the GraphWalker Project . I am very glad and thank you for your advice. Maybe I can do something that could extend the functionality.

commented

I will go to the online forum for any questions.