logo

Test execution automation

Making the executable tests from an action-state model is super easy. The tester, developer, or business analyst just executes the code when the Harmony runner is on, makes some validation, and the test is automated. The process is the following:
Image without caption

Prerequisites for test execution automation

  • existing model or at least a model step.
  • The runner is executed from the Command Prompt as npx -y @harmony.ac/runner@latest
    • alternatively you can check Cloud run
    • Image without caption
  • In ‘Parameters’, the URL of the SUT is written:
Image without caption

Low-level model, selectors, values

Two-phase MBT consists of a high-level and a low-level model. The former is implementation-independent, and the latter consists of implementation details.
Selectors connect the test cases and software under test. For simplicity, we use the same name that identifies a UI element, i.e., the selector. We strongly recommend using data-* attributes to provide context to your selectors and isolate them from CSS or JS changes. Here is the code fragment:
javascript
<button data-test="next" > Next </button>
In this case, Harmony generates
next
as the selector name of the ‘next button. Otherwise, Harmony offers a selector based on the DOM :
Image without caption
This doesn’t reflect the button, icon, etc., and when the code is modified you don’t know what it is. You can modify it, however, to be understandable. Just click on the selector ‘svg 4’ and modify it to ‘search setting’:
Image without caption
then press the OK symbol. From here every ‘svg 4’ selector will be displayed as the new one.
Low-level models consist of steps for both the actions and responses. A low-level step for an action starts with the keyword ‘When’ and then follows with a selector. The next item is another keyword ‘is’. The last element is a value such as ‘Mr. Smith’ or ‘198’, or an event such as ‘clicked’. There may be some different arrangements, but each step consists of a selector, a value, and keywords. You can also modify the values:.
Image without caption
Here the value “31” can be modified to any other value such as 30, then press the OK button:
Image without caption
This is important when the test result is faulty and you need to fix the test. (The code will be fixed by the developer later.)
Implementing test casesRunning the testsCommands Maintaining and modifying the testsDisplay test results