Giter VIP home page Giter VIP logo

my_time's Introduction

Mytime Automation Assignment

This is a smaller version of a Java project that I have been using for some time in a couple of clients, and when teaching courses, no private content is being shared.

I have modified the project to have only the technologies needed for the automation proposal; however, there may be some unused code left behind due to the short time I had to do this validation. My apologies if this does happen.

The project consists of a BDD suite of tests, containing:

  • .feature file, located at src/test/resources/products/website/
  • object classes, located at src/test/java/com/mytime/products/website/objects/
  • step definition classes, located at src/test/java/com/mytime/products/website/stepdefs/
  • runner class, located at src/test/java/com/mytime/products/website/runner

In order to execute the project, the runner file should be used, either by accessing an IDE of choice, i.e. Intellij, or by using the command line in the project folder:

mvn clean test -Dtest=com.mytime.products.website.runner.Run`

All actions are handled by the Support or Intern classes, i.e., The Stepdefinition class extends the Support class responsible for the technology used; in this case: CoreWeb, this class have multiple encapsulated methods that will inherit some navigation flows for all predefined actions already set. i.e. find(string).get().text();.

Those methods will then trigger the plugin's actions, i.e., Selenium and exception handlers, on the LocatorWeb and Execute classes.

Every action will trigger Log inputs and a new HTML report section (feature, scenario, step, action, screenshot, error, tables, and markdowns).

Three observable classes trigger some event listeners to automatically generate the HTML report file, some sections, perform validations on the code, and test structure.

src/test/java/com/mytime/intern/plugin/ListCucumber.java
src/test/java/com/mytime/intern/plugin/ListCucumberDetailed.java
src/test/java/com/mytime/intern/plugin/ListCucumberExecute.java

These plugins (observables) are configured on the runner class and will trigger those event listeners:

TestCaseStarted
TestCaseFinished
TestStepStarted
TestStepFinished
TestRunFinished
TestRunStarted

The validations on the observables are:

  • Every scenario must begin with the keyword 'Given'.
  • Every scenario must have at least one assertion.
  • Every scenario must have at least one 'When' keyword.
  • Every scenario must have at least one 'Then' keyword.
  • Every 'Then' keyword must have at least one assertion.
  • Every 'And' keyword that comes after 'Then' keyword must have at least one assertion.

The Instances class and some of its structure were requested by some clients and can be easily changed; however, due to a relatively short time to do this task, no further modification was done.

The HTML report is based on the latest version of ExtentReports with some modifications. The screenshots can be seen at the side of its equivalent action, and once opened, it pops up a modal, where you can navigate between them. Most of this content, including the carousel, is custom-made, so you won't be able to find it on the framework's website. You can find this file at src/test/resources/report/

To fully open the HTML report, open the second view on the left menu > click on the scenario name > click on the step name > *click on the before or after

*The before and after elements are displayed if the action had a screenshot. Every 'Then' and subsequent 'And' keyword must have at least one screenshot.

There is also a .log file that is generated at src/test/resources/logs/

Environment

In order to execute the project, you have to install Java 8, Android SDK, and Maven (If you’re willing to run the project from a command line or a .bat file).

The following environment variables have to be configured:

JAVA_HOME

MAVEN_HOME

Google Chrome must be installed to execute drivers based on chromium

my_time's People

Contributors

felipe-amorim avatar felipe-souza-amorim avatar

Watchers

James Cloos avatar  avatar

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.