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 TestUS - Model-based Testing of websites



This page uses the TestUS Homepage to show how any web presence can be tested with model-based techniques. For the automatic generation of the test suite, we first have to create a proper usage model for the website by means of the TestPlayer© Dashboard. For the TestUS homepage, the corresponding usage model is as follows:



The TestUS homepage always starts in the usage state Welcome. From there, you can reach the main usage states At a First Glance, Advanced testing, Information, TestPlayer© Login and Language Switch. The main usage states correspond to the selection menus in the top menu bar of the TestUS homepage. From the main usage states you get to the other usage states of the website, e.g.

  • Starting in Welcome
    • Model-based Testing and
    • Statistical Test Case Generation are reached
  • At a First Glance provides access to
    • Automatic Test Case Generation,
    • Automatic Test Suite Generation,
    • Hello MBT World - Model-based testing for beginners,
    • TestPlayer© - Basic Operation
  • Advanced testing offers access to
    • Hello MBT Bug - Model-based testing for advanced tester,
    • Hello MBT Web - Model-based testing of web applications,
    • Hello TestUS - Model-based testing of websites and
    • References
  • Information gives you access to
    • Site Notice and
    • Contact
  • TestPlayer© Login offers the access to
    • Sign-Up and
    • Login
  • Language Switch , respectively switches the language between English, respectively German
  • Via Button submenus
    • Usage model,
    • Test suite,
    • Test case,
    • Test result,
    • Visualization and
    • Video are reached.
State transitions between the usage states are triggered by the generic events e1 to e62, which were automatically generated by the TestPlayer© together with the corresponding transition probabilities p1 to p62.

Using the TestPlayer© it is now possible to automatically generate test cases for the model-based test of the TestUS homepage from the above-mentioned usage model. The following testsuite contains 21 test cases for complete coverage of all usage states, which are created according to the sorting criterion sort_l, i. e. the test cases are selected from 100 statistically random generated test cases sorted according to the length of the test cases:


  • Testsuite State Coverage contains 21 (out of 100) test cases
The test cases are animated (marked by bold orange coloration) and show the coverage of the usage states as well as the transitions between the states. The number after the colon of the respective click event shows how often the respective state transition was executed during the test case.


In addition to the graphical representations, the TestPlayer© also generates text files that provide the test cases of the test suite in a compact JSON format for test execution. The file test_cases_for_state_coverage.json.txt contains the 21 test cases of the testsuite State Coverage for testing the TestUS homepage:

[
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e52", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e3", "Advanced Testing"],
    ["Advanced Testing", "e50", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e6", "Language Switch"],
    ["Language Switch", "e47", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e5", "TestPlayer© Login"],
    ["TestPlayer© Login", "e48", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e2", "At a First Glance"],
    ["At a First Glance", "e51", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e4", "Information"],
    ["Information", "e49", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e7", "Model-based Testing"],
    ["Model-based Testing", "e22", "Welcome"],
    ["Welcome", "e52", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e8", "Statistical Test Case Generation"],
    ["Statistical Test Case Generation", "e23", "Welcome"],
    ["Welcome", "e52", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e2", "At a First Glance"],
    ["At a First Glance", "e12", "TestPlayer© - Basic Operation"],
    ["TestPlayer© - Basic Operation", "e27", "At a First Glance"],
    ["At a First Glance", "e51", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e4", "Information"],
    ["Information", "e18", "Data Privacy"],
    ["Data Privacy", "e33", "Information"],
    ["Information", "e49", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e4", "Information"],
    ["Information", "e17", "Site Notice"],
    ["Site Notice", "e32", "Information"],
    ["Information", "e49", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e2", "At a First Glance"],
    ["At a First Glance", "e10", "Automatic Test Suite Generation"],
    ["Automatic Test Suite Generation", "e25", "At a First Glance"],
    ["At a First Glance", "e51", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e4", "Information"],
    ["Information", "e19", "Contact"],
    ["Contact", "e34", "Information"],
    ["Information", "e49", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e2", "At a First Glance"],
    ["At a First Glance", "e11", "Hello MBT World - Model-based testing for beginners"],
    ["Hello MBT World - Model-based testing for beginners", "e26", "At a First Glance"],
    ["At a First Glance", "e51", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e5", "TestPlayer© Login"],
    ["TestPlayer© Login", "e21", "Login"],
    ["Login", "e36", "TestPlayer© Login"],
    ["TestPlayer© Login", "e48", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e3", "Advanced Testing"],
    ["Advanced Testing", "e15", "Hello TestUS - Model-based testing of websites"],
    ["Hello TestUS - Model-based testing of websites", "e30", "Advanced Testing"],
    ["Advanced Testing", "e50", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e3", "Advanced Testing"],
    ["Advanced Testing", "e16", "References"],
    ["References", "e31", "Advanced Testing"],
    ["Advanced Testing", "e50", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e5", "TestPlayer© Login"],
    ["TestPlayer© Login", "e20", "Registration"],
    ["Registration", "e35", "TestPlayer© Login"],
    ["TestPlayer© Login", "e48", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e2", "At a First Glance"],
    ["At a First Glance", "e9", "Automatic Test Case Generation"],
    ["Automatic Test Case Generation", "e24", "At a First Glance"],
    ["At a First Glance", "e51", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e3", "Advanced Testing"],
    ["Advanced Testing", "e14", "Hello MBT Web - Model-based testing of web applications"],
    ["Hello MBT Web - Model-based testing of web applications", "e29", "Advanced Testing"],
    ["Advanced Testing", "e44", "Language Switch"],
    ["Language Switch", "e47", "]"]
  ],
  [
    ["[", "e1", "Welcome"],
    ["Welcome", "e3", "Advanced Testing"],
    ["Advanced Testing", "e13", "Hello MBT-Bug - Model-based testing for advanced tester"],
    ["Hello MBT-Bug - Model-based testing for advanced tester", "e28", "Advanced Testing"],
    ["Advanced Testing", "e44", "Language Switch"],
    ["Language Switch", "e47", "]"]
  ],
]


For automatic testing of the TestUS homepage you need additional drivers to automate the access to the web browser. For this purpose we are using the automation framework SeleniumHQ, which can be easily integrated into a testing environment that is based on Eclipse :



The diagram above shows that a suitable driver for the web browser has to be loaded in order to enable Selenium for executing the generated test cases in an automated process.


The following diagram shows the call options of the HelloTestUS.java test execution file. By default, the website is launched using the Google Browser Chrome:


In Eclipse, Run Configuration can be used to pass the call parameters for executing the test:



The file option -f test_cases_for_state_coverage.json.txt imports the automatically generated testsuite that covers all the usage states during the test execution. The time parameter -t 1000 sets the duration of a click event during the test execution in milliseconds.


Subsequently, the web browser starts and automatically executes the generated click events of the imported test suite, controlled by the Chrome driver of the SeleniumHQ framework:



As you can see, the call option -v directory is used to dynamically visualize each executed test case. The required visualization directory can be generated automatically for this purpose in the TestPlayer© Dashboard.


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



As you can see, a total of 21 test cases of the automatically generated testsuite -f test_cases_for_state_coverage.json.txt have been run and all of the 21 test cases passed the test.


The following video shows the executed test based on the automatically generated testsuite -f test_cases_for_state_coverage.json.txt and the automated navigation of the TestUS homepage via the presented 21 test cases: