Cannot start app ONLY when running the tests with maven

Asked by vicus

Hi,

I have a test scenario where I open Add/Remove Programs app from a Sikuli test and then I remove an app using the normal UI flow. Here's how I open the uninstall app:

App uninstallApp = new App("cmd.exe /c start appwiz.cpl");
uninstallApp.open();
uninstallApp.focus();

When runnning the tests from Eclipse it works great, however, when I run the tests using maven, the code above does nothing so the test fails. Any suggestions?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
vicus
Solved:
Last query:
Last reply:
Revision history for this message
angelo (angelo-j) said :
#1

Can you post a small example with code and a pom.xml so that we can try to reproduce your problem?

Revision history for this message
vicus (vasile-pop) said :
#2

This should be enough for testing if the Add/Remove app starts (using Win 7 64bits):

App uninstallApp = new App("cmd.exe /c start appwiz.cpl");
uninstallApp.open();
uninstallApp.focus();

Here's my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.test.org</groupId>
 <artifactId>sikuli</artifactId>
 <packaging>jar</packaging>
 <version>1.0.1</version>
 <name>sikuli</name>
 <url>http://maven.apache.org</url>
 <repositories>
  <repository>
   <id>com.sikulix</id>
   <name>com.sikulix</name>
   <url>https://oss.sonatype.org/content/groups/public</url>
   <layout>default</layout>
   <snapshots>
    <enabled>true</enabled>
    <updatePolicy>always</updatePolicy>
   </snapshots>
  </repository>
 </repositories>
 <properties>
  <suiteFile>src/test/resources/windows/testng.xml</suiteFile>
 </properties>
 <dependencies>
  <dependency>
   <groupId>org</groupId>
   <artifactId>jnativehook</artifactId>
   <version>1.1.4</version>
   <scope>system</scope>
   <systemPath>${project.basedir}/lib/JNativeHook.jar</systemPath>
  </dependency>
  <dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-api</artifactId>
   <version>1.2.0</version>
  </dependency>
  <dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-webdriver</artifactId>
   <version>1.0.1</version>
  </dependency>
  <dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-core</artifactId>
   <version>1.2.2</version>
  </dependency>
  <dependency>
   <groupId>org.testng</groupId>
   <artifactId>testng</artifactId>
   <version>6.8.5</version>
  </dependency>
  <dependency>
   <groupId>com.rallydev.rest</groupId>
   <artifactId>rally-rest-api</artifactId>
   <version>2.1.1</version>
  </dependency>
  <dependency>
   <groupId>org.uncommons</groupId>
   <artifactId>reportng</artifactId>
   <version>1.1.4</version>
   <!-- <scope>test</scope> -->
   <exclusions>
    <exclusion>
     <groupId>org.testng</groupId>
     <artifactId>testng</artifactId>
    </exclusion>
   </exclusions>
  </dependency>
  <dependency>
   <groupId>com.google.inject</groupId>
   <artifactId>guice</artifactId>
   <version>3.0</version>
  </dependency>

  <dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-slides-api</artifactId>
   <version>1.5.0</version>
  </dependency>
  <dependency>
   <groupId>org.bytedeco</groupId>
   <artifactId>javacv</artifactId>
   <version>0.9</version>
  </dependency>
  <dependency>
   <groupId>com.google.code.gson</groupId>
   <artifactId>gson</artifactId>
   <version>2.3</version>
  </dependency>
  <dependency>
   <groupId>com.sikulix</groupId>
   <artifactId>sikulixapi</artifactId>
   <version>1.1.0</version>
<!-- <scope>system</scope>
     <systemPath>${project.basedir}/lib/sikulixapi.jar</systemPath>
-->
  </dependency>
  <dependency>
   <groupId>org.jfree</groupId>
   <artifactId>jfreechart</artifactId>
   <version>1.0.19</version>
  </dependency>
 </dependencies>
 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.5</version>
    <configuration>
     <systemPropertyVariables>
      <org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
     </systemPropertyVariables>
                    <suiteXmlFiles>
                        <suiteXmlFile>${suiteFile}</suiteXmlFile>
                    </suiteXmlFiles>
     <properties>
      <property>
       <name>usedefaultlisteners</name>
       <value>true</value>
      </property>
      <property>
       <name>listener</name>
       <value>org.uncommons.reportng.HTMLReporter</value>
      </property>
     </properties>
     <!-- <workingDirectory>target/</workingDirectory>-->
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <configuration>
     <encoding>UTF-8</encoding>
    </configuration>
   </plugin>
  </plugins>
  <testResources>
   <testResource>
    <directory>src/test/resources/windows/</directory>
    <filtering>true</filtering>
   </testResource>
  </testResources>
 </build>
</project>

Revision history for this message
vicus (vasile-pop) said :
#3

Actually, this was a fake problem. I misunderstood App class usage. I corrected the test and it's working fine now:

Runtime.getRuntime().exec("cmd.exe /c start appwiz.cpl");
uninstallApp = new App("appwiz.cpl");
uninstallApp.focus();

Revision history for this message
angelo (angelo-j) said :
#4

Nice to see its working now. The same thing happens to me mostly... as soon as I have to condense the problem for someone, I find the failure.