Commit 0b221490 authored by Vivian Che's avatar Vivian Che

Initial commit

parents
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="cucumber" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cucumber</groupId>
<artifactId>cucumber</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<cucumber.version>6.8.1</cucumber.version>
<junit.version>4.13</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.11.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package hellocucumber;
import io.cucumber.java.After;
import io.cucumber.java.Before;
import io.cucumber.java.Scenario;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.junit.Assert;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.PageFactory;
public class AmazonSearchSteps {
private WebDriver driver;
@Before
public void setUp() {
System.setProperty("webdriver.chrome.driver", "/usr/local/bin/ChromeDriver");
driver = new ChromeDriver();
}
@After
public void tearDown(Scenario scenario) {
if (scenario.isFailed()) {
final byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot, "image/png", "amazon");
}
closeBrowser();
}
@Given("^I navigated to Google$")
public void i_navigated_to_Google() throws Throwable {
driver.get("http://www.google.com");
}
@When("^I searched for Amazon$")
public void i_searched_for_Amazon() throws Throwable {
HomePage page = PageFactory.initElements(driver, HomePage.class);
page.setSearchBox("Amazon");
page.clickSubmit();
}
@Then("^the result should show for Amazon$")
public void the_result_should_show_for_Amazon() throws Throwable {
Assert.assertTrue(driver.getTitle().contains("Amazon"));
}
void closeBrowser() {
driver.quit();
}
}
package hellocucumber;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class BackGroundSteps {
@Given("^I navigate to the login page$")
public void i_navigate_to_the_login_page() throws Throwable {
System.out.println("I am at the LogIn Page");
}
@When("^I submit username and password$")
public void i_submit_username_and_password() throws Throwable {
System.out.println("I Submit my Username and Password");
}
@Then("^I should be logged in$")
public void i_should_be_logged_in() throws Throwable {
System.out.println("I am logged on to the website");
}
@Given("^User search for Lenovo Laptop$")
public void user_searched_for_Lenovo_Laptop() throws Throwable {
System.out.println("User searched for Lenovo Laptop");
}
@When("^Add the first laptop that appears in the search result to the basket$")
public void add_the_first_laptop_that_appears_in_the_search_result_to_the_basket() throws Throwable {
System.out.println("First search result added to bag");
}
@Then("^User basket should display with added item$")
public void user_basket_should_display_with_item() throws Throwable {
System.out.println("Bag is now contains the added product");
}
@Given("^User navigate for Lenovo Laptop$")
public void user_navigate_for_Lenovo_Laptop() throws Throwable {
System.out.println("User navigated for Lenovo Laptop");
}
@When("^Add the laptop to the basket$")
public void add_the_laptop_to_the_basket() throws Throwable {
System.out.println("Laptop added to the basket");
}
}
package hellocucumber;
public class Book {
private String title;
private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
package hellocucumber;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class BookStore {
private List<Book> books = new ArrayList<>();
public void addBook(Book book) {
books.add(book);
}
public void addAllBooks(Collection<Book> books) {
this.books.addAll(books);
}
public List<Book> booksByAuthor(String author) {
return books.stream()
.filter(book -> Objects.equals(author, book.getAuthor()))
.collect(Collectors.toList());
}
}
\ No newline at end of file
package hellocucumber;
import io.cucumber.java.Before;
import io.cucumber.java.en.Given;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class BookStoreSteps {
private BookStore store = new BookStore();
private List<Book> foundBooks;
@Before
public void setUp() {
foundBooks = new ArrayList<>();
}
@Given("^I have the following books in the store$")
public void i_have_the_following_books_in_the_store(DataTable data) {
List<Map<String, String>> rows = data.asMaps(String.class, String.class);
for (Map<String, String> columns : rows) {
store.addBook(new Book(columns.get("title"), columns.get("author")));
}
}
@When("^I search for books by author Erik Larson$")
public void i_search_for_books_by_author_Erik_Larson() throws Throwable {
foundBooks = store.booksByAuthor("Erik Larson");
}
@Then("^I find (\\d+) books$")
public void i_find_books(int arg1) throws Throwable {
assertEquals(arg1, foundBooks.size());
}
}
package hellocucumber;
public class Calculator {
public int add(int num1,int num2) {
return num1+num2;
}
public int subtract(int num1,int num2) {
return num1-num2;
}
}
package hellocucumber;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import static org.junit.Assert.assertEquals;
public class CalculatorSteps {
private int total;
private Calculator calculator;
@Given("^I have a calculator$")
public void i_have_a_calculator() throws Throwable {
// Write code here that turns the phrase above into concrete actions
calculator = new Calculator();
}
@When("^I add (-?\\d+) and (-?\\d+)$")
public void i_add_and(int arg1, int arg2) throws Throwable {
// Write code here that turns the phrase above into concrete actions
total = calculator.add(arg1,arg2);
}
@Then("^the result should be (-?\\d+)$")
public void the_result_should_be(int arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
assertEquals(arg1, total);
}
}
package hellocucumber;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class CatFactsSteps {
private String url;
private Response response;
@Given("^the client makes a call to the hero ku$")
public void the_client_makes_a_call_to_the_hero_ku() throws Throwable {
// Write code here that turns the phrase above into concrete actions
url="https://cat-fact.herokuapp.com";
}
@When("^the user calls the api for facts$")
public void the_user_calls_the_api_with_facts() throws Throwable {
// Write code here that turns the phrase above into concrete actions
//response = restTemplate.getForEntity(new URI(url+"/facts"), String.class);
response = RestAssured.given().baseUri(url).basePath("/facts").get().then().log().status().extract().response();
}
@Then("^the client receives status of (\\d+)$")
public void the_client_receives_status_of(int arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
assertEquals(arg1, response.getStatusCode());
}
@Then("^the response has the text$")
public void the_response_has_the_text(DataTable data) throws Throwable {
// Write code here that turns the phrase above into concrete actions
// For automatic transformation, change DataTable to one of
// List<YourType>, List<List<E>>, List<Map<K,V>> or Map<K,V>.
// E,K,V must be a scalar (String, Integer, Date, enum etc)
List<Map<String, String>> rows = data.asMaps(String.class, String.class);
for (Map<String, String> row : rows) {
String text = row.get("text");
assertTrue(response.getBody().asString().indexOf(text)>0);
}
}
}
\ No newline at end of file
package hellocucumber;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
public class HomePage {
WebDriver driver;
public HomePage(WebDriver driver) {this.driver = driver;}
//name is the name of element, you can also replace with ID
@FindBy(how = How.NAME, using = "q")
public WebElement searchBox;
@FindBy(how=How.NAME, using = "btnK")
public WebElement submit;
public void setSearchBox(String searchString) {
searchBox.sendKeys(searchString);
}
public void clickSubmit() { submit.submit(); }
}
package hellocucumber;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty",
"html:target/surefire-reports/html",
"json:target/surefire-reports/json/report.json",
"junit:target/surefire-reports/junit/report.xml"
},
monochrome = true,
tags = "@wip"
)
public class RunCucumberTest {
}
@wip
Feature: Google
NBSP AS a user
NBSP I want to navigate to Google
NBSP So that I can search for Amazon
Scenario: Search Amazon
Given I navigated to Google
When I searched for Amazon
Then the result should show for Amazon
\ No newline at end of file
Feature: The purpose of this feature is to test the Background keyword
Background: User is Logged In
Given I navigate to the login page
When I submit username and password
Then I should be logged in
Scenario: Search a product and add the first product to the User basket
Given User search for Lenovo laptop
When Add the first laptop that appears in the search result to the basket
Then User basket should dispaly with added item
Scenario: Navigated to a product and add the same to the User basket
Given User navigate for Lenovo Laptop
When Add the laptop to the basket
Then User basket should display with added item
\ No newline at end of file
Feature: Book Store
Scenario: Correct non-zero number of books found by author
Given I have the following books in the store
| title | author |
| The Devil in the White City | Erik Larson |
| The Lion, the Witch and the Wardrobe | C.S. Lewis |
| In the Garden of Beasts | Erik Larson |
When I search for books by author Erik Larson
Then I find 2 books
\ No newline at end of file
@hip
Feature: Test Cat Facts API
Scenario: User initiates a request to get facts about cats
Given the client makes a call to the hero ku
When the user calls the api for facts
Then the client receives status of 200
And the response has the text
| text |
| Cats make more than 100 different sounds whereas dogs make around 10. |
| Owning a cat can reduce the risk of stroke and heart attack by a third. |
\ No newline at end of file
Feature: Calculator
  As a user
  I want to use a calculator to add numbers
  So that I don't need to add myself
Scenario Outline: Add two numbers <num1> & <num2>
Given I have a calculator
When I add <num1> and <num2>
Then the result should be <total>
Examples:
| num1 | num2 | total |
| -2 | 3 | 1 |
| 10 | 15 | 25 |
| 99 | -99 | 0 |
| -1 | -10 | -11 |
This source diff could not be displayed because it is too large. You can view the blob instead.
[
{
"line": 2,
"elements": [
{
"start_timestamp": "2022-02-18T17:43:42.543Z",
"before": [
{
"result": {
"duration": 1000000,
"status": "passed"
},
"match": {
"location": "hellocucumber.BookStoreSteps.setUp()"
}
},
{
"result": {
"duration": 1766000000,
"status": "passed"
},
"match": {
"location": "hellocucumber.AmazonSearchSteps.setUp()"
}
}
],
"line": 7,
"name": "Search Amazon",
"description": "",
"id": "google;search-amazon",
"after": [
{
"result": {
"duration": 105000000,
"status": "passed"
},
"match": {
"location": "hellocucumber.AmazonSearchSteps.tearDown(io.cucumber.java.Scenario)"
}
}
],
"type": "scenario",
"keyword": "Scenario",
"steps": [
{
"result": {
"duration": 953000000,
"status": "passed"
},
"line": 8,
"name": "I navigated to Google",
"match": {
"location": "hellocucumber.AmazonSearchSteps.i_navigated_to_Google()"
},
"keyword": "Given "
},
{
"result": {
"duration": 1410000000,
"status": "passed"
},
"line": 9,
"name": "I searched for Amazon",
"match": {
"location": "hellocucumber.AmazonSearchSteps.i_searched_for_Amazon()"
},
"keyword": "When "
},
{
"result": {
"duration": 13000000,
"status": "passed"
},
"line": 10,
"name": "the result should show for Amazon",
"match": {
"location": "hellocucumber.AmazonSearchSteps.the_result_should_show_for_Amazon()"
},
"keyword": "Then "
}
],
"tags": [
{
"name": "@wip"
}
]
}
],
"name": "Google",
"description": " NBSP AS a user\n NBSP I want to navigate to Google\n NBSP So that I can search for Amazon",
"id": "google",
"keyword": "Feature",
"uri": "classpath:hellocucumber/amazon_search.feature",
"tags": [
{
"name": "@wip",
"type": "Tag",
"location": {
"line": 1,
"column": 1
}
}
]
}
]
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<testsuite errors="0" failures="0" name="io.cucumber.core.plugin.JUnitFormatter" skipped="0" tests="1" time="4.488">
<testcase classname="Google" name="Search Amazon" time="4.309">
<system-out><![CDATA[Given I navigated to Google.................................................passed
When I searched for Amazon..................................................passed
Then the result should show for Amazon......................................passed
]]></system-out>
</testcase>
</testsuite>
@wip
Feature: Google
NBSP AS a user
NBSP I want to navigate to Google
NBSP So that I can search for Amazon
Scenario: Search Amazon
Given I navigated to Google
When I searched for Amazon
Then the result should show for Amazon
\ No newline at end of file
Feature: The purpose of this feature is to test the Background keyword
Background: User is Logged In
Given I navigate to the login page
When I submit username and password
Then I should be logged in
Scenario: Search a product and add the first product to the User basket
Given User search for Lenovo laptop
When Add the first laptop that appears in the search result to the basket
Then User basket should dispaly with added item
Scenario: Navigated to a product and add the same to the User basket
Given User navigate for Lenovo Laptop
When Add the laptop to the basket
Then User basket should display with added item
\ No newline at end of file
Feature: Book Store
Scenario: Correct non-zero number of books found by author
Given I have the following books in the store
| title | author |
| The Devil in the White City | Erik Larson |
| The Lion, the Witch and the Wardrobe | C.S. Lewis |
| In the Garden of Beasts | Erik Larson |
When I search for books by author Erik Larson
Then I find 2 books
\ No newline at end of file
@hip
Feature: Test Cat Facts API
Scenario: User initiates a request to get facts about cats
Given the client makes a call to the hero ku
When the user calls the api for facts
Then the client receives status of 200
And the response has the text
| text |
| Cats make more than 100 different sounds whereas dogs make around 10. |
| Owning a cat can reduce the risk of stroke and heart attack by a third. |
\ No newline at end of file
Feature: Calculator
  As a user
  I want to use a calculator to add numbers
  So that I don't need to add myself
Scenario Outline: Add two numbers <num1> & <num2>
Given I have a calculator
When I add <num1> and <num2>
Then the result should be <total>
Examples:
| num1 | num2 | total |
| -2 | 3 | 1 |
| 10 | 15 | 25 |
| 99 | -99 | 0 |
| -1 | -10 | -11 |
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment