Giter VIP home page Giter VIP logo

gaugetest's Introduction

About this template

This is a template to get started with a Gauge project that uses Selenium as the driver to interact with a web browser.

Installing this template

gauge --install java_selenium

Building on top of this template

Define a Specification

  • Create a new file under specs directory, say "hello_world.spec".
  • Define your specification in this file, an example below
Sample Specification
====================

This is an executable specification file. This file follows markdown syntax. Every heading in this file denotes a scenario. Every bulleted point denotes a step.
To execute this specification, use
	mvn test

* Navigate to "http://getgauge.io"

Search for Gauge Documentation
------------------------------

* Go to Gauge Get Started Page

Read more about Specifications

Writing the implementations

This is where the java implementation of the steps would be implemented. Since this is a Selenium based project, the java implementation would invoke Selenium APIs as required.

We recommend considering modelling your tests using the Page Object pattern, and the Webdriver support for creating them.

  • Create a new class called, say, SampleTest.java
  • Add the Step implementation in the class, an example is below:
import com.thoughtworks.gauge.Gauge;
import com.thoughtworks.gauge.Step;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import static org.junit.Assert.assertTrue;

public class SampleTest {

    @Step("Navigate to <url>")
    public void navigateTo(String url) {
        Driver.driver.get(url);
        assertTrue(Driver.driver.getTitle().contains("Gauge"));
    }

    @Step("Go to Gauge Get Started Page")
    public void gotoGetStartedPage() throws InterruptedException {
        WebElement getStartedButton = Driver.driver.findElement(By.xpath("//*[@id=\"content\"]/section[1]/section/div[2]/a[1]"));
        getStartedButton.click();
        Gauge.writeMessage("Page title is ", Driver.driver.getTitle());
    }
}
  • Note that every Gauge step implementation is annotated with a Step attribute that takes the Step text pattern as a parameter. Read more about Step implementations in Java

gaugetest's People

Contributors

ginogalotti avatar

Stargazers

 avatar

Watchers

James Cloos 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.