Our strength is the automated, model-based generation of test suites using graphical usage models for hardware and software systems. Test suites can be further processed as JSON documents for the development of executable test cases or can be visualized in a user-friendly way.

Hello MBT Web - Model-based Testing of web applications

We are now extending the Hello MBT bug example in order to fix bugs within web pages by using MBT techniques. For this purpose, the Java Swing application described in section Hello MBT World - Model-based testing for beginners is implemented as a Web application HelloMBTWeb :

The corresponding usage model, which serves as the basis for automatically generating incorrect test cases from the viewpoint of the Web application HelloMBTWeb, is the same as described in section Hello MBT Bug - Model-based testing for advanced tester:

Starting in the usage state World, the error state Bug Demon is first reached by entering BuggyClick, which is not intended from the web application's point of view, before the correct input ClickWorld returns to usage state World.

This means that exactly the same test suites, i.e

  • complete coverage of all usage states
  • complete coverage of all possible transitions between the usage states
  • coverage of all loop-free paths between the start state [ and the final state ], i.e. no transition is selected twice within the same test case
can be reused for testing the Web application that were generated automatically by using the TestPlayer© as previously described in section Hello MBT Bug - Model-based testing for advanced tester.

For the automatic testing of the web application HelloMBTWeb, additional drivers are needed to automate the access to the web browser. For this purpose we use the test automation framework SeleniumHQ, which can be easily integrated into a test environment based on Eclipse:

The diagram above shows that an appropriate browser driver must be loaded for the test execution. Option -c "Chrome" starts the test execution environment HelloMBTWeb.java by using the Google browser Chrome:

File option -f test_cases_for_transition_coverage.json.txt imports the automatically generated test suite to cover all state transitions during the test execution. The URL option -u "http://localhost:8888" determines where to find the Web application to be tested. Parameter -t 100 specifies the duration of click events in milliseconds.

Subsequently, the web browser starts and automatically executes the generated click events of the imported test suite:

At the end of the test, the result of the test execution is reported:

As you can see, two out of ten test cases failed the test because they contain the incorrect click event BuggyClick in one of their test steps.

The following video shows again the outlined procedure and all essential steps in a compact presentation: