Giter Club home page Giter Club logo

wr-52.taqc-java-testproject's People

Contributors

muyanjakevin avatar neonilah avatar servettonga avatar thoughtseize1 avatar vtelt avatar

Watchers

 avatar  avatar

Forkers

muyanjakevin

wr-52.taqc-java-testproject's Issues

Introduce Faker library

Currently, the project has its own implementation of randomizing data, as shown in the snipped below.

public static List<String> randomUser() {
List<String> user = new ArrayList<>();
String email = "";
String password = "";
final String[] letters = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F",
"G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
"X", "Y", "Z" };
final String[] numbers = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
final String[] symbols = { "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "-", "=", "~" };
for (int i = 0; i < 5; i++) {
email += (letters[(int) (Math.random() * letters.length)]
+ numbers[(int) (Math.random() * numbers.length)]);
password += (letters[(int) (Math.random() * letters.length)]
+ numbers[(int) (Math.random() * numbers.length)]
+ symbols[(int) (Math.random() * symbols.length)]);
}
user.add(email + "@gmail.com");
user.add(password);
return user;
}

As mentioned by @ignatenko-paul it's a good idea to introduce Faker to do the job for you.

The goal of this issue is to replace the mentioned implementation with Faker.

Refactor ConfigurationManager

  1. The configs field could be an inline variable (inside the getConfig() method.
  2. Instead of referencing it from the file new File("src/test/resources/test.properties") it would be better to use Resource, as it is more abstract and will work also if the project get's packaged in a jar

public class ConfigurationManager {
protected static Configurations configs = new Configurations();
protected static Configuration config;
public static Configuration getConfig() {
if (config == null) {
try {
config = configs.properties(new File("src/test/resources/test.properties"));
} catch (ConfigurationException e) {
System.out.println("Configuration file not found");
e.printStackTrace();
System.exit(1);
}
}
return config;
}
}

Allure setup

Create a base allure setup.

  1. Create a test that uses it
  2. Document the process of setting it up locally in README.md

Refactor TestSetUp

  • Rename TestSetUp to BaseTest, so it's more meaningful. Also make it abstract
  • constant names should be written in UPPERCASE

Introduce @FindBy and PageFactory

Instead of looking for the elements "by hand" a useful annotation could be used instead.

This how it looks in action:

import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.FindBy;
 import org.openqa.selenium.support.PageFactory;
 
 public class LandingPage {
 
     @FindBy(css = "#Content a")
     private WebElement enterStoreLink;
 
     private WebDriver driver;
 
     public LandingPage(WebDriver driver) {
         this.driver = driver;
         PageFactory.initElements(driver, this);
     }
 
     public void clickOnEnterStoreLink() {
         enterStoreLink.click();
     }
 
 }

Refactor current pages to make use of this.

Add empty `.env` file and document it

.env file is required to run the tests.

  • create an empty (or a dummy) .env file in the correct place
  • expand README.md with the fields that are required there

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.