Skip to content
Kristian Karl edited this page Mar 4, 2021 · 7 revisions

This is an example of how to use GraphWalker to test apps using Appium.

The test

The system under test is a simple android app called Notepad. It is packaged with the test under:

src/main/resources/Notepad.apk

The test will install the Notepad app to the target device and start running the test. This model depicts the design of the test. Model
The code that implements the test:

src/main/java/org/graphwalker/appium/NotesListTest.java

The class NotesListTest implements the interface NotesList. That interface is automatically generated by GraphWalker, by running either of the following commands:

mvn graphwalker:generate-sources
mvn graphwalker:test

Worth noting in the code is the line with the GraphWalker annotation:

@GraphWalker(value = "random(edge_coverage(100))", start = "v_NotesListView")

It does 2 things:

  1. value = "random(edge_coverage(100))"
    It sets the generator and the stop condition for the path generation of the test. random(edge_coverage(100)) means that the path generator is the random path generator, and the stop condition is when all edges of the graph has been visited.
  2. start = "v_NotesListView"
    Tells GraphWalker where to start the execution. v_NotesListView will be the first graph element to be executed.

The above is equivalent to running the following in offline mode:

java -jar graphwalker-cli-4.3.1.jar offline -m NotesList.graphml "random(edge_coverage(100))"

Steps to execute the project

  1. Install appium. On Ubuntu:
sudo apt install nodejs-legacy
sudo npm install -g appium
  1. Start android emulator.
    The test is only verified running the Android emulator using Nexus 7, 2012 with API 19.
    From command line on a Linux box:
emulator -avd Nexus_5X_API_23
  1. Start appium.
  2. Run the test:
git clone https://github.com/GraphWalker/graphwalker-example.git
cd graphwalker-example/java-appium
mvn graphwalker:test
Clone this wiki locally