Table of Contents generated with DocToc
Gradle: 6.1.1
Java: 1.8.0_211
IDE: IntelliJ IDEA 2019.3.1 (Community Edition)
Selenide: 5.6.1 - Web Driver
JUnit5 - Platform: 1.6.0 - Testing Launcher
JUnit5 - Jupiter: 5.6.0 - Testing Framework
JUnit5 - Vintage: 5.6.0 - Test Engine
Allure: 2.13.1 - Test Report
Allure Gradle: 2.8.1 - Gradle Plugin
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── images
│ └── **/*.png
├── src/test
│ ├── java/com/github/ngoanh2n/sjae
│ │ ├── common
│ │ │ ├── BasePage.java
│ │ │ └── BaseTest.java
│ │ ├── components
│ │ │ └── Header.java
│ │ ├── pages
│ │ │ ├── LoginPage.java
│ │ │ └── PortalPage.java
│ │ └── scenarios
│ │ └── ExampleTest.java
│ └── resources
│ ├── allure.properties
│ ├── categories.json
│ ├── junit-platform.properties
│ ├── log4j.properties
│ └── selenide.properties
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── build.gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
$ git clone https://github.com/ngoanh2n/selenide-junit5-allure-example.git
You can change values for your case.
- log4j.properties
Configuring log4j involves assigning the Level, defining Appender, and specifying Layout objects in a configuration file.
- selenide.properties
Configuration settings for Selenide default browser. Settings can be set either via system property or programmatically.
- junit-platform.properties
If a properties file with this name is present in the root of the classpath, it will be used as a source for configuration parameters. If multiple files are present, only the first one detected in the classpath will be used.
- allure.properties
Configuring all Allure properties by passing classpath.
- categories.json for Allure Report
Defining categories to group tests.
Category structure:{ "name": "{Category name}", "matchedStatuses": "{One or more statuses of tests}", "traceRegex": "{Exception name}", "messageRegex": "{The content or description of Exeception}" }
Define a category by the following:
matchedStatuses
-> The status of test, one inskipped
,passed
,broken
,failed
,unknown
traceRegex
-> Find the exception caused status to the testmessageRegex
-> Get content or description shortly or fullyname
-> Set category name based on above keys
./gradlew clean test allureReport
Task allureReport
: Build report from selenide-junit5-allure-example/build/allure-results
folder
- chrome
- firefox
- ie
- edge
- htmlunit
- phantomjs
- safari
If run safari, you must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver.
Able to select browser by passing system property selenide.browser
./gradlew clean test -Dselenide.browser=firefox allureReport
You can filter tests by using option --tests
Giving values can be TestPackage
, TestClass
, TestMethod
./gradlew clean test -Dselenide.browser=firefox --tests ExampleTest.passedTest allureReport
Note
: If your test command contains task allureReport
, when tests finished you can see below message in terminal likes.
> Task :allureReport
Report successfully generated to /Users/ngoanh2n/Desktop/Work/guides-test-automation/selenide-junit5-allure-example/build/reports/allure-report
Open your browser with above path by Firefox
Note
: If you see Allure report is displayed likes below image.
Then you have to do by the following:.
- Go to
about:config
in new tab - Search for
privacy.file_unique_origin
- Finally, change value to
false
, and refresh tabAllure Report
Otherwise, you can see below.