Skip to content

Commit c7e691c

Browse files
authored
Merge pull request #8 from lazycoderio/cov
Coverage Addition
2 parents 8e4d801 + 4739bc9 commit c7e691c

18 files changed

+424
-79
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,17 @@
1010

1111
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
1212
hs_err_pid*
13+
14+
### IntelliJ Idea
15+
#.idea/
16+
*.iml
17+
*.ipr
18+
*.iws
19+
20+
### Eclipse
21+
.settings/
22+
.classpath
23+
.project
24+
25+
### Maven
26+
target/

.idea/runConfigurations/Run_Mac_Tests.xml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_Nunit_SampleTest_.xml renamed to .idea/runConfigurations/Run_Mac_Tests2.xml

Lines changed: 11 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_Windows_Tests.xml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
os: osx
22
language: java
3-
sudo: false # faster builds
3+
sudo: false
4+
addons:
5+
sonarqube:
6+
token:
7+
secure: f7ee339e87b3a7125b95957b3194ff6252870eb4
48

5-
before_install:
6-
- brew update
7-
- brew install geckodriver
8-
- brew cask install firefox
9+
script:
10+
script:
11+
- ./mac_install_browsers.sh
12+
- mvn clean test -Dsurefire.suiteXmlFiles=mac-only.xml
913

10-
script: "mvn cobertura:cobertura"
14+
cache:
15+
directories:
16+
- $HOME/.m2/repository
17+
- $HOME/.sonar/cache
1118

1219
after_success:
13-
- mvn cobertura:cobertura coveralls:report
14-
- bash <(curl -s https://codecov.io/bash)
20+
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
21+
- bash <(curl -s https://codecov.io/bash)
22+
23+
env:
24+
global:
25+
secure: RN0oZzxNTklGPhofZ1KJuADbxpoF2Jcw+bkIzXPIXi/n+gAYHNYNjuMCsb7vx/sIm1fvgQDQFTW2gllvmdYRWribx0Gxv4YeAG22KQxa7lYfogMm+rsrKEU4lZOcqWTYmvI1Py+d1WT13xGJXJUdX74703yPeefUoLf5dpo9OczqBfEKqVXbwJztgr2CNeSbp8ahtjzaoqqA3OeNz0Ia1bzIAhA7ZyXJ4t9j8YRe+0rkJrjQpKfWeUWdkiB1ydHy191kOkWVoIRyC2jVySyVRypFPg5am5nP76ZRjsgTvvPz7at5jn/S3zWvP8Hr+zTuAT916OP3a5GUE2za1KQQVV3t/FY4oyK9NDRNOPG+YxbmXir2djmOksnkC8tTZ7EprZkuhLJINwbQ1uf5vwjsc0K4MqvK+AmkschNf280lUvhUVptdMUAM0zWErQsYQvsUDqylFber9Z8f2x2SY4kwASrKhjg0FpJuZkPWf2N6o6/iFP2R0C4rXYyluGgLHQvVpb94tvhjN/0+YDTRbif0mvDFR04Jt29VvmnXDkEsg2SUcNky1HoyA+USwnwZsJ1LlGAAIx0W/8hgCUqZ4RKa1mNmn4qMmpqQCl11THjnQOievts7bJn7dCMhL8BtmBQjW0YtJumRl2SIpeG6Ci8SZq0GrGaS7sQQMjle0UtXR8=

README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
1+
[![Join the chat at https://gitter.im/lazycoderio/sample-java-jenkins](https://badges.gitter.im/lazycoderio/sample-java-jenkins.svg)](https://gitter.im/lazycoderio/sample-java-jenkins?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Coverage Status](https://coveralls.io/repos/github/lazycoderio/sample-java-jenkins/badge.svg?branch=master)](https://coveralls.io/github/lazycoderio/sample-java-jenkins?branch=master) [![codecov](https://codecov.io/gh/lazycoderio/sample-java-jenkins/branch/master/graph/badge.svg)](https://codecov.io/gh/lazycoderio/sample-java-jenkins) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/2da21d82c84640028d90abf2de796022)](https://www.codacy.com/app/andrew-m-krug/sample-java-jenkins?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=lazycoderio/sample-java-jenkins&amp;utm_campaign=Badge_Grade) [![Code Climate](https://codeclimate.com/github/lazycoderio/sample-java-jenkins/badges/gpa.svg)](https://codeclimate.com/github/lazycoderio/sample-java-jenkins) [![Dependency Status](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522) [![Build Status](https://travis-ci.org/lazycoderio/sample-java-jenkins.svg?branch=master)](https://travis-ci.org/lazycoderio/sample-java-jenkins)
12
# Using this Project
23

3-
[![Join the chat at https://gitter.im/lazycoderio/sample-java-jenkins](https://badges.gitter.im/lazycoderio/sample-java-jenkins.svg)](https://gitter.im/lazycoderio/sample-java-jenkins?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4-
5-
[![Coverage Status](https://coveralls.io/repos/github/lazycoderio/sample-java-jenkins/badge.svg?branch=master)](https://coveralls.io/github/lazycoderio/sample-java-jenkins?branch=master)
6-
7-
[![codecov](https://codecov.io/gh/lazycoderio/sample-java-jenkins/branch/master/graph/badge.svg)](https://codecov.io/gh/lazycoderio/sample-java-jenkins)
8-
9-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2da21d82c84640028d90abf2de796022)](https://www.codacy.com/app/andrew-m-krug/sample-java-jenkins?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=lazycoderio/sample-java-jenkins&amp;utm_campaign=Badge_Grade)
10-
11-
[![Code Climate](https://codeclimate.com/github/lazycoderio/sample-java-jenkins/badges/gpa.svg)](https://codeclimate.com/github/lazycoderio/sample-java-jenkins)
12-
13-
[![Dependency Status](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522)
14-
154
This project is using the latest Selenium Bindings.
165

176
## Setup
7+
188
Run these commands depending on your base OS.
199

2010
### On Mac OS
2111

22-
Install Java JDK
23-
24-
Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
25-
26-
Install Maven `brew install maven`
27-
28-
Run `brew install geckodriver`
12+
1. Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
13+
2. Install Caskroom `brew tap caskroom/cask`
14+
3. If you dont have the Java Development Kit (JDK) run this command `brew cask install java`
15+
4. Install Maven `brew install maven`
16+
5. Run `./mac_install_browsers.sh`
2917

3018
## Running Tests
3119

3220
The following commands are instructions on how to run the tests
3321

3422
### From CLI
3523

36-
`mvn test`
24+
`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml ` on a mac
3725

3826
### Intellij Idea
3927

4028
There is a shared run configuration that has the maven target setup and another with a sample built in NUnit test runner option.
29+
30+
#### Safari Test
31+
32+
Safari requires the following steps to enable Selenium Webdriver tests to run:
33+
34+
1. Open Safari Preferences
35+
2. Go to the Advanced Tab
36+
3. Check the box at the bottom "Show Develop menu in menu bar"
37+
4. Click on the Develop menu
38+
5. Click on "Allow Remote Execution"
39+
40+
Now Safari tests will work.
41+
42+
If running tests only locally you can remove delete `//` from the `@Test` line of the Safari class.

javajenkins.iml renamed to basic-selenium-java.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<output url="file://$MODULE_DIR$/target/classes" />
55
<output-test url="file://$MODULE_DIR$/target/test-classes" />
66
<content url="file://$MODULE_DIR$">
7-
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
87
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
99
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
1010
<excludeFolder url="file://$MODULE_DIR$/target" />
1111
</content>

mac-only.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite name="Mac Test Suite" parallel="none">
4+
<test verbose="1" name="javajenkins">
5+
<groups>
6+
<run>
7+
<include name="mac"/>
8+
</run>
9+
</groups>
10+
<classes>
11+
<class name="LocalBrowsers.Chrome"/>
12+
<class name="LocalBrowsers.Edge"/>
13+
<class name="LocalBrowsers.Firefox"/>
14+
<class name="LocalBrowsers.PhantomJS"/>
15+
<class name="LocalBrowsers.Safari"/>
16+
</classes>
17+
</test> <!-- javajenkins -->
18+
</suite> <!-- Custom suite -->

mac_install_browsers.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -ev
3+
brew install geckodriver
4+
brew cask install firefox
5+
brew install chromedriver
6+
brew cask install google-chrome
7+
brew install phantomjs
8+

pom.xml

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>io.lazycoder.sample</groupId>
8-
<artifactId>javajenkins</artifactId>
8+
<artifactId>basic-selenium-java</artifactId>
99
<version>1.0-SNAPSHOT</version>
1010

1111

@@ -19,40 +19,44 @@
1919
<groupId>org.testng</groupId>
2020
<artifactId>testng</artifactId>
2121
<version>6.9.13.6</version>
22-
<scope>test</scope>
2322
</dependency>
2423
</dependencies>
2524

2625
<build>
27-
<pluginManagement>
28-
<plugins>
29-
<plugin>
30-
<groupId>org.apache.maven.plugins</groupId>
31-
<artifactId>maven-surefire-plugin</artifactId>
32-
<version>2.19.1</version>
33-
</plugin>
34-
<plugin>
35-
<groupId>org.eluder.coveralls</groupId>
36-
<artifactId>coveralls-maven-plugin</artifactId>
37-
<version>4.3.0</version>
38-
<configuration>
39-
<sourceEncoding>UTF8</sourceEncoding>
40-
</configuration>
41-
</plugin>
42-
<plugin>
43-
<groupId>org.codehaus.mojo</groupId>
44-
<artifactId>cobertura-maven-plugin</artifactId>
45-
<version>2.7</version>
46-
<configuration>
47-
<formats>
48-
<format>html</format>
49-
<format>xml</format>
50-
</formats>
51-
<check />
52-
<maxmem>256m</maxmem>
53-
</configuration>
54-
</plugin>
55-
</plugins>
56-
</pluginManagement>
26+
<sourceDirectory>src/test/java</sourceDirectory>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-surefire-plugin</artifactId>
31+
<version>2.19.1</version>
32+
</plugin>
33+
<plugin>
34+
<groupId>org.eluder.coveralls</groupId>
35+
<artifactId>coveralls-maven-plugin</artifactId>
36+
<version>4.3.0</version>
37+
<configuration>
38+
<sourceEncoding>UTF8</sourceEncoding>
39+
</configuration>
40+
</plugin>
41+
<plugin>
42+
<groupId>org.jacoco</groupId>
43+
<artifactId>jacoco-maven-plugin</artifactId>
44+
<version>0.7.7.201606060606</version>
45+
<executions>
46+
<execution>
47+
<goals>
48+
<goal>prepare-agent</goal>
49+
</goals>
50+
</execution>
51+
<execution>
52+
<id>report</id>
53+
<phase>test</phase>
54+
<goals>
55+
<goal>report</goal>
56+
</goals>
57+
</execution>
58+
</executions>
59+
</plugin>
60+
</plugins>
5761
</build>
5862
</project>

0 commit comments

Comments
 (0)