I’ve had multiple situations where I’ve wanted to watch my automated test run on video. Screenshots are great, but sometimes they just don’t catch the full gist of it. Thanks to Jari Bakken for the vnctools gem.
Items you’ll need to install:
gem: vnctools
apt-get install ffmpeg
apt-get install jenkins-ci
Jenkins plugins required:
XVNC plugin must be configured
Sample code:
require 'vnctools'
def start_new_video
@video_name = 'text_run_video.mp4'
@recorder = VncTools::Recorder.new(ENV['DISPLAY'], @video_name)
@recorder.start
end
def stop_video
if @failure_count > 0
@recorder.stop
puts "Video recorded at #{@video_name }")
else
@recorder.stop
end
end
end