背景/セットアップ:
JUnit にはたくさんのテスト クラスがあります。すべてMavenとEclipseの両方で構成されています。各テスト クラスは RemoteWebDriver インスタンスをインスタンス化し、テスト クラスの実行が終了した後、tearDown メソッドでそれを終了します。
「mvn clean install」を実行してすべてのテストを実行しようとすると、一部のテストは正常に実行されますが、残りのテストは次の例外 (スタックトレース) のために失敗します。
Tests in error:
com.tagged.qa.selenium.tests.gifts.GiftsPageTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.tags.TagsPageTest: Error communicating with the remote browser. It may have died.(..)
addFriendsTest(com.tagged.qa.selenium.tests.friends.FriendsTest): Error communicating with the remote browser. It may have died.(..)
deleteFriendsTest(com.tagged.qa.selenium.tests.friends.FriendsTest): Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.statusupdates.StatusUpdatesTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.comments.CommentsTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.search.SearchPageTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.homepage.HomePageTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.wink.WinkPageTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.profile.ProfilePageTest: Error communicating with the remote browser. It may have died.(..)
com.tagged.qa.selenium.tests.footerpagestests.TermsOfServiceTest: Error communicating with the remote browser. It may have died.(..)
Tests run: 18, Failures: 0, Errors: 11, Skipped: 0
失敗した個々のテストについて target/surefire-reports/ のログを確認すると、次のようになります。
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Caused by: org.openqa.selenium.WebDriverException: Session ID may not be null.
テストの実行中に、ブラウザー (私の場合は firefox) が開こうとしているのに、すぐに終了することに気付きました。Selenium サーバーは、セッション ID がないことをログに記録します。数回試行し、試行を終了します。その後、パイプライン内の他のすべてのテストが同じ理由で失敗します。
困惑しているのは、これらのテストを個別に実行しようとすると、この問題は発生しませんが、maven を使用してそれらすべてを一緒に実行しようとすると、これが一貫して発生するという事実です。助けてください?