cerner / ccl-testing

A collection of maven plugins and their dependencies to perform CCL Unit tests and static analyses and to generate reports from the results.
Apache License 2.0
16 stars 11 forks source link

Unit test failing due to invalid json? #45

Closed mjj4791 closed 3 years ago

mjj4791 commented 4 years ago

This issue is related to https://github.com/cerner/ccl-testing/issues/42 This time the unit test case fail, not on the null-character as mentioned in issue 42, but on a simple double quote in the source code (");

I have sent you a DM with the the project/code used to reproduce this issue. The files generated on the backend are in the folder ./ccl/output/.

The Error/test failure I get with this testcase is:
“Expected a ',' or '}' at character 899 of {"CCLUTREPLY": …“

On position 899 I find: <![CDATA[declare ut_logtext = vc with protect, noconstant("")]]> (position 899 is the second ")

In the output.log I can see that the test case succeeded/was executed. When I have other test cases run under the same conditions, they do not fail on these quotes even though the very same include file is included in those test cases as well… In those cases I can see that the quotes have been escaped correctly in the json.

mvn -version:

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
Maven home: C:\Program Files (x86)\apache-maven-3.6.0\bin\..
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jre1.8.0_201
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Maven command to test:

cd ccl
mvn clean test -Pt18vx 

I have sent you a DM/email with all relevant files & a code project that I used to reproduce this single test case.

Other details:

feckertson commented 3 years ago

A CCL defect is causing the problem.

The unit test is calling cnvtrectojson(rec, 0, 1, 1) and calling cnvtrectojson with an odd value for the fourth parameter causes all subsequent calls to echojson and echoxml to truncate the result to 2000 characters. The result is that invalid xml is being returned to the ccl-maven-plugin because echoxml is used to generate the test result and coverage data.

Making any call to cnvtrectojson or cnvtrectoxml without a fourth value or with an even fourth value makes the problem stop,

You could add a cnvtrectojson call in a teardownOnce subroutine in your test case as a workaround till the CCL issue is fixed,