Question

I am trying to run unit tests in my TeamCity build that require openJPA enhancement (I am using openjpa 2.0.1). My build configuration is based on my Intellij project. (i.e. I am not using Maven/Ant to build, instead TeamCity offers to just pull in your Intellij project configuration stored in the .idea folder to determine how to compile/build the project.) I'm running tests by including intellij run configurations in the Intellij project build step.

In my local IDE (Intellij) I can run my integration tests by including a -javaagent:<path to openjpa jar> vm argument.

When I run the same "run configuration" in my team city build, the entities are not getting enhanced, so my tests fail.

Any tips or ideas for doing this? I've tried using ant to do build-time enhancement but a) I haven't been successful getting it to work locally and b) the intellij project step in teamcity clears out any existing output folders (so the enhanced classes get discarded.)

Was it helpful?

Solution

Sometimes it comes down to RTFM...

What I was trying to do was run my tests with run-time (via JVM args and javaagent) or build-time (via Ant task) enhancement by configuring that in my Intellij run configurations. Unfortunately that is not supported.

http://confluence.jetbrains.net/display/TCD65/IntelliJ+IDEA+Project

TeamCity IntelliJ IDEA runner supports subset of IntelliJ IDEA features:

JUnit 3.x/4.x -

  • Test runner parameters are not supported
  • running of the Ant or Maven before tests start is not supported
  • alternative JRE is not supported

So my solution (which works as expected) was to configure the following steps in my TeamCity project config:

  1. Intellij Runner step - compile project
  2. Ant step - build-time enhance
  3. Ant step - run tests

As I see it there is no way to accomplish this with a single Intellij Runner step in TeamCity using the intellij project and intellij run configurations.

I've filed a feature request with the TeamCity folks here: http://youtrack.jetbrains.net/issue/TW-18739

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top