开发者

TestRunner not running automatically when running Selenium 2.0 HTML Selenese tests using Selenium-Maven Plugin

I am trying to run a series of HTML selenium tests using the selenese command through Selenium Maven plugin (version 1.1) in the hopes of coming up with a solution to able to run these tests across different browsers (Chrome, Firefox, Internet Explorer, Safari). Through Maven I would be able to create different profiles by entering different browser values as properties. I am also planning on running this on a continuous integration server like Hudson down the road.

However, right now, I am faced with a dilemma. I am able to get FireFox 4 to display the TestRunner thanks to some help from this forum by getting the plugin to use Selenium Server 2.0. However, when the browser is activated, TestRunner just sits there and it doesn't run the tests in the suite automatically.

If I run the test suite in Selenium IDE, it runs perfectly fine, so I know there is no issue with the test suite. I have also run the test suite using the IE browser option and it ran fine without any issues. I have also confirmed that by downgrading to Firefox 3.6 it will run, so I am fairly certain that this has to do with Firefox 4 and the Maven Selenium plugin.

Please see a snippet of my POM file below.

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

I run the script using the Maven command mvn integration-test, and as I mentioned earlier it brings up the TestRunner page, but the tests do not run automatically. The URL that it uses is as follows.

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

What I find strange is that when I change the above URL to the following URL, it runs the tests automatically, which is exactly what I want.

http://localhost:5555/selenium-server/core/TestRunner.html?test=..%2Ftests%2Fsuite.html&resultsUrl=http%3A%2F%2Flocalhost:5555%2Fselenium-server%2FpostResults

My question is there a way to get the Maven-Selenium plugin to run automatically for Firefox 4 by using the URL that works? Is there some setup that I would need to configure?

If the answer is no, then what would be the most convenient way to run Selenium HTML scripts so that they are running independently of the browser. Also, would I be able to run those tests on a continuous integration server, like Hudson, after our builds are complete and code is deployed?

Thank you very much in advance,

Juan


I figured out the issue. I simply upgraded to the Selenium Server 2.0b3 artifact and it worked smoothly. Apparently, 2.0a7 was released in October 2010 whereas 2.0b3 was released in March 2011 which coincides with the Firefox 4 release.

The tests are now running automatically on firefox as they should. I hope this helps anyone else who is experiencing the same issue.

Cheers,

Juan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜