saucelabs/sauce-java

Issue with TestNG + Maven configuration

Closed this issue · 2 comments

Hi,

Here is my maven configuration , The sauce connect is not starting while maven pre-integration-test phase. Instead directly executing the tests.

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <pluginRepositories>
    <pluginRepository>
       <id>saucelabs-repository</id>
       <url>http://repository-saucelabs.forge.cloudbees.com/release</url>
       <releases>
           <enabled>true</enabled>
       </releases>
       <snapshots>
           <enabled>true</enabled>
       </snapshots>
    </pluginRepository>
    </pluginRepositories>
    <!-- dependencies -->
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.9</version>
        </dependency>
        <dependency>
            <groupId>com.saucelabs</groupId>
            <artifactId>sauce_testng</artifactId>
            <version>2.1.21</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.52.0</version>
        </dependency>
        <dependency>
            <groupId>com.saucelabs</groupId>
            <artifactId>sauce_java_common</artifactId>
            <version>2.1.18</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
    </dependencies>
<!-- Build execution management -->
    <build>
        <plugins>
            <!-- Include Sauce Connect plugin -->
            <plugin>
                    <groupId>com.saucelabs.maven.plugin</groupId>
                    <artifactId>sauce-connect-plugin</artifactId>
                    <version>2.1.3</version>
                    <configuration>
                            <sauceUsername>SEC_ID</sauceUsername>
                            <sauceAccessKey>SEC_KEY</sauceAccessKey>
                            <!--<options>-i testing</options>-->
                    </configuration>
                    <executions>
                            <execution>
                                    <id>start-sauceconnect</id>
                                    <phase>pre-integration-test</phase>
                                    <goals>
                                            <goal>start-sauceconnect</goal>
                                    </goals>
                            </execution>
                            <execution>
                                    <id>stop-sauceconnect</id>
                                    <phase>post-integration-test</phase>
                                    <goals>
                                            <goal>stop-sauceconnect</goal>
                                    </goals>
                            </execution>
                    </executions>
            </plugin>

            <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-failsafe-plugin</artifactId>
         <version>2.19.1</version>
                 <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
         <executions>
           <execution>
             <id>integration-test</id>
             <goals>
               <goal>integration-test</goal>
                             <goal>verify</goal>
             </goals>
           </execution>
         </executions>
       </plugin>

        </plugins>
    </build>

@marutiprasad I need more information to help out with this. Are your tests in properly named classes? That is *IT.java pattern in the /src/test/hierarchy.
Also make sure you run with mvn integration-test

This should be closed.