Skip to content

Commit 9e2fa79

Browse files
committed
Code refactored
1 parent 9f1f2f9 commit 9e2fa79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1145
-457
lines changed
-887 KB
Binary file not shown.

README.md

Lines changed: 193 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,32 @@
11
# Gauge Java Web UI Automation Demo
22

3-
## Pre Requisites
3+
## Pre-requisites
44
1. Java
55
2. Maven
66

7-
## How to Install Gauge Core
8-
**On Windows**
9-
1. Install Chocolatey by executing the following command.
10-
11-
` @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"`
7+
## How to install Gauge core
8+
Follow the instructions mentioned in [Installing Gauge](https://docs.gauge.org/getting_started/installing-gauge?os=windows&language=java&ide=vscode) in the official [Gauge Documentation](https://docs.gauge.org/)
129

13-
2. Install Gauge by executing the following command.
10+
## How to install Gauge plugins
11+
1. Open Command Prompt and execute following commands.
1412

15-
`choco install gauge`
16-
17-
**On MacOS**
18-
1. Update Homebrew.
13+
`gauge install java`
1914

20-
`brew update`
21-
22-
2. Install Gauge using Homebrew.
15+
`gauge install html-report`
2316

24-
`brew install gauge`
25-
26-
**On Linux**
27-
1. First, add Gauge’s GPG key with this command.
17+
`gauge install json-report`
2818

29-
`sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-keys 023EDB0B`
30-
31-
2. Then add Gauge to the repository list using this command.
32-
33-
`echo deb https://dl.bintray.com/gauge/gauge-deb nightly main | sudo tee -a /etc/apt/sources.list`
34-
35-
3. Finally, install Gauge using these commands.
19+
`gauge install xml-report`
3620

37-
`sudo apt-get update`
38-
39-
`sudo apt-get install gauge`
40-
41-
## How to Install Gauge Plugins
42-
1. Open Command Prompt and execute following commands.
21+
`gauge install spectacle`
4322

44-
`gauge install java`
45-
46-
`gauge install html-report`
47-
48-
`gauge install json-report`
49-
50-
`gauge install xml-report`
51-
52-
`gauge install spectacle`
53-
54-
`gauge install flash`
23+
`gauge install flash`
5524

5625
2. You can check the installation using the following command.
5726

58-
`gauge -v`
27+
`gauge -v`
5928

29+
**Note:**
6030
If the installation is success, it will output like this:
6131

6232
```markdown
@@ -71,7 +41,185 @@ If the installation is success, it will output like this:
7141
xml-report (<version number>)
7242
```
7343

74-
## Configurations for IE 11 on Windows
44+
## Executing specifications
45+
46+
### General specs execution
47+
- Run the below command to execute all specifications in `specs` directory
48+
49+
```
50+
mvn gauge:execute -DspecsDir=specs
51+
```
52+
53+
- Run the below command to execute a single specification
54+
55+
```
56+
mvn gauge:execute -DspecsDir=specs/example.spec
57+
```
58+
59+
- Run the below command to execute specifications in `specs` and `specDir` directories
60+
61+
```
62+
mvn gauge:execute -DspecsDir="specs,specDir"
63+
```
64+
65+
- Run the below command to execute the failed scenarios
66+
67+
```
68+
mvn gauge:execute -Dflags="--failed"
69+
```
70+
71+
- Run the below command to execute the repeat scenarios
72+
73+
```
74+
mvn gauge:execute -Dflags="--repeat"
75+
```
76+
77+
**Note:**
78+
`mvn test-compile` should be used for the tool to get latest changes of user code.
79+
80+
### Execute specs In parallel
81+
82+
```
83+
mvn gauge:execute -DspecsDir=specs -DinParallel=true
84+
```
85+
86+
### Execute specs by tags expression
87+
88+
```
89+
mvn gauge:execute -DspecsDir=specs -Dtags="!in-progress"
90+
```
91+
92+
### Execute spec by scenario name
93+
94+
```
95+
mvn gauge:execute -DspecsDir=specs -Dscenario="Scenario Name"
96+
```
97+
98+
### Specifying execution environment
99+
100+
```
101+
mvn gauge:execute -DspecsDir=specs -Denv="dev"
102+
```
103+
104+
### Execute specs as a part of maven test phase
105+
106+
Run gauge specs in project as a part of maven test phase by adding the below execution to yor pom.xml
107+
108+
```
109+
<build>
110+
<plugins>
111+
<plugin>
112+
<groupId>com.thoughtworks.gauge.maven</groupId>
113+
<artifactId>gauge-maven-plugin</artifactId>
114+
<version>1.6.1</version>
115+
<executions>
116+
<execution>
117+
<phase>test</phase>
118+
<configuration>
119+
<specsDir>specs</specsDir>
120+
<environmentVariables>
121+
<CUSTOM_ENV_VARIABLE>value</CUSTOM_ENV_VARIABLE>
122+
</environmentVariables>
123+
</configuration>
124+
<goals>
125+
<goal>execute</goal>
126+
</goals>
127+
</execution>
128+
</executions>
129+
</plugin>
130+
</plugins>
131+
</build>
132+
```
133+
134+
`mvn test` command will also run gauge specs if the above mentioned execution is added to the projects pom.xml
135+
136+
### Validate specs in project
137+
138+
- Run the below command to execute all specifications in `specs` directory
139+
140+
```
141+
mvn gauge:validate -DspecsDir=specs
142+
```
143+
144+
- Run the below command to validate and ignore stub implementation suggestions
145+
146+
```
147+
mvn gauge:validate -Dflags="--hide-suggestion"
148+
```
149+
150+
### Execute specs as a part of maven test-compile phase
151+
152+
Validate gauge specs in project as a part of maven test-compile phase by adding the below execution to yor pom.xml
153+
154+
```
155+
<build>
156+
<plugins>
157+
<plugin>
158+
<groupId>com.thoughtworks.gauge.maven</groupId>
159+
<artifactId>gauge-maven-plugin</artifactId>
160+
<version>1.6.1</version>
161+
<executions>
162+
<execution>
163+
<phase>test-compile</phase>
164+
<configuration>
165+
<specsDir>specs</specsDir>
166+
<flags>
167+
<flag>--hide-suggestion</flag>
168+
</flags>
169+
</configuration>
170+
<goals>
171+
<goal>validate</goal>
172+
</goals>
173+
</execution>
174+
</executions>
175+
</plugin>
176+
</plugins>
177+
</build>
178+
```
179+
180+
### Running both validate and execute goals as part of maven
181+
182+
Add the following execution to pom.xml to run both goals:
183+
184+
```
185+
<plugin>
186+
<groupId>com.thoughtworks.gauge.maven</groupId>
187+
<artifactId>gauge-maven-plugin</artifactId>
188+
<version>1.6.1</version>
189+
<executions>
190+
<execution>
191+
<id>validate</id>
192+
<phase>test-compile</phase>
193+
<goals>
194+
<goal>validate</goal>
195+
</goals>
196+
</execution>
197+
<execution>
198+
<id>execute</id>
199+
<phase>test</phase>
200+
<goals><goal>execute</goal></goals>
201+
<configuration>
202+
<specsDir>specs</specsDir>
203+
</configuration>
204+
</execution>
205+
</executions>
206+
</plugin>
207+
```
208+
209+
### All Properties
210+
211+
The following plugin properties can be additionally set:
212+
213+
| Property name | Usage | Description |
214+
|---------------|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
215+
| specsDir | -DspecsDir=specs | Gauge specs directory path. Required for executing specs. Takes a comma separated list of specification files/directories |
216+
| tags | -Dtags="tag1 & tag2" | Filter specs by specified tags expression |
217+
| inParallel | -DinParallel=true | Execute specs in parallel |
218+
| nodes | -Dnodes=3 | Number of parallel execution streams. Use with `parallel` |
219+
| env | -Denv=qa | gauge env to run against |
220+
| flags | -Dflags="--verbose,--simpleConsole" | Add additional gauge flags to execution |
221+
222+
## Internet Explorer 11 configurations for a Windows machine
75223
76224
1. Open **Registry Editor** (Windows Key + R → Type regedit → Press Enter).
77225
@@ -97,11 +245,4 @@ If the installation is success, it will output like this:
97245
98246
10. Click on **OK** button.
99247
100-
|Browser |Version |
101-
|-----------|---------------------------------------|
102-
|Chrome |68.0.3440.106 (Official Build) (64-bit)|
103-
|Firefox |61.0.2 (64-bit) |
104-
|IE |11.228.17134.0 |
105-
|Edge |42.17134.1.0 |
106-
107-
Tested on **Windows 10 Core i7 Machine**.
248+
Tested with **Windows 10 Core i7 Machine**.

concepts/login.cpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Date : 3/13/2020
55
Time : 2:27 PM
66
Description : This is a concept file
77

8-
# Login using the email as <Email> and password as <Password>
8+
# Login using the username as <Username> and password as <Password>
99

1010
* On login page
11-
* Login to the application using the email as <Email> and password as <Password>
12-
* Page title is "My account - My Store"
11+
* Login to the application using the username as <Username> and password as <Password>

concepts/signout.cpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

env/default/default.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ flash_server_port = 8000
2828
# Browser
2929
browser = chrome
3030

31-
# Base URL
32-
application_endpoint = http://automationpractice.com/index.php?controller=authentication&back=my-account
31+
# Application URL
32+
application_endpoint = https://demoblaze.com/

env/dev/dev.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ flash_server_port = 8000
2828
# Browser
2929
browser = headless-chrome
3030

31-
# Base URL
32-
application_endpoint = http://automationpractice.com/index.php?controller=authentication&back=my-account
31+
# Application URL
32+
application_endpoint = https://demoblaze.com/

env/prod/prod.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ flash_server_port = 8000
2828
# Browser
2929
browser = headless-chrome
3030

31-
# Base URL
32-
application_endpoint = http://automationpractice.com/index.php?controller=authentication&back=my-account
31+
# Application URL
32+
application_endpoint = https://demoblaze.com/

env/qa/qa.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ flash_server_port = 8000
2828
# Browser
2929
browser = headless-firefox
3030

31-
# Base URL
32-
application_endpoint = http://automationpractice.com/index.php?controller=authentication&back=my-account
31+
# Application URL
32+
application_endpoint = https://demoblaze.com/

env/uat/uat.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ flash_server_port = 8000
2828
# Browser
2929
browser = headless-chrome
3030

31-
# Base URL
32-
application_endpoint = http://automationpractice.com/index.php?controller=authentication&back=my-account
31+
# Application URL
32+
application_endpoint = https://demoblaze.com/

0 commit comments

Comments
 (0)