Giter VIP home page Giter VIP logo

gradle_junit5_selenide_logback_allure's Introduction

Gradle + jUnit5 + logback + Selenide + Allure reports

A sample gradle base project which uses jUnit5 for running tests, logback library for logging, Selenide for browser manipulations and Allure framework for reporting.

To Run

  • will run all the test inside src/test/tests.
    $ gradlew clean test --tests tests.* -i
  • will run all the test inside src/test/tests on Prod env.
    $ gradlew clean test --tests tests.* -i -Denv=prod
  • will run all the test inside src/test/tests on Prod env in firefox browser.
    $ gradlew clean test --tests tests.* -i -Denv=prod -Dselenide.browser=firefox

After the tests are ran, you can see:

  • jUnit test reports under build/reports/tests/index.html
  • logs from sifter appender under build/logs/test_case_name.log
  • screenshots and saved page sources from Selenide build/reports/tests
  • Allure results build/allure-results
  • Allure report build/reports/allure-report

Allure configuration

  • Allure CLI should be installed
  • Allure results stored in build/allure-results
  • Allure report stored in build/reports/allure-report
  • To open allure report
    $ allure open path_to_allure_report_folder

Allure-Selenide

  • Allure report will contain Selenide browser interaction history, screenshots/page sources for failing test cases

Allure-Logback

  • Each test case will have log file attached as an attachment

Selenide configuration

Selenide provides a lot of things out of the box, no extra configuration required for sample project. In case you would like to do custom configuration you can find an example in AppConfiguration.class.

  • Default browser is chrome
  • By default Selenide puts screenshots and .html to folder build/reports/tests
  • To change the browser you can use -Dselenide.browser=firefox

Logback configuration

You can find logback configuration here src/test/resources

Current configuration contains two appenders:

  • ConsoleAppender will output logs to system out stream
  • SiftingAppender will output logs to separate build/logs/${testCaseName}.log for each test case

Framework configuration

Page objects

Path src/main/pages

AppConfiguration

This class makes generic configuration for the framework and allows us to run tests on different environments by passing system property.

./gradlew clean test --tests tests.* -i -Denv=prod

ConfigurationSetupHook

Initialize application configuration Before test run

LogWatcher

Creates separate logger before each test case and attaches log file to allure report after each test case

RunContext

Represents test run context storage which allows to save/get data and share it between test cases/test classes during test run.

Example:
RunContext.put("key", 123);

int value = RunContext.get("key", Integer.class);

Libraries Used

gradle_junit5_selenide_logback_allure's People

Contributors

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