Table of Contents
Gradle: 8.6 - Build Tool
Selenide: 7.2.1 - WebDriver
JUnit5: 5.10.2 - Testing Framework
Allure: 2.25.0 - Report Framework
├── gradle
│ ├── config
│ │ ├── allure.gradle
│ │ ├── compilation.gradle
│ │ ├── dependencies.gradle
│ │ └── test.gradle
│ ├── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── helpers.gradle
│ └── versions.gradle
├── images
│ └── **/*.png
├── src/test
│ ├── java/com/github/ngoanh2n/example
│ │ ├── common
│ │ │ ├── AbstractPage.java
│ │ │ └── AbstractTest.java
│ │ ├── models
│ │ │ └── Account.java
│ │ ├── pages
│ │ │ ├── shared
│ │ │ │ └── Header.java
│ │ │ ├── LoginPage.java
│ │ │ └── PortalPage.java
│ │ └── scripts
│ │ └── ExampleTest.java
│ └── resources
│ ├── account.yml
│ ├── allure.properties
│ ├── categories.json
│ ├── junit-platform.properties
│ ├── log4j.properties
│ └── selenide.properties
├── .gitignore
├── README.md
├── build.gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
You can change values for your case.
Configuring log4j involves assigning the Level, defining Appender, and specifying Layout objects in a configuration file.
Settings can be set either via system property or programmatically.
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.
For configuring all Allure properties by passing classpath.
For defining categories to group tests. Below is a sample category.
{ "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
Use JVM System Property selenide.browser
to pass expected browser.
Giving values can be: [chrome
, edge
, firefox
, safari
, ie
].
gradlew test -Dselenide.browser=firefox
Note
: If run safari, you must enable the Allow Remote Automation
option in Safari's Develop menu to control Safari via WebDriver.
You can filter tests by using option --tests
.
Giving values can be [TestPackage
, TestClass
, TestMethod
].
gradlew test -Dselenide.browser=firefox --tests ExampleTest.passedTest
Refer to Test Filtering for more information.
Add task allureReport
to your test command.
It generates from build/allure-results
to build/allure/allureReport
.
gradlew 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 toselenide-junit5-allure-example/build/allure/allureReport
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
security.fileuri.strict_origin_policy
- Finally, change value to
false
, and refresh tabAllure Report
Otherwise, you can see below.