Skip to content

A simple framework based on Cucumber, Page Object Model, Selenium, TestNG using Java.

Notifications You must be signed in to change notification settings

bharathish-diggavi/cucumber-testng-framewrok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cucumber-testng-framewrok

A simple framework based on Cucumber, Page Object Model, Selenium, TestNG using Java.

This framework is based in Page Object Model (POM).

The framework uses:

  1. Java
  2. Selenium
  3. TestNG
  4. Cucumber

Steps to create test cases:

Let's say we want to automate Google search test.

1.Create googlesearch.feature in src/test/resources/features folder.
Feature file is reference for which part of the application we'll be testing. It contains Scenarios and Scenario Outlines. For more details Click here

	Feature: Google Search
	
	Scenario Outline: Google Text Search Test
		Given I go to google page
		When I search for "<key>"
		Then I should get results for "<key>"
		Examples:
		|key|
		|key1|
		|key2|
  1. Create step definition for the feature file in GoogleStepDefs.java
	@Given("I go to google page")
	public void i_go_to_google_page() {
		WebDriverContext.getDriver().get("https://www.google.co.in/");
		System.out.println("Inside i_go_to_google_page");
	}

	@When("I search for {string}")
	public void i_search_for(String string) {
		new GooglePage().searchText(string);
		System.out.println("Inside i_search_for");
	}

	@Then("I should get results for {string}")
	public void i_should_get_results_for(String string) {
		System.out.println("Inside i_should_get_results_for");
		new GooglePage().veriFySearchResultPage(string);
	}
  1. Execute scripts by running command
	mvn clean test
  1. You can see logs in logfile.log file
  2. You can see reports in reports folder

Framework Features

By default framework executes scenarios in parallel.If it is not required, change following in ApplicationTest.java

	@Override
    @DataProvider(parallel = false)
    public Object[][] scenarios() {
        return super.scenarios();
    }

About

A simple framework based on Cucumber, Page Object Model, Selenium, TestNG using Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published