views:

291

answers:

3

Hi I'm getting a symbol not found error, when running mvn -e integration-test. Why could this happen if the package is in my repository? I have tried downloading it and installing it manually but it does not make a difference. Is this a common error in maven?

I'm using vista home edition,

Error message

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
D:\MyWorks\steps\step6\functest\src\it\com\mycompany\app\functest\FirstTest.java:[22,25] cannot find symbol
symbol  : constructor SeleniumServer(int)
location: class org.openqa.selenium.server.SeleniumServer

Tutorial being used. http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/

POM

<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"&gt;
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>myapp</artifactId>
    <groupId>com.mycompany</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

 <artifactId>functest</artifactId>
  <name>functional-tests</name>
  <packaging>pom</packaging>

  <dependencies>
    <dependency>
      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
      <artifactId>selenium-java-client-driver</artifactId>
      <version>1.0</version>
      <scope>test</scope>
    </dependency>

     <dependency>
      <groupId>org.openqa.selenium.server</groupId>
      <artifactId>selenium-server</artifactId>
      <version>1.0.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.1</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/it</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/it/testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

PATH to selenium server class on my machine. Everything is there, I checked.

.m2\repository\org\openqa\selenium\server\selenium-server\1.0.1\selenium-server-1.0.1.jar\org\openqa\selenium\server\

+3  A: 

Sounds like the constructor SeleniumServer(int) no longer exists in the version (1.0.1) you have listed as your dependency.

If I could find javadocs for SeleniumServer online then it might be possible to suggest which one to use.

matt b
+2  A: 

The class in error (org.openqa.selenium.server.SeleniumServer) is defined in the selenium-server dependency you already have listed.

The only discrepancy that I can see is that the selenium-server and selenium-java-client-driver versions in the tutorial are at version 0.9. Looking at the sources the constructor taking an int has been removed in the 1.0.1 version.

For the purpose of the tutorial it would be simplest to roll back to the 0.9 version, then once you're more familiar with the API, move back up to 1.0.1 and refactor accordingly.

Here's the Javadoc for the 1.0 version (compare with the 0.9 version), indicating that the port (the int argument to the constructor) can now only be passed as a command-line argument to the main method:

**main**

public static void main(java.lang.String[] args)
             throws java.lang.Exception

Starts up the server on the specified port (or default if no port was specified) and then starts interactive mode if specified.

Parameters:
    args - - either "-port" followed by a number, or "-interactive"
Rich Seller
+4  A: 

The constructor taking an int (the port) as parameter has indeed been removed (see Changeset:2260). So use the no-arg constructor SeleniumServer() to create your SeleniumServer (4444 is the default port anyway) :

@BeforeSuite
public void startSeleniumServer() throws Exception {
  seleniumServer = new SeleniumServer();
  seleniumServer.start();
}

Or use SeleniumServer(RemoteControlConfiguration configuration) if you need to pass configuration options.

Pascal Thivent