2011-10-25 3 views
8

Я использую Eclipse Indigo в Win XP с Maven 3.0.3. Я создал тест Selenium 2, который я хочу отлаживать в Eclipse. Он настроен для работы на этапе интеграции интеграции Maven. Я использую плагин Maven Cargo с Tomcat в качестве контейнера. Вот соответствующий раздел из моего pom.xml ...Trouble debugging Тест интеграции Maven в Eclipse

 <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <configuration> 
       <container> 
        <containerId>tomcat${tomcat.major}x</containerId> 
        <zipUrlInstaller> 
         <url>http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.tar.gz</url> 
         <downloadDir>${project.build.directory}/downloads</downloadDir> 
         <extractDir>${project.build.directory}/extracts</extractDir> 
        </zipUrlInstaller> 
        <output>${project.build.directory}/tomcat${tomcat.major}x.log</output> 
        <log>${project.build.directory}/cargo.log</log> 
       </container> 
       <configuration> 
        <home>${project.build.directory}/tomcat-${tomcat.version}/container</home> 
        <properties> 
         <cargo.logging>high</cargo.logging> 
         <cargo.servlet.port>8080</cargo.servlet.port> 
        </properties> 
       </configuration> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-container</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>start</goal> 
         <goal>deploy</goal> 
        </goals> 
        <configuration> 
         <deployer> 
          <deployables> 
           <deployable> 
            <groupId>${project.groupId}</groupId> 
            <artifactId>${project.artifactId}</artifactId> 
            <type>war</type> 
            <pingURL>http://localhost:8080/${project.artifactId}</pingURL> 
            <pingTimeout>30000</pingTimeout> 
            <properties> 
             <context>${project.artifactId}</context> 
            </properties> 
           </deployable> 
          </deployables> 
         </deployer> 
        </configuration> 
       </execution> 
       <execution> 
        <id>stop-container</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <configuration> 
       <!-- Skip the normal tests, we'll run them in the integration-test phase --> 
       <skip>true</skip> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>test</goal> 
        </goals> 
        <configuration> 
         <skip>false</skip> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

Проблема, когда я правой кнопкой мыши на моем интеграционного теста в Eclipse, выберите «Debug As», а затем выбрать свою конфигурацию отладки, которая (только специалист цель «clean install -Dtest = TableIntegrationTest»), выполнение выполняется без нажатия на точку останова I (http://screencast.com/t/at0AKWwxslE). Как я могу выполнить сквозную отладку в тесте интеграции JUnit/Selenium в Eclipse?

ответ

16

Тесты интеграции Maven по умолчанию запускаются в разветвленной JVM. Поэтому eclipse не может подключаться к разветвленной JVM и видеть точки останова.

Вы можете заставить интеграционный тест работать в одном JVM с параметром -DforkMode = never.

Подробнее здесь: http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html

Edit: Обновлена ​​ссылка

Смежные вопросы