Automation of web page tests

4

I would like the tooltip to perform the recording of the data entry on the page. I have already used the Selenium IDE , Selenium Web Driver . I saw that there is iMacros . I'm programming in JSF, Java and Primefaces.

My problem is this, I recorded through the Selenium IDE, but have time that it loses the reference of the entries on the page. So I have to redo the test from the wrong reference, so are there other tools to work on to automate data entry?

iMacros did not like it very much because it is not as simple and efficient to work with as the Selenium IDE.

    
asked by anonymous 27.03.2014 / 14:59

3 answers

2

Here has a complete list of test automation tools.

Selenium is an excellent tool and I recommend trying to fix it by following a few steps as indicated Here . From what I saw you have to wait for the element to appear on the page and get stuck before using it.

    
27.03.2014 / 15:46
1

The problem you are facing can be divided into two points:

  • elements with dynamic IDs
  • Some elements look like an html element (like a combobox), but in fact they are a joining of several elements (instead of being one with several it usually has one with several s or
  • s).

Show us how the behavior of the html source code or even the combo. There are location types in Selenium that can help you interact with elements like this.

    
20.05.2014 / 15:59
0

Once I created a web testing framework, which is actually a wrapper for Selenium, for a company that works with JSF.

The problem with JSF is exactly the one pointed by Elias in the first item in the list: it generates dynamic ID's for many elements. This prevents the burning of Firefox's Selenium IDE to run in the same way.

For example, if you do not set an ID for any page element, JSF will take care of it. A button on a form, for example, can end up as the id meuFormulario:j_id45674 (this can change from one execution to another) and a field in a dataTable tabela:0:nomeCampo (does not change but is difficult to work).

To work around these issues, the solution was to use CSS and XPath selectors using the name attribute for form fields and other attributes for images.

Finally, the solution I found was to create such a framework that, among other things, provided some methods that encapsulated selectors for standard enterprise components.

For example, every include record had a button with a specific class attribute, for example, botao-incluir . In other cases, the button contained a specific image. So I created a class that all test classes could extend or import statically and use more or less like this (in Java):

public class CadastroCliente extends TestBase {

    @Test
    public void cadastrarCliente() {
        type(campo("nome"));
        type(campo("idade"));
        click(botaoIncluir());
        aguardar();
    }

}

In JSF, the nome field, for example, could have the ID generated as formCad:panel10:nome . Then the campo() method would actually return a selector like this:

css=input[id$=':nome']

The above selector is a CSS selector that looks for a input element on the page whose id ends with :nome .

The type and click methods that are in the sample code are selenium wrappers that I made specially adapted for the system in question.

The advantage of abstracting the original Selenium methods is that there was often some specific behavior that required special treatment. In that case, I simply tuned the Wrapper class without having to play the tests.

The aguardar() method, for example, can automatically make checks on validation errors, of course, if there is a pattern followed throughout the system.

    
20.05.2014 / 16:27