Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dafa6ca
forcing codecov to run on all branches
andrewmkrug Nov 28, 2016
bbc5492
updating readme with travis ci badge and modifying travis config to g…
andrewmkrug Nov 28, 2016
306f663
moving badges to the top
andrewmkrug Nov 28, 2016
af4238d
changed project name added in sonar qube to travis for code checkin
andrewmkrug Dec 3, 2016
69098af
updating travis to not use jdk switcher
andrewmkrug Dec 3, 2016
062560b
cleaning pom file indentations
andrewmkrug Dec 3, 2016
ee5df17
updating travis for codecov.io
andrewmkrug Dec 3, 2016
cdaab7a
added in test source root for codecov
andrewmkrug Dec 3, 2016
8fe8907
remove scope for testng for test root to be source root for jacoco re…
andrewmkrug Dec 3, 2016
6e157e1
testing new install script and pulling out code for different browser…
andrewmkrug Dec 4, 2016
e6650be
updating travis to use install script
andrewmkrug Dec 4, 2016
a87e8e1
updating travis again
andrewmkrug Dec 4, 2016
5545c41
modifying install script to print out lines
andrewmkrug Dec 4, 2016
9e4f0ec
adding in ./ to actually run the bash file
andrewmkrug Dec 4, 2016
71c0cbb
missing 's' in script name
andrewmkrug Dec 4, 2016
6cef52c
changing file permissions
andrewmkrug Dec 4, 2016
ee2da90
fixing name for cask chrome
andrewmkrug Dec 4, 2016
818bdcf
updating docs
andrewmkrug Dec 4, 2016
fa5dd1e
removing unnecessary line of code
andrewmkrug Dec 4, 2016
6970cea
updating travis for mac only tests to run excluding safari
andrewmkrug Dec 4, 2016
787655c
fixing tests and creating testng XML files to run tests off of
andrewmkrug Dec 5, 2016
ddd98f1
reorganizing for sonar and code coverage
andrewmkrug Dec 5, 2016
4739bc9
moving sonar out of main execution
andrewmkrug Dec 5, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### IntelliJ Idea
#.idea/
*.iml
*.ipr
*.iws

### Eclipse
.settings/
.classpath
.project

### Maven
target/
29 changes: 29 additions & 0 deletions .idea/runConfigurations/Run_Mac_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .idea/runConfigurations/Run_Windows_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
os: osx
language: java
sudo: false # faster builds
sudo: false
addons:
sonarqube:
token:
secure: f7ee339e87b3a7125b95957b3194ff6252870eb4

before_install:
- brew update
- brew install geckodriver
- brew cask install firefox
script:
script:
- ./mac_install_browsers.sh
- mvn clean test -Dsurefire.suiteXmlFiles=mac-only.xml

script: "mvn cobertura:cobertura"
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sonar/cache

after_success:
- mvn cobertura:cobertura coveralls:report
- bash <(curl -s https://codecov.io/bash)
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
- bash <(curl -s https://codecov.io/bash)

env:
global:
secure: RN0oZzxNTklGPhofZ1KJuADbxpoF2Jcw+bkIzXPIXi/n+gAYHNYNjuMCsb7vx/sIm1fvgQDQFTW2gllvmdYRWribx0Gxv4YeAG22KQxa7lYfogMm+rsrKEU4lZOcqWTYmvI1Py+d1WT13xGJXJUdX74703yPeefUoLf5dpo9OczqBfEKqVXbwJztgr2CNeSbp8ahtjzaoqqA3OeNz0Ia1bzIAhA7ZyXJ4t9j8YRe+0rkJrjQpKfWeUWdkiB1ydHy191kOkWVoIRyC2jVySyVRypFPg5am5nP76ZRjsgTvvPz7at5jn/S3zWvP8Hr+zTuAT916OP3a5GUE2za1KQQVV3t/FY4oyK9NDRNOPG+YxbmXir2djmOksnkC8tTZ7EprZkuhLJINwbQ1uf5vwjsc0K4MqvK+AmkschNf280lUvhUVptdMUAM0zWErQsYQvsUDqylFber9Z8f2x2SY4kwASrKhjg0FpJuZkPWf2N6o6/iFP2R0C4rXYyluGgLHQvVpb94tvhjN/0+YDTRbif0mvDFR04Jt29VvmnXDkEsg2SUcNky1HoyA+USwnwZsJ1LlGAAIx0W/8hgCUqZ4RKa1mNmn4qMmpqQCl11THjnQOievts7bJn7dCMhL8BtmBQjW0YtJumRl2SIpeG6Ci8SZq0GrGaS7sQQMjle0UtXR8=
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
[![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)
# Using this Project

[![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)

This project is using the latest Selenium Bindings.

## Setup

Run these commands depending on your base OS.

### On Mac OS

Install Java JDK

Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`

Install Maven `brew install maven`

Run `brew install geckodriver`
1. Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
2. Install Caskroom `brew tap caskroom/cask`
3. If you dont have the Java Development Kit (JDK) run this command `brew cask install java`
4. Install Maven `brew install maven`
5. Run `./mac_install_browsers.sh`

## Running Tests

The following commands are instructions on how to run the tests

### From CLI

`mvn test`
`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml ` on a mac

### Intellij Idea

There is a shared run configuration that has the maven target setup and another with a sample built in NUnit test runner option.

#### Safari Test

Safari requires the following steps to enable Selenium Webdriver tests to run:

1. Open Safari Preferences
2. Go to the Advanced Tab
3. Check the box at the bottom "Show Develop menu in menu bar"
4. Click on the Develop menu
5. Click on "Allow Remote Execution"

Now Safari tests will work.

If running tests only locally you can remove delete `//` from the `@Test` line of the Safari class.
2 changes: 1 addition & 1 deletion javajenkins.iml → basic-selenium-java.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
Expand Down
18 changes: 18 additions & 0 deletions mac-only.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Mac Test Suite" parallel="none">
<test verbose="1" name="javajenkins">
<groups>
<run>
<include name="mac"/>
</run>
</groups>
<classes>
<class name="LocalBrowsers.Chrome"/>
<class name="LocalBrowsers.Edge"/>
<class name="LocalBrowsers.Firefox"/>
<class name="LocalBrowsers.PhantomJS"/>
<class name="LocalBrowsers.Safari"/>
</classes>
</test> <!-- javajenkins -->
</suite> <!-- Custom suite -->
8 changes: 8 additions & 0 deletions mac_install_browsers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -ev
brew install geckodriver
brew cask install firefox
brew install chromedriver
brew cask install google-chrome
brew install phantomjs

68 changes: 36 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.lazycoder.sample</groupId>
<artifactId>javajenkins</artifactId>
<artifactId>basic-selenium-java</artifactId>
<version>1.0-SNAPSHOT</version>


Expand All @@ -19,40 +19,44 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.13.6</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<sourceEncoding>UTF8</sourceEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check />
<maxmem>256m</maxmem>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<sourceDirectory>src/test/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<sourceEncoding>UTF8</sourceEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
15 changes: 15 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# must be unique in a given SonarQube instance
sonar.projectKey=basic.selenium.java
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Basic Selenium Java
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
Loading