Introduction
Just want to share my current working case, put all previous parts together, and more.
Online Demo
https://www.youtube.com/watch?v=arSE3p7fako
As you can see no diff image at second time since skipRealDiff is 'true'.
Pre-Request
Create Parameterized Test Service with Jenkins
Visual Testing with Selenium in Rails
Manage Image Files from Selenium Visual Testing
Steps to Apply This Project
1. Clone the WorkinCase/SeleniumTest
then you should be able to run
# run all test cases rake test:fileset
or
# run all cases that quoted by single quote and separated by comma cases="['simple_test']" rake test:fileset
in terminal
2. Create Jenkins Job with the content of Jenkins Job Settings at
README.rdoc
basically two parts, parameters and shell, then you can run it with Jenkins as the demo video shown above.
3. Regarding the Rails Web App, run it as your current user if you always run test cases from termnal, or run it by Jenkins as described in Manage Image Files from Selenium Visual Testing
if you usually run test cases with Jenkins
Modify test_helper.rb#L234 and Line 248 to your rails app url to change the url of output message
Different in Details
Add one more page '/vt/cases' to list all integration test cases (see routes.rb#L2 )
The working case postpone image processing by overriding MiniTest::CompositeReporter (see test_helper.rb#L200 ) so no need to read/write file.
Still override Rake::Task to rescue from rake aborted (see test.rake#L4 )
so Jenkins job will not be interrupted (since some operation needed after task finished)
Take care of Errors / Exceptions and Image diff to report summary of failed cases, see test_helper.rb
Line 35, 41, 240 ~ 256 and the if - fi block of Jenkins shell script
Take care of permission, see visual_testing_controller.rb#L66 , test_helper.rb#L259 and chmod command of Jenkins shell script