{"id":97,"date":"2009-10-30T13:55:01","date_gmt":"2009-10-30T18:55:01","guid":{"rendered":"http:\/\/scottcsims.com\/wordpress\/?p=97"},"modified":"2016-09-07T20:01:47","modified_gmt":"2016-09-08T01:01:47","slug":"configure-the-team-city-rake-runner-to-launch-selenium-grid-tests","status":"publish","type":"post","link":"http:\/\/scottcsims.com\/wordpress\/?p=97","title":{"rendered":"Configure the Team City rake runner to launch Selenium Grid tests."},"content":{"rendered":"<p>This article will describe how I was able to use the team city rake runner to launch selenium grid tests.\u00a0 I learned a few tricks to get this to work correctly.\u00a0\u00a0 I first had to learn the makeup of a rspec specktask.\u00a0 Next I needed to understand how to pass in spec options and lastly I needed to write a rake task that would execute in an exact order.\u00a0 I needed to still generate the html report with the rake task so I had to add the formatter path to the rake runner<\/p>\n<p><strong>Setup the report formatter path in your rake runner like you do in your rake file.<br \/>\n<\/strong>See the code below to see how the formatter path is setup in the rake file. You can also see how the formatter path is used by the rake task.<\/p>\n<pre class=\"brush: ruby\"># Make sure we pick up the reporter from the appropriate selenium-client\r\n# install as RSpec runner --require does not discriminate between multiple\r\n# selenium-client gems.\r\nreport_formatter_path = `gem which -q \"selenium\/rspec\/reporting\/selenium_test_report_formatter\"`.chomp\r\nreport_formatter_path.gsub! \/selenium-client-\\d+\\.\\d+.\\d+\/, \"selenium-client-1.2.7\"<\/pre>\n<pre class=\"brush: ruby\">Spec::Rake::SpecTask.new(\"spec:run_in_parallel_report\") do |t|\r\n  t.spec_files = FileList['.\/*_spec.rb']\r\n  t.deep_test :number_of_workers =&gt; 6,\r\n              :timeout_in_seconds =&gt; 300\r\n  t.spec_opts &lt;&lt; '--color'\r\n  t.spec_opts &lt;&lt; \"--require 'rubygems,#{report_formatter_path}'\"\r\n  t.spec_opts &lt;&lt; \"--format=Selenium::RSpec::SeleniumTestReportFormatter:.\/tmp\/test_report.html\"\r\n  t.spec_opts &lt;&lt; \"--format=progress\"\r\n  t.fail_on_error = false\r\nend<\/pre>\n<p><strong>Setup the spec opts in the rake runner. <\/strong><br \/>\nSee the image below. I need to tell team city which formatter to use and where to put the html report. To pass in spec options to the rake runner in team city just put them in the text field labeled <strong>RSpec options(SPEC_OPTS): <\/strong>.<br \/>\nMy full spec ops string is:<\/p>\n<p><strong>&#8211;require &#8216;\/usr\/lib\/ruby\/gems\/1.8\/gems\/selenium-client-1.2.7\/lib\/selenium\/rspec\/reporting\/selenium_test_report_formatter.rb&#8217; &#8211;format=Selenium::RSpec::SeleniumTestReportFormatter:.\/tmp\/test_report.html<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-98\" title=\"RakeRunner\" src=\"http:\/\/scottcsims.com\/wordpress\/wp-content\/uploads\/2009\/10\/RakeRunner.png\" alt=\"RakeRunner\" width=\"852\" height=\"796\" srcset=\"http:\/\/scottcsims.com\/wordpress\/wp-content\/uploads\/2009\/10\/RakeRunner.png 852w, http:\/\/scottcsims.com\/wordpress\/wp-content\/uploads\/2009\/10\/RakeRunner-300x280.png 300w\" sizes=\"auto, (max-width: 852px) 100vw, 852px\" \/><\/p>\n<p><strong>Run your rake task.<br \/>\n<\/strong>I made a rake task to take selenium grid environment variables as arguments.\u00a0 If you wanted to run the task above, just add the task name\u00a0 &#8220;spec:run_in_parallel_report&#8221; in your rake configuration. You don&#8217;t need any command line parameters for the spec:run_in_parallel_report task.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will describe how I was able to use the team city rake runner to launch selenium grid tests.\u00a0 I learned a few tricks to get this to work correctly.\u00a0\u00a0 I first had to learn the makeup of a rspec specktask.\u00a0 Next I needed to understand how to pass in spec options and lastly [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[17],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-ruby-seleniumgrid-rake-teamcity"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":21,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":119,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/119"}],"wp:attachment":[{"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/scottcsims.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}