Netbeans +JUnit4 +Unicode output in test results

For some reasons JUnit does not output unicode when run from within Netbeans (all versions) facilities, whatever Netbeans configuration is. Since Ant can be influenced from at least 3 places (build.xml script, global options, project options), I record a solution here, which further captures the information at the project level and not the IDE level.

The shortest path to fix that is to add -Dfile.encoding=UTF-8 to the VM options specific to the project run settings. This is different from the VM settings used to launch Netbeans (in etc/config/netbeans.conf), and is project specific. Ant will use the run options set to execute the project to run the unit tests, which makes sense.

This options can be found by right clicking on the project name in the project view (CTRL+1) or through Run > Set Project Configuration > Customize…, then go to the « Run » category and find VM Options.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *