Domain Specific Language


Testicide will enable the tester to extend his toolbox with more steps and scenarios that he will write using the very simple rules of our Domain Specific Language (DSL).

To better understand this idea we may have a look at Selenium Web driver which is one of the most popular UI test automation tool.

In Webdriver, to select an element from the browser and perform an action on it you should write the following code:

selenium

These two steps should then be included in the suitable method within the suitable class in the Test project. Every time you need to perform this step, you should rewrite this code.

In Testicide, our DSL will simply follow this general syntax:

<Action> <element> with <attribute> “value”

where:

  •  <Action> represents any action that can be done in the HTML page like click, double click, mouseover, …etc.
  • <element> is the tag name of the HTML element such as div, a, input, … etc.
  • <attribute> represents an attribute name in the HTML element mentioned before such as id, name, class, … etc.
  • “value” is the value of the mentioned attribute.
  • So if the user wants to add a step that searches for a span in the HTML page with an id ‘x’ and right clicks it, the DSL step will be (Right click span with id ‘x’).

Examples for steps written using the DSL:

  • Click button with id “x”
  • Click label with name “x”
  • Right Click div with class “x”
  • Type in textfield with name “x” “something”

As you can see, the step contains the search criterion (id, class or name) and the action to be performed (Click, right click, double click …). The user can then add these new steps to his own toolbox.

A tester will also be able to add new scenarios to the toolbox by writing some steps of his own and add them as a whole to the toolbox as one step like the following Sign-up scenario:

Go to page with name “Sign-up”
Type in textfield with name “Name” “xx”
Type in textfield with name “Email” “xxx@xxx.xxx”
Type in textfield with name “Password” “xxxxx”
Type in textfield with name “ConfirmPassword” “xxxxx”
Click button with name “Submit”
Find message “Welcome”

The customer then will name this scenario as Sign-up scenario and will add this scenario to his own toolbox. At this point the customer can see a Scenario named Sign-up in his toolbox and he will be able to use it as a step in the same project or any other projects.

Advertisements