Execute Test on MS Edge
Now let’s see how to execute the same test in the MS Edge browser.
Pre-Requisites
Make sure you have installed the latest version of MS Edge which is Chromium-based.
Config changes specific to MS Edge
Edit the default.properties file under config folder, like below
# Web Config
# Web url of web application under test
web.url: http://google.com
# Target Browser. Supported values <any | chrome | firefox | msedge |responsive>
web.target: msedge
Execute test from IDE
Creating separate config for MS Edge
By default, the configs are read from default.properties.
However, we could create a separate config file for MsEdge. So instead of modifying default.properties let’s override it.
How do we override default.properties ?
Create a file msedge.properties and specify properties to override. That’s it.
Property | Would be read from | Why? | Property value |
---|---|---|---|
web.url | default.properties | No over rides available in msedge.properties | http://google.com |
web.target | msedge.properties | property is overridden | msedge |
Use msedge.properties config while running tests
Now that we created a separate config for msedge, we need to supply it during test execution
Pass the config to the Gradle task as below:
./gradlew clean runWebTests -Dconfig=msedge
This would trigger the tests and msedge.properties as config. Once the execution is complete the Allure reports are can be fetched with the below command
./gradlew allureServe
Creating Gradle task to execute tests for msedge config
Another way to execute tests is to create a Gradle task-specific to msedge config as below:
task runWebTestsOnMsedge(type: Test) {
systemProperties = [
config : "msedge"
]
filter {
excludeTestsMatching "*.mobile.*"
excludeTestsMatching "*.api.*"
excludeTestsMatching "*.db.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "2"))
includeGroups System.getProperty("tags", "web")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
Call the task like below:
./gradlew clean runWebTestsOnMsedge