1

我正在尝试在需要 openJPA 增强的 TeamCity 构建中运行单元测试(我使用的是 openjpa 2.0.1)。我的构建配置基于我的 Intellij 项目。(即我没有使用 Maven/Ant 来构建,而是 TeamCity 提供只提取存储在 .idea 文件夹中的 Intellij 项目配置以确定如何编译/构建项目。)我正在通过包含 intellij 运行配置来运行测试在 Intellij 项目构建步骤中。

-javaagent:<path to openjpa jar>在我的本地 IDE (Intellij) 中,我可以通过包含一个vm 参数 来运行我的集成测试。

当我在团队城市构建中运行相同的“运行配置”时,实体没有得到增强,因此我的测试失败。

这样做的任何提示或想法?我尝试使用 ant 进行构建时增强,但是 a)我没有成功让它在本地工作,b)teamcity 中的 intellij 项目步骤清除了任何现有的输出文件夹(因此增强的类被丢弃。)

4

1 回答 1

2

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

于 2011-10-28T16:49:53.287 回答