1

machineA という Windows 7 マシンに jenkins マスター ノードと testLink をインストールしました。私は、Ruby 1.8.7、watir 1.7.1、ci_reporter 1.8.4、テスト ユニット 2.5.4、rake 10.0.3、jenkins スレーブ ノードを Java Web Start (JNLP) を介して、machineB と呼ばれる Windows サーバー 2003 にインストールしました。

プロジェクトの目的は、machineA からビルドを開始することです。その後、jenkins スレーブは、machineB で (watir を使用して、つまり navigator を使用して) ruby​​ テストを実行し、machineA でレポートを送信します (testLink によって読み取られる)。

jenkinsマスターノード(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

ここでは、2 つの異なる方法で実行するテストを示します (マシン B のローカルで、マシン A の Jenkins を使用)。

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     

ローカル machineB でテストを実行すると、テストは成功したため、コンソール出力は次のようになります。

** 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

しかし、machineA で jenkins を使用してテストを実行すると、テストは失敗します (ただし、レポートは machineA の testLink に送信されます)。コンソール出力は次のとおりです。

** 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!

machineA で jenkins からテストを実行すると、Internet Explorer が起動しないため、テストが失敗していると思います。

私に何ができるか考えていますか?

4

1 に答える 1

1

マシン A からリモートでセレン テストを実行できます。

コードの変更で

ie = Watir::IE.new

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
于 2013-04-04T21:30:24.013 に答える