Skip to content

xpcrts/WebTest-FREINDRESRC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebTest

KEEN Template to automate Web Application Test with Selenium, Cucumber, TestNG, Junit Test and Apache Maven.

It handles almost all the headache in starting new automated testing project with java as the client library. You just have to start coding, then run your test framework from either Intellij IDEA or command prompt or terminal.

By the help of maven-cucumber-reporting, result of the tests will be generated automatically with the awesome bootstrap-based html.

Documentation

Prerequisite

This WebTest template use Cucumber framework with Gherkin to get the advantages of .feature files.

  • If you are not familiar with Gherkin, please refer https://cucumber.io/docs/reference for language concepts and its syntax.
  • Check your Java JDK, by run java -version in command prompt(Windows) or terminal(macOS). If you could see the version of java, then it has been installed, otherwise, please install it based on your operating system.**Make Sure you have set JAVA_HOME to jdk folder and jdk\bin to PATH (refer here).
  • Make sure that you have maven installed by run mvn -v in command prompt(Windows) or terminal(macOS). If you could see the version of maven, then it has been installed, otherwise, please install it based on your operating system. (refer here)
  • IDE requirement is Intellij Idea; either the Ultimate or the Community one would be fine.

Getting Started

Let's get our hand dirty.

  • If you are new to Intellij IDEA and you haven't got Git installed on your machine, please kindly download it from the official git website here. After git installation, you are good to go.
  • Launch Intellij IDEA,
    • if you are on Welcome Screen, choose check out from version control and in the dropdown, choose Git.
    • if you are not, on Intellij Menu Bar, choose File then New and click Project On Version Control and finally choose Git from the dropdown.
  • On Clone Repository Window,

Template Exploration

There should be four packages under src\test\java directory. Each of them play a vital role.

  • BaseUtil class under Base package is written to declare WebDriver
  • Features package is to wrap all feature files which are used to describe Behavorial Driven Developement concepts
  • POM package is created to wrap all POM's classes that define the elements and the methods performing in a webpage.
  • TestRunner is written to specify test type (junit or testng) and to specify the output directory
  • Steps packages can have only one Hook class to initialize and terminate WebDriver but it has endless number of step classes based on the steps specifying in .feature files

The target directory which contains test result will be created once you have run the tests.

Configuration

Most of the configurations are specified in the template itself via comments. But Do not to forget to

  • Configure the variables in src\test\java\Steps\Hook.java (See examples and suggestios in the Hook.java itself)
  • In src\test\java\Steps\Hook.java on Line 49 and 50, comment or delete one of the driver because you can run a test with only one driver at a time.

After this configuration, you now can define your .feature files as many as desired, and define the steps in src\test\java\Steps in many classes as prefered.

Automate TestCases

In src\test\java\Runner\TestRunner.java, the default set up is good to go already. Right Click and choose Run TestRunner. By doing this, the test result will be generated automatically by cucumber-testng.

To get maven-cucumber-reporting, you have to run the test from command line(on Windows) or from terminal(on macOS).

  • if you do not have maven on your system, please kindly install it.
  • Launch window command prompt or macOS terminal, navigate to the project you are working on.
  • Run mvn clean to clean the previous test target folder
  • Run mvn verify to automate the test

The result will be generated in target/kit-keen-webTest-html/cucumber-html-reports.Nota Bene: the kit-keen-webTest-html might be changed if you changed the folder name in the configuartion.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published