Skip to content

Commit 1aed525

Browse files
committed
updated
1 parent da7b646 commit 1aed525

File tree

9 files changed

+284
-1
lines changed

9 files changed

+284
-1
lines changed

.idea/uiDesigner.xml

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

json_output/cucumber.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"line":1,"elements":[{"start_timestamp":"2023-05-28T20:43:37.787Z","line":3,"name":"Validate login screen","description":"","id":"validate-successfull-login;validate-login-screen","type":"scenario","keyword":"Scenario","steps":[{"result":{"duration":2000400,"status":"passed"},"line":5,"name":"user is in the login screen","match":{"location":"stepDefinitions.Login_SD.user_is_in_the_login_screen()"},"keyword":"Given "},{"result":{"status":"passed"},"line":6,"name":"user enters username and password","match":{"location":"stepDefinitions.Login_SD.user_enters_username_and_password()"},"keyword":"When "},{"result":{"duration":1000200,"status":"passed"},"line":7,"name":"user clicks on login button","match":{"location":"stepDefinitions.Login_SD.user_clicks_on_login_button()"},"keyword":"And "},{"result":{"status":"passed"},"line":8,"name":"user will be on the Homepage screen","match":{"location":"stepDefinitions.Login_SD.user_will_be_on_the_homepage_screen()"},"keyword":"Then "}]}],"name":"Validate successfull Login","description":"","id":"validate-successfull-login","keyword":"Feature","uri":"file:src/test/java/features/login.feature","tags":[]}]

junit_xml/cucumber.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuite name="Cucumber" time="0.187" tests="1" skipped="0" failures="0" errors="0">
3+
<testcase classname="Validate successfull Login" name="Validate login screen" time="0.023">
4+
<system-out><![CDATA[
5+
Given user is in the login screen...........................................passed
6+
When user enters username and password......................................passed
7+
And user clicks on login button.............................................passed
8+
Then user will be on the Homepage screen....................................passed
9+
]]></system-out>
10+
</testcase>
11+
</testsuite>

pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,22 @@
3030
<scope>compile</scope>
3131
</dependency>
3232

33+
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
34+
<dependency>
35+
<groupId>io.cucumber</groupId>
36+
<artifactId>cucumber-java</artifactId>
37+
<version>7.12.0</version>
38+
</dependency>
39+
40+
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
41+
<dependency>
42+
<groupId>io.cucumber</groupId>
43+
<artifactId>cucumber-junit</artifactId>
44+
<version>7.12.0</version>
45+
<scope>test</scope>
46+
</dependency>
47+
3348
</dependencies>
34-
</project>
49+
50+
</project>
51+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Feature: Validate successfull Login
2+
3+
Scenario: Validate login screen
4+
5+
Given user is in the login screen
6+
When user enters username and password
7+
And user clicks on login button
8+
Then user will be on the Homepage screen
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package runner;
2+
3+
import io.cucumber.junit.Cucumber;
4+
import io.cucumber.junit.CucumberOptions;
5+
import org.junit.runner.RunWith;
6+
7+
@RunWith(Cucumber.class)
8+
@CucumberOptions(
9+
features = "src/test/java/features/login.feature", //the path of the feature files
10+
glue={"stepDefinitions"}, //the path of the step definition files
11+
plugin= {"pretty","html:test-outout", "json:json_output/cucumber.json", "junit:junit_xml/cucumber.xml"}, //to generate different types of reporting
12+
monochrome = true //display the console output in a proper readable format
13+
// dryRun = false //to check the mapping is proper between feature file and step def file
14+
//tags = {"~@SmokeTest" , "~@RegressionTest", "~@End2End"}
15+
)
16+
public class TestRunner {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package stepDefinitions;
2+
3+
import io.cucumber.java.en.Given;
4+
import io.cucumber.java.en.Then;
5+
import io.cucumber.java.en.When;
6+
7+
public class Login_SD {
8+
9+
@Given("user is in the login screen")
10+
public void user_is_in_the_login_screen() {
11+
// Write code here that turns the phrase above into concrete actions
12+
System.out.println("user is in the login screen");
13+
}
14+
@When("user enters username and password")
15+
public void user_enters_username_and_password() {
16+
// Write code here that turns the phrase above into concrete actions
17+
System.out.println("user enters username and password");
18+
}
19+
@When("user clicks on login button")
20+
public void user_clicks_on_login_button() {
21+
// Write code here that turns the phrase above into concrete actions
22+
System.out.println("user clicks on login button");
23+
}
24+
@Then("user will be on the Homepage screen")
25+
public void user_will_be_on_the_homepage_screen() {
26+
// Write code here that turns the phrase above into concrete actions
27+
System.out.println("user will be on the Homepage screen");
28+
}
29+
}

src/test/java/tests/testNG.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package tests;
2+
3+
import org.testng.annotations.BeforeClass;
4+
import org.testng.annotations.BeforeMethod;
5+
import org.testng.annotations.BeforeTest;
6+
import org.testng.annotations.Test;
7+
8+
public class testNG {
9+
10+
@BeforeClass
11+
public void launchbrowser() {
12+
System.out.println("launch browser");
13+
}
14+
@BeforeMethod
15+
public void enterurl() {
16+
System.out.println("enter url");
17+
}
18+
@BeforeTest
19+
public void login() {
20+
System.out.println("login to app");
21+
}
22+
23+
@Test
24+
public void validateTitle() {
25+
System.out.println("validate page title");
26+
}
27+
28+
29+
}

0 commit comments

Comments
 (0)