You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mraible <ma...@raibledesigns.com> on 2007/03/06 22:12:46 UTC

Selenium, profiles and executing certain browsers on certain OSs

I'm using the <salenese> Ant task to run some Selenium tests in my project. 
I want tests to run in Firefox on all platforms, and Firefox and IE when
running on Windows.  I've got everything working using the XML below, but
it's quite verbose.  Is there a way to simplify, or is this the recommended
strategy?

    <profiles>
        <profile>
            <id>${cargo.container}</id>
            <activation>
                <property>
                    <name>!maven.test.skip</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <version>0.2</version>
                        ...
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>launch-selenium</id>
                                <phase>integration-test</phase>
                                <configuration>
                                    <tasks>
                                        <taskdef
resource="selenium-ant.properties">
                                            <classpath
refid="maven.plugin.classpath"/>
                                        </taskdef>
                                        <selenese
suite="src/test/resources/selenium/TestSuite.html"
                                                  browser="*firefox"
timeoutInSeconds="180"
                                                 
results="${project.build.directory}/selenium-firefox-results.html"
                                                 
startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>ant</groupId>
                                <artifactId>ant-nodeps</artifactId>
                                <version>1.6.5</version>
                            </dependency>
                            <dependency>
                               
<groupId>org.openqa.selenium.server</groupId>
                                <artifactId>selenium-server</artifactId>
                                <version>0.9.1-SNAPSHOT</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>windows</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>launch-selenium</id>
                                <phase>integration-test</phase>
                                <configuration>
                                    <tasks>
                                        <taskdef
resource="selenium-ant.properties">
                                            <classpath
refid="maven.plugin.classpath"/>
                                        </taskdef>
                                        <selenese
suite="src/test/resources/selenium/TestSuite.html"
                                                  browser="*firefox"
timeoutInSeconds="180"
                                                 
results="${project.build.directory}/selenium-firefox-results.html"
                                                 
startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
                                        <selenese
suite="src/test/resources/selenium/TestSuite.html"
                                                  browser="*iexplore"
timeoutInSeconds="180"
                                                 
results="${project.build.directory}/selenium-ie-results.html"
                                                 
startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

Thanks,

Matt
-- 
View this message in context: http://www.nabble.com/Selenium%2C-profiles-and-executing-certain-browsers-on-certain-OSs-tf3358368s177.html#a9341212
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Selenium, profiles and executing certain browsers on certain OSs

Posted by mraible <ma...@raibledesigns.com>.
My current setup only executes Cargo and Selenium when -Dmaven.test.skip=true
is not passed in.  If I move the <plugin> information to the regular <build>
part of my pom.xml, do I leave the <execution> information in profiles?

After adding another profile for Selenium on OS X (for Safari), my
"integration-testing" section is almost 200 lines long. Yes, it does work,
but it does seem awful verbose.

http://rafb.net/p/2hIgrI84.html

Matt


Eric Redmond wrote:
> 
> Sure... pull the build configurations out of the profiles into the project
> build and replace the ant config values with properties... then use the
> profiles to set those property values.
> 
> Eric
> 
> On 3/6/07, mraible <ma...@raibledesigns.com> wrote:
>>
>>
>> I'm using the <salenese> Ant task to run some Selenium tests in my
>> project.
>> I want tests to run in Firefox on all platforms, and Firefox and IE when
>> running on Windows.  I've got everything working using the XML below, but
>> it's quite verbose.  Is there a way to simplify, or is this the
>> recommended
>> strategy?
>>
>>     <profiles>
>>         <profile>
>>             <id>${cargo.container}</id>
>>             <activation>
>>                 <property>
>>                     <name>!maven.test.skip</name>
>>                 </property>
>>             </activation>
>>             <build>
>>                 <plugins>
>>                     <plugin>
>>                         <groupId>org.codehaus.cargo</groupId>
>>                         <artifactId>cargo-maven2-plugin</artifactId>
>>                         <version>0.2</version>
>>                         ...
>>                     </plugin>
>>                     <plugin>
>>                         <artifactId>maven-antrun-plugin</artifactId>
>>                         <executions>
>>                             <execution>
>>                                 <id>launch-selenium</id>
>>                                 <phase>integration-test</phase>
>>                                 <configuration>
>>                                     <tasks>
>>                                         <taskdef
>> resource="selenium-ant.properties">
>>                                             <classpath
>> refid="maven.plugin.classpath"/>
>>                                         </taskdef>
>>                                         <selenese
>> suite="src/test/resources/selenium/TestSuite.html"
>>                                                   browser="*firefox"
>> timeoutInSeconds="180"
>>
>> results="${project.build.directory}/selenium-firefox-results.html"
>>
>> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
>> }/"/>
>>                                     </tasks>
>>                                 </configuration>
>>                                 <goals>
>>                                     <goal>run</goal>
>>                                 </goals>
>>                             </execution>
>>                         </executions>
>>                         <dependencies>
>>                             <dependency>
>>                                 <groupId>ant</groupId>
>>                                 <artifactId>ant-nodeps</artifactId>
>>                                 <version>1.6.5</version>
>>                             </dependency>
>>                             <dependency>
>>
>> <groupId>org.openqa.selenium.server</groupId>
>>                                 <artifactId>selenium-server</artifactId>
>>                                 <version>0.9.1-SNAPSHOT</version>
>>                             </dependency>
>>                         </dependencies>
>>                     </plugin>
>>                 </plugins>
>>             </build>
>>         </profile>
>>         <profile>
>>             <id>windows</id>
>>             <activation>
>>                 <os>
>>                     <family>Windows</family>
>>                 </os>
>>             </activation>
>>             <build>
>>                 <plugins>
>>                     <plugin>
>>                         <artifactId>maven-antrun-plugin</artifactId>
>>                         <executions>
>>                             <execution>
>>                                 <id>launch-selenium</id>
>>                                 <phase>integration-test</phase>
>>                                 <configuration>
>>                                     <tasks>
>>                                         <taskdef
>> resource="selenium-ant.properties">
>>                                             <classpath
>> refid="maven.plugin.classpath"/>
>>                                         </taskdef>
>>                                         <selenese
>> suite="src/test/resources/selenium/TestSuite.html"
>>                                                   browser="*firefox"
>> timeoutInSeconds="180"
>>
>> results="${project.build.directory}/selenium-firefox-results.html"
>>
>> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
>> }/"/>
>>                                         <selenese
>> suite="src/test/resources/selenium/TestSuite.html"
>>                                                   browser="*iexplore"
>> timeoutInSeconds="180"
>>
>> results="${project.build.directory}/selenium-ie-results.html"
>>
>> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
>> }/"/>
>>                                     </tasks>
>>                                 </configuration>
>>                                 <goals>
>>                                     <goal>run</goal>
>>                                 </goals>
>>                             </execution>
>>                         </executions>
>>                     </plugin>
>>                 </plugins>
>>             </build>
>>         </profile>
>>     </profiles>
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/Selenium%2C-profiles-and-executing-certain-browsers-on-certain-OSs-tf3358368s177.html#a9341212
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> -- 
> Eric Redmond
> http://codehaus.org/~eredmond
> 
> 

-- 
View this message in context: http://www.nabble.com/Selenium%2C-profiles-and-executing-certain-browsers-on-certain-OSs-tf3358368s177.html#a9347203
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Selenium, profiles and executing certain browsers on certain OSs

Posted by Eric Redmond <er...@gmail.com>.
Sure... pull the build configurations out of the profiles into the project
build and replace the ant config values with properties... then use the
profiles to set those property values.

Eric

On 3/6/07, mraible <ma...@raibledesigns.com> wrote:
>
>
> I'm using the <salenese> Ant task to run some Selenium tests in my
> project.
> I want tests to run in Firefox on all platforms, and Firefox and IE when
> running on Windows.  I've got everything working using the XML below, but
> it's quite verbose.  Is there a way to simplify, or is this the
> recommended
> strategy?
>
>     <profiles>
>         <profile>
>             <id>${cargo.container}</id>
>             <activation>
>                 <property>
>                     <name>!maven.test.skip</name>
>                 </property>
>             </activation>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.codehaus.cargo</groupId>
>                         <artifactId>cargo-maven2-plugin</artifactId>
>                         <version>0.2</version>
>                         ...
>                     </plugin>
>                     <plugin>
>                         <artifactId>maven-antrun-plugin</artifactId>
>                         <executions>
>                             <execution>
>                                 <id>launch-selenium</id>
>                                 <phase>integration-test</phase>
>                                 <configuration>
>                                     <tasks>
>                                         <taskdef
> resource="selenium-ant.properties">
>                                             <classpath
> refid="maven.plugin.classpath"/>
>                                         </taskdef>
>                                         <selenese
> suite="src/test/resources/selenium/TestSuite.html"
>                                                   browser="*firefox"
> timeoutInSeconds="180"
>
> results="${project.build.directory}/selenium-firefox-results.html"
>
> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
> }/"/>
>                                     </tasks>
>                                 </configuration>
>                                 <goals>
>                                     <goal>run</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>                         <dependencies>
>                             <dependency>
>                                 <groupId>ant</groupId>
>                                 <artifactId>ant-nodeps</artifactId>
>                                 <version>1.6.5</version>
>                             </dependency>
>                             <dependency>
>
> <groupId>org.openqa.selenium.server</groupId>
>                                 <artifactId>selenium-server</artifactId>
>                                 <version>0.9.1-SNAPSHOT</version>
>                             </dependency>
>                         </dependencies>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>         <profile>
>             <id>windows</id>
>             <activation>
>                 <os>
>                     <family>Windows</family>
>                 </os>
>             </activation>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <artifactId>maven-antrun-plugin</artifactId>
>                         <executions>
>                             <execution>
>                                 <id>launch-selenium</id>
>                                 <phase>integration-test</phase>
>                                 <configuration>
>                                     <tasks>
>                                         <taskdef
> resource="selenium-ant.properties">
>                                             <classpath
> refid="maven.plugin.classpath"/>
>                                         </taskdef>
>                                         <selenese
> suite="src/test/resources/selenium/TestSuite.html"
>                                                   browser="*firefox"
> timeoutInSeconds="180"
>
> results="${project.build.directory}/selenium-firefox-results.html"
>
> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
> }/"/>
>                                         <selenese
> suite="src/test/resources/selenium/TestSuite.html"
>                                                   browser="*iexplore"
> timeoutInSeconds="180"
>
> results="${project.build.directory}/selenium-ie-results.html"
>
> startURL="http://${cargo.host}:${cargo.port}/${project.build.finalName
> }/"/>
>                                     </tasks>
>                                 </configuration>
>                                 <goals>
>                                     <goal>run</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>     </profiles>
>
> Thanks,
>
> Matt
> --
> View this message in context:
> http://www.nabble.com/Selenium%2C-profiles-and-executing-certain-browsers-on-certain-OSs-tf3358368s177.html#a9341212
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Eric Redmond
http://codehaus.org/~eredmond