0

私は Selenium Grid をセットアップしようとしていましたが、Selenium Grid ダウンロードで利用可能な ant 構成を使用する代わりに、ant 構成を使用し続けました。

Selenium Gird を知らない ant ユーザー向け - これは、1 つの「yml」ファイルで指定された異なるシステムに UI テストを配布できる Java ライブラリです。ここでは、1 つのハブ マシンを起動し、別のスレーブ マシンでブラウザを制御できます。

私が使用していたAnt構成-

<target name="setClassPath">
    <path id="classpath_jars">
        <fileset dir="${lib.dir}" includes="*.jar"/>
    </path>
    <pathconvert pathsep=":" property="test.classpath"
        refid="classpath_jars" />
</target>

<target name="launch-hub" description="Launch Selenium Hub" depends="setClassPath">
    <java classname="com.thoughtworks.selenium.grid.hub.HubServer" 
        classpathref="classpath_jars" 
        fork="true" 
        failonerror="true">

        <sysproperty key="http.proxyHost" value="${http.proxyHost}" />
        <sysproperty key="http.proxyPort" value="${http.proxyPort}" />
        <sysproperty key="https.proxyHost" value="${https.proxyHost}" />
        <sysproperty key="https.proxyPort" value="${https.proxyPort}" />

    </java>
 </target>

この構成を使用している間、ハブは常に、プロジェクトルートで定義した「yml」ファイルを考慮する代わりに、「selenium-grid-hub-standalone-1.0.8.jar」で利用可能な「yml」ファイルで始まります。

これに続いて、ant の構成を次のように変更しました。これは、Selenium Grid ディストリビューションで利用できます -

<path id="hub.classpath">
    <pathelement path="${basedir}/"/>
    <fileset dir="${basedir}/lib">
        <include name="selenium-grid-hub-standalone-1.0.8.jar"/>
    </fileset>
</path>

<target name="launch-hub" description="Launch Selenium Hub">
    <java classname="com.thoughtworks.selenium.grid.hub.HubServer"
          classpathref="hub.classpath"
          fork="true"
          failonerror="true" >

        <sysproperty key="http.proxyHost" value="${http.proxyHost}"/>
        <sysproperty key="http.proxyPort" value="${http.proxyPort}"/>
        <sysproperty key="https.proxyHost" value="${https.proxyHost}"/>
        <sysproperty key="https.proxyPort" value="${https.proxyPort}"/>
    </java>
</target>

そして今、ハブを起動すると、「selenium-grid-hub-standalone-1.0.8.jar」ファイルで使用できるファイルではなく、プロジェクトルートで定義されている「yml」ファイルが考慮されます。

私は ant 愛好家ではありませんが、両方の構成がほぼ似ていることがわかりました。最初の構成はターゲットに依存し、他の構成は「pathid」を使用します。これに光を当てることができる人はいますか?

4

1 に答える 1

0

違いは、2 番目の例のクラスパスにプロジェクトのルート ディレクトリが含まれていることだと思います。

<pathelement path="${basedir}/"/>

一方、最初のものはそうではありません。

于 2011-06-24T08:01:22.820 に答える