Skip to content

Commit c0b803e

Browse files
committed
Add Gradle 'personality' property; remove Maven POM and docs (#260)
1 parent b57a7c6 commit c0b803e

8 files changed

+14
-1018
lines changed

README.md

+6-21
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ With the release of **Selenium Foundation** version _26.3.4_, automation of Maci
1414
* [Building Selenium Foundation](#building-selenium-foundation)
1515
* [Building in Eclipse](#building-in-eclipse)
1616
* [Building from Command Line](#building-from-command-line)
17-
* [Maven Support](#maven-support)
18-
* [Maven Build Script](#maven-build-script---mvn-buildsh)
1917
* [Running Browser Unit Tests](#running-browser-unit-tests)
2018
* [Getting Started](#getting-started)
2119
* [Required Configuration](#required-configuration)
@@ -92,30 +90,17 @@ Use the `install` task to install SNAPSHOT builds in your local Maven repository
9290

9391
> **`gradle install`**
9492
95-
#### Maven Support
96-
97-
Although Gradle is used to produce official releases, **Selenium Foundation** also includes a fully functional Maven POM file.
98-
99-
> **`mvn package`**
100-
101-
Note that the version number in this POM file is merely a placeholder - a token that gets replaced during the normal build process. Finalized, functional `POMs` can be found within the **Selenium Foundation** JARs themselves at:
102-
103-
> **`META-INF/maven/com.nordstrom.ui-tools/selenium-foundation/pom.xml`**
104-
105-
#### Maven Build Script - `mvn-build.sh`
106-
107-
Unlocking the full capabilities of the Maven project file of **Selenium Foundation** requires the specification of several correlated properties. To simplify the process of building and testing the project with Maven, we've provided a script that packages up the details in a concise format. To build the project with the version number from `gradle.properties`:
108-
109-
> **`./mvn-build.sh`**
110-
11193
#### Running Browser Unit Tests
11294

113-
By default, the unit tests that run after the build completes are the support feature tests (which don't require a browser). The Gradle and Maven project files provide a set of browser profiles, one for each supported browser. By specifying one of these profiles, you activate dependencies, settings, and driver plug-in for the corresponding browser.
95+
By default, the unit tests that run after the build completes are the support feature tests (which don't require a browser). The Gradle project file provides a set of browser profiles, one for each supported browser. By specifying one of these profiles, you activate dependencies, settings, and driver plug-in for the corresponding browser.
11496

11597
> **`gradle test -Pbrowsers=espresso`** # run Android Espresso unit tests
116-
> **`./mvn-build.sh -t -b firefox -h`** # run Mozilla Firefox unit tests in "headless" mode
98+
> **`gradle test -Pbrowsers=filefox -Ppersonality=firefox.headless`** # run Mozilla Firefox unit tests in "headless" mode
99+
> **`gradle test -Pbrowsers=htmlunit -Ppersonality=htmlunit.nojs`** # run HtmlUnit unit tests without JavaScript support
100+
101+
The `personality` property directs **Selenium Foundation** to run the unit tests on browsers with the specified named capabilities. Available personalities are defined by each driver plug-in, and the list of personalities supported by the current Grid is shown in the console output. For example:
117102

118-
The second command uses the Maven build script instead of invoking Maven directly. This replicates the behavior of the Gradle project, consolidating the entire configuration set into a single named value.
103+
> `http://192.168.254.20:4445/wd/hub: Personalities => [chrome, chrome.headless]`
119104
120105
A complete list of supported browser profiles can be found [here](https://github.com/sbabcoc/Selenium-Foundation/blob/master/docs/ConfiguringProjectSettings.md#grid-configuration-for-selenium-foundation-unit-tests),
121106

build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
33

44
plugins {
55
id 'java-library'
6+
id 'eclipse'
67
id 'maven-publish'
78
id 'jacoco'
89
id 'signing'
@@ -30,6 +31,10 @@ if (project.hasProperty('browsers')) {
3031
}
3132
}
3233

34+
if (project.hasProperty('personality')) {
35+
System.setProperty('selenium.browser.name', ext.personality)
36+
}
37+
3338
def archiveVer = null
3439
def verBits = scmVersion.version.split('-')
3540
def seleniumApi = 's' + profile.charAt(8)

docs/ConfiguringProjectSettings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The **`GRID_PLUGINS`** setting specifies a semicolon-delimited list of fully-qua
9999
100100
#### Grid Configuration for Selenium Foundation unit tests
101101

102-
By default, the unit tests are [configured](LocalGridConfiguration.md) to run the "support" tests, which don't require browser sessions. The local Grid instance launched for this configuration runs in "servlet container" mode. The Maven and Gradle project file define sets of profiles, one for each supported browser, which specify the corresponding dependencies, settings, and driver plugin needed to run the unit tests for that browser.
102+
By default, the unit tests are [configured](LocalGridConfiguration.md) to run the "support" tests, which don't require browser sessions. The local Grid instance launched for this configuration runs in "servlet container" mode. The Gradle project file defines a set of profiles, one for each supported browser, which specify the corresponding dependencies, settings, and driver plugin needed to run the unit tests for that browser.
103103

104104
| Profile | Browser / Appium Engine |
105105
| --- |:---:|

docs/DevelopmentEnvironment.md

+1-20
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ The majority of the environment needed to build **Selenium Foundation** is compr
1313
| Version control | git version 2.27 |
1414
| Command shell | GNU bash, version 4.4.23(1) |
1515
| Gradle (build tool) | version 6.5 |
16-
| Maven (build tool) | version 3.5.2 |
1716
| Eclipse (IDE) | 2020-12 (4.18.0) |
18-
| Maven Plug-In | m2e 1.17.1.20201207-1112 |
1917
| BuildShip Plug-In | 3.1.5.v20210113-0904 |
2018
| TestNG Plug-In | 7.3.0.202011271758 |
2119

@@ -29,15 +27,9 @@ To build **Selenium Foundation**, you'll need a Java 8 software development kit:
2927

3028
The Gradle project file for **Selenium Foundation** includes a **selenium3Deps** sub-file. This reflects the past (and probable future) support for multiple versions of the Selenium API.
3129

32-
## Maven Configuration:
33-
34-
### Project Profiles
35-
36-
The Maven POM for **Selenium Foundation** defines an active-by-default **selenium3** profile. This reflects the past (and probable future) support for multiple versions of the Selenium API.
37-
3830
### JDK Toolchains
3931

40-
To build the **Selenium Foundation** project with **Maven**, you'll also need to add a `toolchain` specification to your system configuration:
32+
To build the **Selenium Foundation** project, you'll also need to add a **Maven** `toolchain` specification to your system configuration. This configuration allows **Gradle** to auto-discover the JDK installations on your machine:
4133

4234
###### C:\\Users\\<username>\\.m2\\toolchains.xml
4335
```xml
@@ -61,19 +53,8 @@ To build the **Selenium Foundation** project with **Maven**, you'll also need to
6153
| Variable | Target |
6254
|:---|:---|
6355
| **`GRADLE_HOME`** | Root folder of Gradle installation |
64-
| **`M2`** | Path to Maven `bin` folder
65-
| **`M2_HOME`** | Root folder of Maven installation |
66-
| **`M2_REPO`** | Root folder of Maven repository |
6756
| **`JDK8_HOME`** | Root folder of JDK 8 installation |
6857

69-
## TestNG Eclipse Configuration
70-
71-
In the **Selenium Foundation** POM file, the configuration for the Maven Surefire plug-in declares an `argLine` property that specifies the `-javaagent` option. The declaration of this option isn't needed to run or debug **TestNG** tests and may cause test execution to fail.
72-
73-
To resolve this issue, disable the option to pass the `argLine` property to **TestNG** in your **Eclipse** preferences:
74-
75-
> Preferences > TestNG > Maven > ☐ argLine
76-
7758
## JUnit Run Configuration
7859

7960
The JUnit support provided by **Selenium Foundation** relies on [event notifications](JUnit4Support.md#outline-of-required-elements) published by **JUnit Foundation**. Notifications are enabled by a Java agent, which uses bytecode enhancement to install hooks on test and configuration methods.

docs/LocalGridConfiguration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In addition to providing a local Grid instance for running Selenium tests on you
1010

1111
To maximize flexibility, configurability, consistency, and control, the browser sessions dispensed by **Selenium Foundation** are provided by an instance of **Selenium Grid**. To use an existing Grid instance for session provisioning, specify its endpoint URL in the [**`HUB_HOST`** setting](ConfiguringProjectSettings.md#selenium-grid-configuration). By default, **Selenium Foundation** will launch a local Grid and acquire sessions from there.
1212

13-
The unit tests of this project acquire browser sessions from a local Grid instance that gets launched at the start of the test run and torn down when the run is complete. By default, the local Grid runs in "servlet container" mode, and only non-browser support feature tests are run. Profiles defined in the Gradle and Maven project files allow you to specify which browser to target with the corresponding unit tests. This aspect of the **Selenium Foundation** project provides a working example of how to configure for the local Grid feature, as detailed in the following sections.
13+
The unit tests of this project acquire browser sessions from a local Grid instance that gets launched at the start of the test run and torn down when the run is complete. By default, the local Grid runs in "servlet container" mode, and only non-browser support feature tests are run. Profiles defined in the Gradle project file allows you to specify which browser to target with the corresponding unit tests. This aspect of the **Selenium Foundation** project provides a working example of how to configure for the local Grid feature, as detailed in the following sections.
1414

1515
### Specifying plug-ins via System property
1616

mvn-build.sh

-103
This file was deleted.

pom.properties

-3
This file was deleted.

0 commit comments

Comments
 (0)