Forum Discussion

JoostDG's avatar
JoostDG
Frequent Contributor
3 years ago

Bug? Content assertion with reference to another testcase property fails on Linux, not on Windows

Hi,

I am using ReadyAPI 3.20.0 locally on Windows and we have a pipeline that runs the tests via bamboo on a Linux agent (which uses ReadyAPI 3.10.2) .

I see an assertions fail on the Linux agent but work fine locally. It's some plain simple content assertion (=JsonPath Match) on an "createdOn" element.

 

 Location of assertion:Property expansion for expected value 'createdOn':
Test SuiteSmoke Ibot Core APISmoke Ibot Core API
Test CaseGET inquiryByIdGET dossiersInquiries
Test StepGET inquiryByIdGET dossiersInquiries

 

For expected value of this "createdOn" element (REST JSON) I used the Get Data feature to get the property dynamically from another testCase within the same testSuite.

Locally on Windows that expected value can be found and matches the actual, but on Linux it cannot be found. So I assume some casing (or other Linux-Windows quirk) causes the mismatch?

 

I can see on the Linux that the CreatedOn value is present in the "GET dossiersInquiries" test step. It's only for that reference to it, in the "GET inquiryById" assertion that it's empty.

My workaround is to get that value for CreatedOn from the "GET dossiersInquiries" response and move it (via a teardown) to the "GET inquiryById" test case properties. Then I adapt my assertion to get the expected value from that "GET inquiryById" testCase, and then it works fine.

I had the same issues with those type of references inside a "Smart Assertion".

 

java.lang.Exception: Match content of [createdOn] = ${#[Smoke Ibot Core API#GET dossiersInquiries#GET dossiersInquiries]#Response#$['content'][0]['createdOn']} in [GET inquiryById] failed;
build 03-Feb-2022 22:30:48 [Comparison failed. Path: [$['createdOn']]; Expected value: []; Actual value: [2022-02-03T21:30:21.863Z].]

 

In the test case xml code the assertion looks like this, both in the repo as on my windows machine. So I guess not a casing mismatch at this level, but I am not familiar enough on how these configuration.content is referenced for JsonPath Match assertions.

 

 

 <con:assertion type="JsonPath Match" id="69387aa4-2cf2-4f99-aaed-873ec923a624" name="Match content of [createdOn] = ${#[Smoke Ibot Core API#GET dossiersInquiries#GET dossiersInquiries]#Response#$['content'][0]['createdOn']}">
          <con:configuration>
            <path>$['createdOn']</path>
            <content>${#[Smoke Ibot Core API#GET dossiersInquiries#GET dossiersInquiries]#Response#$['content'][0]['createdOn']}</content>
            <allowWildcards>false</allowWildcards>
            <ignoreNamspaceDifferences>false</ignoreNamspaceDifferences>
            <ignoreComments>false</ignoreComments>
          </con:configuration>
        </con:assertion>

 

 

 

 

No RepliesBe the first to reply