Developers, Developers, Developers! Maksim Sorokin IT Blog

21Dec/100

Tests in Tycho

In Tycho tests expected to have the following name pattern: **/Test*.java, **/*Test.java and **/*TestCase.java. By default, the following is excluded: **/Abstract*Test.java**/Abstract*TestCase.java and **/*$*.

If you want to change excluded and included tests, in your test fragment you have to add something like the following:

<build>
  <plugins>
    <plugin>
      <groupId>org.sonatype.tycho</groupId>
      <artifactId>maven-osgi-test-plugin</artifactId>
      <version>${tycho-version}</version>
      <configuration>
        <excludes>
          <exclude>**/BasicTest.java</exclude>
        </excludes>
        <includes>
          <include>**/CalcRunnerCase.java</include>
        </includes>
      </configuration>
    </plugin>
  </plugins>
</build>

Keep in mind, that if tycho will not find any tests, it will fail! See discussion on issue tracker.

12Mar/103

Hard-To-Mock Objects

What to do with objects, which are hard to mock?

For instance, you are working with org.w3c.dom. Suddenly you need a feature of extracting elements by tagname only from the first level. Since by default method getElementsByTagName returns all the elements from all levels, you decide to write your own method: