Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Plug-in tests

On 12/7/12 1:41 AM, "Mickael Istria" wrote:

On 12/06/2012 11:16 PM, Rizzo, Eric wrote:
On a more general note, I'm looking for a comprehensive example or guide for running JUnit tests for an RCP product build. The examples I've seen so far don't account for the fact that a product has special context that needs to be satisfied for the tests to run. For example, some of our tests require that Equinox DS plugin be auto-started with a start level to make sure declared services are available before the test is executed. There are other requirements for our product, which is why we have a detailed launch configuration for executing the tests from within the IDE. I guess what I need is some help converting that launch configuration (and the custom TestSuite it uses to collect tests) into an appropriate Tycho configuration.
Tycho currenly allows testing at test-plugin level. There is an issue open to request execution of tests with Tycho on a fully-provisionned RCP application: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386988 .
If it comes to orchestrating your tests on an RCP app, I think the best way to achieve it so far is to use the legacy mechanism to run tests headless (ie install your tests into your product and then run the uitestapplication).
Here is an example of how to achieve this in the context of SWTBot http://wiki.eclipse.org/SWTBot/Automate_test_execution#On_an_already_packaged_RCP_application


OK, so I'm confused. Part of it is surely due to my relative Equinox ignorance.

IF Tycho does't support running tests on an RCP application or product, what's with the <application> and/or <product> elements of the tycho-surefire-plugin? I've tried specifying either one of them in my plugin test pom (our test suite launch config specifies the application ID), but neither works. I end up with the same problem, though manifested in slightly different ways depending on whether I specify <application> or <product>: our service that is declared via Equinox DS isn't being initialized properly thus causing other parts of our plugins to fail.

If I specify the product, the tests actually run and generate a failure report from surefire. If I specify the application instead, I just get an equinox startup failure and pointer to the workspace .log. In both cases, the root cause always points to the declarative service that isn't initialized.

The relevant part of the test plugin is below.

Thanks for the help,
Eric


  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <!--
 <application>com.emc.xcp.builder.ui.application</application>
 -->
 <product>com.emc.xcp.builder.ui.product</product>
          <argLine>-Xms40m -Xmx512m -XX:MaxPermSize=256m -Xmx896m -Dorg.eclipse.equinox.http.jetty.http.port=2910 -Dorg.eclipse.update.reconcile=false -Dequinox.ds.print=true -Dfile.encoding=UTF8</argLine>
          <includes>
            <include>**/Test*.java</include>
          </includes>
          <useUIHarness>true</useUIHarness>
          <useUIThread>true</useUIThread>
          <bundleStartLevel>
              <bundle>
                 <id>org.eclipse.osgi</id>
                 <level>-1</level>
                 <autoStart>true</autoStart>
              </bundle>
               <bundle>
                 <id>org.eclipse.equinox.ds</id>
                 <level>2</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>org.eclipse.equinox.simpleconfigurator</id>
                 <level>1</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>org.eclipse.equinox.common</id>
                 <level>2</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>org.eclipse.equinox.http.jetty</id>
                 <level>3</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>org.eclipse.equinox.http.registry</id>
                 <level>3</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>org.eclipse.update.configurator</id>
                 <level>3</level>
                 <autoStart>true</autoStart>
              </bundle>
              <bundle>
                 <id>com.emc.xcp.builder.workspace.starter</id>
                 <level>3</level>
                 <autoStart>true</autoStart>
              </bundle>
           </bundleStartLevel>
        </configuration>
      </plugin>
     </plugins>
    </build>


Back to the top