Coder Social home page Coder Social logo

fezi / fezi-webtest Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 15.73 MB

Template for automated browser tests with Geb

Groovy 69.09% Shell 17.43% Batchfile 13.48%
geb selenium groovy webtest test firefox phantomsj template chrome automated-browser-testing

fezi-webtest's Introduction

What is it?

This is a project template to get you started quickly with automated browser tests using

  • Geb (written in Groovy, uses Selenium)
  • Maven
  • TestNG (JUnit, Cucumber, Spock might be used as runner, too)

Latest versions as of 2017-12-02 are used.

Why Geb?

  • Geb supports DRY principle better than plain Selenium, reducing maintenance effort. Concepts of page and module ("tile") and other convenient stuff.
  • Uses jQuery style selectors most developers already know
  • Still allows for Selenium WebDriver API usage, if ever needed

Why this template?

Following features where added (compared to more naked Geb projects):

  • Mixing Java 8 code with Groovy code is supported.
  • Mobile/responsive Website testing support: MyFirstMobileTest uses a UserAgent String and a window size typical smartphones.
  • geb-reports (html and screenshot-png with current browser state - useful for debugging CI builds) survive 'mvn clean'
  • Fast Chrome pre-configured. Get started & work quickly.
  • added http header field "X-webtest" so your server knows whether the client is a webtest (e.g. to turn of conversion counting)

    Requirements

    • Google Chrome Browser
      Ubuntu did fine with Chromium as well.
      You could use -Dgeb.env to setup different browsers (Firefox, headless PhantomJS), see file GebConfig. Additional setup required to do so.
      If you want to use a custom Chrome installation, set environment variable CHROME_EXECUTABLE (pointing to the executable)

    • JDK 8
      You can get it from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
      Version should be downgrade-able as well by changing pom.xml. We recommend IntelliJ IDEA (free community edition is sufficient) for its out-of-the-box TestNG and Maven support. And even some Geb support. Just click the green run triangle in an opened *Test class.

    Nothing else!

    If you get "could not connect to renderer" error but Chrome window has opened, you propably need to update the chrome driver (project root folder) with downloads provided at https://chromedriver.storage.googleapis.com/index.html . See ChromeDriverHelper to learn how OS and filename correlate.

    Execute

    Either of those:

    • Open e.g. MyFirstTest in your IDE and execute (as TestNG test)
    • Run 'mvn test' on command line (or 'mvnw test' if you dont have Maven installation yet). This will use TestNG suite defintion testng-default.xml

    Where to start to learn

    Technology Example File
    Geb PlainGebScriptingExample
    Groovy GroovyLearner

    Where to start to adapt (to your website)

    1. Set GebConfig.baseUrl to your actual baseUrl. Geb's homepage is pre-defined.
    2. Adapt MyFirstTest and MyFirstPage to your needs.

    Also see

    https://github.com/geb/geb-example-maven more naked geb example
    http://gebish.org/manual/2.0/ Geb doc

  • fezi-webtest's People

    Contributors

    fezi avatar

    Watchers

     avatar  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.