さまざまなブラウザー (Chrome、Firefox、Internet Explorer、Safari )。Maven を使用すると、さまざまなブラウザーの値をプロパティとして入力することで、さまざまなプロファイルを作成できます。また、将来的には Hudson のような継続的インテグレーション サーバーでこれを実行することも計画しています。
しかし、今、私はジレンマに直面しています。Selenium Server 2.0 を使用するプラグインを取得することで、このフォーラムの助けのおかげで、FireFox 4 で TestRunner を表示することができました。ただし、ブラウザーがアクティブ化されると、TestRunner はそこに留まり、スイート内のテストを自動的に実行しません。
Selenium IDE でテスト スイートを実行すると、問題なく動作するので、テスト スイートに問題がないことがわかります。また、IE ブラウザー オプションを使用してテスト スイートを実行しましたが、問題なく正常に実行されました。また、Firefox 3.6 にダウングレードすることで動作することも確認したので、これは Firefox 4 と Maven Selenium プラグインに関係していると確信しています。
以下の私のPOMファイルのスニペットをご覧ください。
....
<properties>
<selenium.server.version>2.0a7</selenium.server.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<browser>*firefox</browser>
<suite>src/test/selenium/html/suite.html</suite>
<startURL>http://localhost:5555/</startURL>
<port>5555</port>
</configuration>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium.server.version}</version>
<exclusions>
<!-- prevent ant:ant versus org.apache.ant:ant collision -->
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>Run-Selenese-Scripts</id>
<phase>integration-test</phase>
<goals>
<goal>selenese</goal>
</goals>
<configuration>
<port>5555</port>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
....
Maven コマンドmvn integration-testを使用してスクリプトを実行すると、前述のように TestRunner ページが表示されますが、テストは自動的に実行されません。使用する URL は次のとおりです。
chrome://src/content/TestRunner.html?auto=true&multiWindow=false&defaultLogLevel=info&baseUrl=http%3A%2F%2Flocalhost%3A5555%2F&resultsUrl=http://localhost:5555/selenium-server/postResults&test=http%3A% 2F%2Flocalhost%3A5555%2Fselenium-server%2Ftests%2Fsuite.html
私が奇妙だと思うのは、上記の URL を次の URL に変更すると、テストが自動的に実行されることです。これはまさに私が望んでいることです。
http://localhost:5555/selenium-server/core/TestRunner.html?test=..%2Ftests%2Fsuite.html&resultsUrl=http%3A%2F%2Flocalhost:5555%2Fselenium-server%2FpostResults
私の質問は、動作する URL を使用して、Firefox 4 で Maven-Selenium プラグインを自動的に実行する方法はありますか? 構成する必要があるセットアップはありますか?
答えが「いいえ」の場合、Selenium HTML スクリプトを実行してブラウザーから独立して実行する最も便利な方法は何でしょうか。また、ビルドが完了してコードがデプロイされた後、Hudson などの継続的インテグレーション サーバーでこれらのテストを実行できますか?
事前にどうもありがとうございました、
ファン