Lab 10

Lab 9 VVS

Graphical user interface testing

Marathon

The tool we will use to test graphical user interfaces is Marathon.

We download the tool's latest version from here and then unpack it. For Unix systems we open a console and change the current folder to the tool's folder, and then run the command ./marathon For Windows, similarly, one has to run marathon.bat from the tool's folder.

Once the Marathon tool is launched we need to create and configure a new project that would allow us to work with the demo application.

The Project tab:

  • Name: SampleApp
  • Directory: a new directory where the marathon project files will be store

The Application tab:

  • Class Name: net.sourceforge.marathon.examples.SampleApp
  • Class Path: select the sampleapp.jar archive from the directory where you have originally unpacked marathon

One should then click Test in order to check that the project has been correctly created and configured. When the demo application starts, click Close, then Save. Click the Select button and then we can proceed with analyzing the structure of the newly created project.

Take a closer look at the following features.

Checklists

  • Used for semiautomated testing: marathon inserts those checklists into your tests, and when the test reaches that point the checklist is completed

Fixtures

  • These scripts define the starting mode for the tests. Each TestCase can specify the Fixture to be executed with.

Modules

  • Methods common to several tests. They can be marathon scripts, or other generic, easily reusable methods.

TestCases

  • The actual tests. They can be created either by recording them, or they can be developed manually. One can create specific subdirectories in order to keep those tests better organized.

TestData

  • Various files containing the actual test data.

TestReports

  • The actual test reports will be created here.

TestSuites

  • Meant to keep scripts that will group the tests in test suites.

omap

  • Contains yaml files for mapping the various object names.

Hands-on exercise with Marathon

Download the GuiTest project and unpack it. Then open a new Marathon session and click on New. In the configuration window, in tab Project, give a name to your project and a path to a directory where the marathon project will be saved (keep in mind that it is a different project from the actual application under test). In the next tab, Main, give the complete name of the class containing the main method (for this project should be p14.MainFrame), then fill in the Working directory and Class path fields with the directory where the classes of the application under test are, then click Save, and finally OK.

Open the newly created project and right click on the TestCases directory, then New -> Test Case. Then click the Record button, which will determine a console to pop up, where you will be able to follow the actions performed on the GUI. Thus, by recording the sequence of these actions, a test is created.

Take a closer look at the contextual menu which appears at Control + right click (Command + right click in MacOS) on the various graphical elements of the application under test, insert various assertions for select and for the element labels.

Students must find a way to create a for loop in order to click a button for a number of 100 times.

Do take an-indepth look at the User Guide and at all the rest of the official Marathon documentation.