Coder Social home page Coder Social logo

assessor's Introduction

ASSESSOR+: Generator module

Requisites

  1. Java: to run the tools, you need to install java at least version 8, you can find java to this link https://www.java.com/
  2. Maven: to compile the source code, maven is required, you can find maven here https://maven.apache.org/install.html. To compile the code you need to use mvn install or mvn package inside the folder, the code will be compiled inside the target folder. In alternative, you can download the release version already compiled.

How to use Assessor+ Standalone Generator

  • Create a directory where the Selenium IDE code is exported with the annotations: for example C:/NameProject/
  • Go to the directory where the jar file is located, and execute: java -jar AssessorTool.jar C:/NameProject
  • Inside that folder, a Output folder will be created with the new TestSuite and all the PO Object
  • If a warning is found, a log file is created with the details of the problem

The complete description of the tool ASSESSOR+ can be found at: https://sepl.dibris.unige.it/ASSESSOR+.php

assessor's People

Contributors

gleak avatar

assessor's Issues

Function naming (Assert Problem)

Just performing some test, we noticed that in same case the tool is not able to create the function with the correct name.

We have to investigate in order to understand the problem.

Tips:

System.out.println("{ASSESSOR}:ReviewProduct:checkOut");
assertThat(driver.findElement(By.cssSelector(".nomargin > strong")).getText(), is("Vintage courier bag"));
driver.findElement(By.cssSelector(".entry-header-area")).click();
System.out.println("{ASSESSOR}backToMain");

public String getCSSSELECTOR_nomarginstrong() {
return driver.findElement(By.cssSelector(".nomargin > strong")).getText();
}

Method refactoring

When we interact with a form we want to create a function for each element, and when create a global function to use all the single method

From this:

MyUtils.WaitForElementLoaded(driver, elem);
driver.findElement(By.id("customer_edit_form_comment")).click();
driver.findElement(By.id("customer_edit_form_comment")).clear();
driver.findElement(By.id("customer_edit_form_comment")).sendKeys(key1);
driver.findElement(By.id("customer_edit_form_address")).click();
driver.findElement(By.id("customer_edit_form_address")).clear();
driver.findElement(By.id("customer_edit_form_address")).sendKeys(key2);

To:

public void setDescription(String description) {
By _description = By.id("customer_edit_form_comment");
MyUtils.WaitForElementLoaded(driver, _description);
driver.findElement(_description).clear();
driver.findElement(_description).sendKeys(description);
}

public void setAddress(String address) {
	By _address = By.id("customer_edit_form_address");
	MyUtils.WaitForElementLoaded(driver, _address);
	driver.findElement(_address).clear();
	driver.findElement(_address).sendKeys(address);
}

public void setAllNonMandatoryFiels(
String description, String address, ) {
setDescription(description);
setAddress(address);
}

Wait Management

The tool improves basic wait management and works quite well. The problem occurs when the web app is very slow and the tool is not able to insert the correct wait/time in order to wait the "item".

Cleanup locator

When the java tools convert the code using the PO method, not all the locators are stored into variables and so we got code duplication and some problems with the maintenance.

ie:

    By elem = By.id("customers-tab");
    MyUtils.WaitForElementLoaded(driver, elem);
    driver.findElement(By.id("customers-tab")).click();

Wait management

Another limitation concerns the management of the waits requited for correctly interacting with the web page elements

Method Clustering

With this feature, we want to aggregate the methods that have the same name even if they have different parameters. The classic example is the form where the tester can fill all or some fields.

Issue on StoreValue

Just performing some test, we noticed that the StoreValue of Selenuim create some problem to the assessor tools.

We have to investigate in order to understand the problem.

Tips:

//vars.put("howMany", "2");
//Integer times = vars.get("howMany").toString();

Exception in thread "main" com.github.javaparser.ParseProblemException: (line 72,col 28) Parse error.
Found "howMany" , expected one of "!=" "%" "%=" "&" "&&" "&=" ")" "" "=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||"

Function naming Java Style

We notice that, during the recording, you must use the Java Style to write the name of the Tests. Infact, if you call a test like 99 the tool is not able to parse it.

SeleniumDriver

Why do we not use the stand-alone-server.jar with the webDriverManager?

Code duplication

If you clicks for mistake on the same objcet several time you get the following code:

   driver.findElement(By.id("customer_edit_form_company")).click();
    driver.findElement(By.id("customer_edit_form_company")).clear();
    driver.findElement(By.id("customer_edit_form_company")).sendKeys(key3);
    driver.findElement(By.id("customer_edit_form_company")).click();
    driver.findElement(By.id("customer_edit_form_company")).clear();
    driver.findElement(By.id("customer_edit_form_company")).sendKeys(key4);

could be good if the tool is able to clean up the code and get this:

    driver.findElement(By.id("customer_edit_form_company")).click();
    driver.findElement(By.id("customer_edit_form_company")).clear();
    driver.findElement(By.id("customer_edit_form_company")).sendKeys(key4);

Stateless

Why do we not use the stateless mode?

Different locator same object

Another limitation concerns the way to interact with the web page elements. Indeed, for example, sometimes clicking
more close to an icon rather than clicking more close to the border generated two different identifier to reach the object and
thus two distinct methods in the same PO. We plan to equip ASSESSOR of a post processing step able to unify different
interactions that involve the same conceptual web element

Date Input problem (Could be solved By Code Duplication)

If you input the date without using the date picker you get the following code:

_Semester.setAllFields("FirstSemester",
"0001-01-22", "0002-01-22", "0022-01-22", "0222-01-22", "2222-01-22",
"0002-12-22", "0022-12-22", "0222-12-22", "2222-12-22");

and

driver.findElement(By.id("inputStarts")).click();
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key2);
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key3);
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key4);
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key5);
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key6);

could be good if the tool is able to clean up the code and get this:

_Semester.setAllFields("FirstSemester",
"2222-01-22",
"2222-12-22");

and

driver.findElement(By.id("inputStarts")).click();
driver.findElement(By.id("inputStarts")).clear();
driver.findElement(By.id("inputStarts")).sendKeys(key2);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.