Skip to main content

GUI HTML Adaptor Example

Description

Through the GUI HTML Adaptor, H-TEST connects with web applications based on HTML and then, it’s possible to test them. This adaptor has an important companion named Selective Mapping, who is a JavaScript assistant bringing a more friendly user interface for helping to the creation of H-TEST mappings. It’s possible to perform single tests with this adaptor or End to end tests connecting with other adaptors either.

Statement of the exercise 

With an Excel and a loop, open 6 web pages: Create an Excel with different URL's and collect them with H-TEST to open them in the GUI Adaptor.

Tip: use the function getNumColumns or getNumRows and use it as the end value of the loop. Use while or for loop of H-TEST.

Solving the test case

We have designed this test case using three Adaptors: the User Object Adaptor, the Excel Adaptor, and the HTML GUI Adaptor. We have also created the WHILE loop, with which we will execute the same steps, as long as the condition we indicate in the properties of the Fragment is fulfilled.

The Excel Adaptor will attempt to read and parse the Excel sheet. The necessary initialisation parameters for this example are the following:

  • FilePath: represents the full path and file name of the Excel file being handled by this instance of the Excel Adaptor: C:\testURLsPERIODICOS.xlsx
  • Sheet: indicates the sheet number of the Excel file we are going to work with: 1

As a part of the mapping process, you should provide the adaptor’s information, regarding to connect and use it.

  • Url: first url to locate when the adaptor is created.
  • Browser (optional): the browser you will use in the test (e.g.: IE, Chrome).
  • Validate Insert Values: it’s indicates if the adaptor should validate or not the values which receive the adaptor during the execution. By default, is unchecked. The recommendation is to maintain unchecked for performance reasons. This field is very useful in special test cases, but in general it’s not necessary to use it.

HTML GUI adaptor

- openUrl: Opens a new url in the browser. It has a series of optional parameters, to check if the url was opened and timeout before verifying it. In this case we indicate the value #URL.

- waitFor: Wait the time in seconds that we indicate when mapping the message: 2.

- takeScreenshot: Takes a screenshot of each web page that has been opened.

- closeAllWindows: Closes all the windows of the instantiated adaptor. It will close the six windows of the six web pages that we have been opening.

Files needed to run the case

Before designing the test case, we created an xlsx file. In it we copied the six urls from six different newspapers. We have started with Row 1, Row 2,.... up to Row 6. While the column is always the same, column 3. We save it in the directory C:\test with the name we have given it, in this case C:\test\URLsPERIODICOS.xlsx

Excel.png

Important: before executing this test case, we must check that the .xlxs file is closed, otherwise we will get an error.

Test Set Execution

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

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.

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.


When returning the results, H.TEST returns a Word document, detailing the steps we have taken, 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.