Skip to main content

User Object Adaptor Example

Description

Through the User Object Adaptor, H-TEST uses his memory environment to manage variables, regarding to help in the control of the execution flow of the diagram. The User Object Adaptor, is the adaptor that allows the comparisons and checks that an end user would do manually, i.e. it automates the functions that a tester can do, data comparison, setting of conditions, etc.

As part of the mapping process, you should provide the Adaptor’s information. This adaptor, unlike the rest of the adaptors, does not have initialisation parameters, i.e. no information is set during the initialisation of the adapter, the information needed is obtained by using the different predefined functions.

Statement of the exercise

Calculate the addition of 5 integers.

Solving the test case

You have to declare them as a variable in H-TEST: 

  • setVariable(): creates a variable whose name is entered as a parameter. The types of variables are: TastTableData, String, Integer, Double, Date or Boolean. We have declared five variables, type INTEGER and we have given a value to each one: 
      • Variable 1 = value 2
      • Variable 2 = value 11
      • Variable 3 = value 15
      • Variable 4 = value 43
      • Variable 5 = value 7 

UserAdaptor.png

 

To perform the addition:

  • executeJavaScript(NameFunction): executes the javaScript function whose name is entered as a parameter. The function may have input parameters and return a value. The input parameters will be the variables defined with setVariable, or the results of other predefined functions. The value returned is stored in the output variable.

UserAdaptor1.a.png

Test Set Execution

When we finish executing this test case, we see if it has been executed correctly:

UserAdaptor1.b.png

Capture of results

We then open the icon on the right (marked with a red arrow) and we have as a result the evidence folder, where both the log of the execution is stored, as well as all the screenshots, files, etc... if we have checked the "Evidence" box in the general settings of the diagram.

UserAdaptor1.c.png


When returning the results, H-TESTT returns a Word document, detailing the steps we have performed, the results obtained from each step, the links to the diagram and the test set, if we have clicked on download document in the Results box.

UserAdaptor1.d.png