Language dependend Unit Tests - some tests fail on german and probalby russian machines

21 views
Skip to first unread message

Lukas S.

unread,
May 7, 2018, 9:59:42 AM5/7/18
to JaCoCo and EclEmma Users
Hi,

some Unit Tests in the "Command Line Interface" test module fail when the system language is set to german (and propably russian)

The problem is that the messages of the exceptions from args4j get translated, but the unit tests expect english messages. args4j provides bundles for german and russian.

For example one problematic line is: assertContains("\"--invalid\" is not a valid option", err);
"is not a valid option" get's translated by args4j, so err doesn't contain the english phrase

The affected test cases are:
ClassInfoTest: should_print_usage_when_invalid_option_is_given
DumpTest: should_print_usage_when_no_argument_is_given
ExecInfoTest: should_print_usage_when_invalid_argument_is_given
InstrumentTest: should_print_usage_when_no_options_are_given
MergeTest: should_print_usage_when_no_options_are_given
ReportTest: should_print_usage_when_no_options_are_given
MainTest: should_print_usage_when_no_arguments_given

Not sure if this is a problem of JaCoCo or args4j, because it gives a translated message for getMessage, although there is a specific method to get a localized message: getLocalizedMessage



Marc Hoffmann

unread,
May 7, 2018, 3:15:19 PM5/7/18
to jac...@googlegroups.com

Hi Lukas,

indeed this seems to be an issue with the args4j version we're using. This have been improved with later versions:

https://github.com/kohsuke/args4j/commit/8bf2b9ec70be6016175bf76c4d423c428ade3378

If I remember correctly we can't update to newer versions of the lib as JaCoCo still supports Java 5 runtimes.

We could probably configure the locale in the build to english so we don't step into this issues at least with the build.

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/00fdd674-11bd-463b-b94c-f8d2a200a7eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Marc Hoffmann

unread,
May 7, 2018, 4:09:55 PM5/7/18
to jac...@googlegroups.com

Here is a simple fix at least for the build:

https://github.com/jacoco/jacoco/pull/682

Regards,
-marc

 

On 2018-05-07 15:59, Lukas S. wrote:

--

Lukas S.

unread,
May 8, 2018, 7:03:22 AM5/8/18
to JaCoCo and EclEmma Users
Cool, thanks for your help
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages