문제

I have installed jenkins master node and testLink on a windows 7 machine, called machineA. I have installed, Ruby 1.8.7, watir 1.7.1, ci_reporter 1.8.4, test unit 2.5.4, rake 10.0.3, jenkins slave node through Java Web Start (JNLP) on a windows server 2003, called machineB.

Aim of the project is to start build from machineA, after that, the jenkins slave will execute ruby tests (with watir, so with ie navigator) on machineB and send reports on machineA (to be read by testLink).

My job configuration on jenkins master node (so on machineA) :

restrict where this project can be run --> machineB

svn --> url --> svn://serverSVN/project/trunk

build --> invoke testlink --> testLink cfg --> TestLink Version --> testlink 1.9.3  
                                               Test Project Name --> my project     
                                               Test Plan Name --> my testPlan   
                                               Build Name --> watirTest-$BUILD_NUMBER       
                                               Custom Fields --> watir

testExecution --> Single Build Steps --> execute windows batch cmd --> rake test CI_REPORTS=results 

results seeking strategy --> include pattern --> results/*.xml
                             key custom field --> watir

post-action-build --> publish junit reports --> results/*.xml

Here a test that I will execute in 2 differents ways (in local on the machineB, and with Jenkins from machineA).

require 'rubygems'
require 'watir'
require 'test/unit'
require 'ci/reporter/rake/test_unit_loader'
include Watir

class ModifierLocalisation < Test::Unit::TestCase

  def test_me
    ie = Watir::IE.new
    ie.goto("http://ipMachine/shopA/")
    assert(ie.text.include?("Identification"))
  end

end     

When I execute the test on the local machineB the test passed, so here the console output :

** Invoke test (first_time)
** Execute test
E:/Ruby/bin/ruby.exe test/modifierLocalisation.rb
Loaded suite test/modifierLocalisation
Started
.
Finished in 2.140625 seconds.

1 tests, 1 assertions, 1 failures, 0 errors

But when i execute the test with jenkins on machineA, the test failes, (but reports are sent to testLink on machineA) so here the console output :

** Invoke test (first_time)
** Execute test
E:/Ruby/bin/ruby.exe test/modifierLocalisation.rb
Loaded suite test/modifierLocalisation
Started
F
Finished in 2.140625 seconds.

1) Failure:
test_me(ModifierLocalisation) [test/modifierLocalisation.rb:14]:
<false> is not true.

1 tests, 1 assertions, 1 failures, 0 errors
rake aborted!

I think that when I execute test from jenkins on machineA, internet explorer can't start, this is why the test is in failure.

Any idea of what I could do?

도움이 되었습니까?

해결책

You could run your selenium tests remotely from Machine A.

in your code change

ie = Watir::IE.new

to

capabilities = WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
ie = Watir::Browser.new(:remote, :url => 'http://machineB:4444/wd/hub', :desired_capabilities => capabilities)
ie = Watir::Browser.new :ie
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top