The docker automation build for Cucumber-JVM + Selenium Toy Project.
142
This project is a fast toy project to refresh the fun on Java, JUnit, Selenium and Cucumber-JVM topic
v1.2
- Basic cucumber process
- Gherkin description and how to map to steps implementation
- JUnit integration and the annotations to run by Cucumber
- Multiple line parameters to step method by Cucumber Gherkin statement
- DataTable for Cucumber
- Java 8 Lambda and stream demo
- Failure hook for Cucumber
- Screenshot in Cucumber hook
- Parameterized test with Cucumber Scenario Outline
- Introduce WebDriverManager to support Travis could test
- Add Travis test configuration
- Refactor to Page Factory Pattern
- Various tests and code reading to clarify obj lifecycle of Cucumber-JVM
- Add circleCI online CI and deployment test
- Customized Annotation and the test
- Test the Interceptor Implementation with Cglib Proxy
- Add RESTful test cases for freegeoip and ipify public WebAPIs
v1.3dev
- Jenkins on 32bit Linux
- Testing with chromium-browser and ChromeDriver
- Updated to selenium 3.1.0
- Migrated to SLF with log4j1.2 in test
- JUnit test order, TestWatcher and Rule demo
- JUnit test on RuntimeException demo
This section records the issues resolved during the construction/devops phase.
@Before and @After hooks are invoked by each scenario on every test class thru internal hookAdd() when scanning is performed on "glue" implementations.
[TODO] To resolve it better, try to customize the Object Factory instead of default one in close future.
CircleCI browser version issue resolved by updating chrome to >=v52
google-chrome --version
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
Use online tools to validate YAML files for TravisCI and CodeCov before commit to test:
cat codecov.yml | curl --data-binary @- https://codecov.io/validate
curl -X POST -F "yml=`cat ./.travis.yml`" http://lint.travis-ci.org/
# Find below elements on page source
# <p class="result">Hooray, your .travis.yml seems to be solid!</p>
Assert.assertEqual() will call obj.equals(), however, to check with "==", we shall use Assert.assertSame() instead.
@Cucumber.Options() is replaced by @CucumberOptions annotation.
Step def class must be public.
Blinking scenarios, which passes sometimes but fails other time, is the smell of environmental(sharing), design, or, unexpected errors.
Cucumber report is not thread-safe, we shall avoid this case multiple tests write to same report.
How to run Cucumber with specified sequence?
Pay attention to @FindBy and @FindBys, @FindAll.
Not so important but keep in mind, the annotation @Before/@After and so on shall be imported from cucumber.api.java or cucumber.api.java.en (The Gherkin keys).
Environmental Issue with network:
The WebDriverManager lib was configured to download latest nightly Firefox driver but the network will blink if we keep on downloading many times in a short while;
Set properties value to force cache will resolve it:
wdm.forceCache=true
Coverage
The dev and test env:
The tips with Jenkins and testing with latest chrome-driver and chrome on 32bit Linux:
Google Chrome browser terminated the 32bit Linux supports from Feb 2016
However, the chrome-driver has criticle issue before 2.20
WebDriverManager-Java option forceCache always caches the latest version
Tried to utilize chromium-browser 32bit instead of google-chrome
The latest chrome driver requests browser version 55+
>sudo add-apt-repository ppa:saiarcot895/chromium-dev
>sudo apt-get update
Jenkins embedded status offers badge link as travisCI or circle.
Resolved chrome tab crash issue on 32bit Linux.
Resolved chromium-browser hanging-up with selenium.
Jenkins service on 32bit Linux, http://jenkins.maxwu.me
Upgrading to selenium 3.1.0 - Original selenium dependency version in maven is 3.0.1 - Upgrading to selenium-java 3.1.0, the method WebDriverWait.until() cannot be resolved by javac with IntelliJ IDEA. - Fall back to 3.0.1, the same codes work well.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
*[ ] Change browser binary, profile, local/remote and other parameters to config YAML.
*[X] Consider Log4J to refactor the logging instructions.
*[ ] Demo of output stream test with JUnit
*[X] Demo of exception test with JUnit
*[ ] Parameterized JUnit
*[ ] Update PageBase Url/Title check with Hamcrest matcher
*[ ] Migrating to Docker based Test and prepare for a further project releasing App in Docker.
- Dockerfile added, however, an error under debug.
- Scenario as target to v1.5dev

An open source toy project to refresh Cucumber-JVM + Selenium in MIT License.
This toy project demonstrates general practices on JUnit, Cucumber-JVM and Selenium Page Object methodologies.
The Jenkins service is running on 32bit Ubuntu 14 with chromium-browser instead of chrome-browser, details could be found at http://jenkins.maxwu.me
maxwunj${AT}msn${DOT}com
Readers may visit http://maxwu.me for further information.
Content type
Image
Digest
Size
240.5 MB
Last updated
over 9 years ago
docker pull maxwu/cucumber-java-toy:dev