Table of Contents
JDK 17
Gradle 8(optional, wrapper is included in project)
Gradle: 8.6 - Build Tool
Selenide: 7.2.0 - WebDriver wrapper
Rest-assured: 5.4.0 - Api testing
Allure: 2.25.0 - Report Framework
JUnit5 - Jupiter: 5.10.2 - Testing Framework
Owner: 1.0.12 - Configuration management
$ git clone https://github.com/Legionivo/test-task.git
- Run tests(Linux/MacOS commands):
-
./gradlew clean test
- run all tests -
./gradlew clean test -Dtags=Sometag
- run tests filtered by "Sometag" -
./gradlew clean test -Dexcludetags=Sometag
- exclude tests filtered by "Sometag" -
./gradlew clean test -Dexcludetags=sometag1,sometag2
- exclude tests filtered by multiple tags -
./gradlew clean test -Dselenide.browser=browsername
- run tests in different browser -
./gradlew clean test -Dbase.url=https://example.com
- configure BaseUrl of application -
./gradlew clean test -Dselenide.remote=http://seleniumgrid.example.com:4444/wd/hub
- run tests in Selenium Hub- Additional command line arguments see in com.codeborne.selenide/Configuration
You can change values for your case.
- log4j2.xml
Configuring log4j2 involves assigning the Level, defining Appender, and specifying Layout objects in a configuration file.
- config.properties
custom_config.properties
Configuration settings. 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.
The Owner is a Java library with the goal of minimizing the code required to handle application configuration via Java properties files. You can read more about usage here. My idea of using this library is to solve the problem when configuration files are overwritten by developers when pushing to the repository. Each developer often works with his own environment, uses different parameters, and it often happens that this configuration is sent to the main code branch. How can this be avoided? Everyone creates a custom_config.properties file and adds it to .gitignore. This file has a higher priority than the config.properties file. The owner library reads this file and applies the necessary parameters.
./gradlew clean test -Dselenide.browser=firefox
Browser can be:
- chrome
- edge
- firefox
- safari
- ie
Note
: If you 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
Task allureReport
generates Allure report from /build/allure-results
folder.
./gradlew allureReport
- Open allure report:
./gradlew allureServe
- generate Allure report and open it in the default browser
Otherwise, you can see below.