Encountered failure while running the Issue2754IT test case.
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.07 s <<< FAILURE! - in ee.jakarta.tck.faces.test.servlet30.ajax.Issue2754IT
[ERROR] ee.jakarta.tck.faces.test.servlet30.ajax.Issue2754IT.testAjaxViewScope Time elapsed: 0.068 s <<< FAILURE!
java.lang.AssertionError
at ee.jakarta.tck.faces.test.servlet30.ajax.Issue2754IT.testAjaxViewScope(Issue2754IT.java:43)
assertTrue(page.asNormalizedText().contains("input: Validation Error: Value is required"));
This line of code is checking whether the return message of the page contains a specified string. Through debugging, it was found that in my runtime environment, the content returned by page.asNormalizedText() is:
Apparently, the return messages have been internationalized.
I went to check the mojarra project's definition of the return message, and in the English environment, the fields defined in the Messages.properties file are used :
jakarta.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required.
The environment I'm running tests in is macOS, and the country setting is "China", so I'll use the Messages_zh_CN.properties .
In fact, in this test case, the content of page.asNormalizedText() is as expected, but because it returns a Chinese string, it causes a wrong judgment.
We can keep GlassFish using consistent locale settings for any language environment on any operating system by setting the JVM parameters:
-Duser.language=en -Duser.country=US
This way all tests are run in a consistent environment.
Fortunately, GlassFish's arquillian plugin supports setting the JVM parameters via environment variables glassfish.systemProperties
I am running faces TCK tests in the GlassFish project using the following command:
Encountered failure while running the Issue2754IT test case.
View line 43 of test case Issue2754IT
This line of code is checking whether the return message of the page contains a specified string. Through debugging, it was found that in my runtime environment, the content returned by page.asNormalizedText() is:
Apparently, the return messages have been internationalized.
I went to check the mojarra project's definition of the return message, and in the English environment, the fields defined in the Messages.properties file are used :
The environment I'm running tests in is macOS, and the country setting is "China", so I'll use the Messages_zh_CN.properties .
In fact, in this test case, the content of page.asNormalizedText() is as expected, but because it returns a Chinese string, it causes a wrong judgment.
We can keep GlassFish using consistent locale settings for any language environment on any operating system by setting the JVM parameters:
This way all tests are run in a consistent environment.
Fortunately, GlassFish's arquillian plugin supports setting the JVM parameters via environment variables glassfish.systemProperties
So, you can set the
glassfish.systemProperties
property in the pom:This way, arquillian will convert
glassfish.systemProperties
to JVM parameters when starting GlassFish.In addition, on macOS, the value of Locale.getDefault() cannot be influenced by setting the environment variable LC_ALL:
On Linux, it is possible to change the Locale.getDefault() via the environment variable LC_ALL.
So, I think setting JVM parameters is a more prudent approach to keep all environments consistent.