且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置的file.encoding在蚂蚁JUnit测试?

更新时间:2023-11-20 08:44:58

JUnit的支持的子元素< jvmarg ...> 这应该做你想要什么。

JUnit supports a child element <jvmarg ...> which should do what you want.

<junit fork="yes">
  <jvmarg value="-Dfile.encoding=UTF-8"/>
  ...
</junit>

我假设你使用了叉= YES 属性,因为这开始了试运行一个新的JVM,这样的参数在命令行蚂蚁-Dfoo =栏不一定传播到JVM运行测试。

I assume you were using the fork=yes attribute since this starts a new JVM for the test run, thus the parameters you send into ant at the command line ant -Dfoo=bar do not necessarily propagate to the JVM running the tests.