Open APIs

 View Only
  • 1.  Issues in CTK-TMF663-Shopping_Cart-4.0.0

    TM Forum Member
    Posted Oct 20, 2020 10:09
    We have discovered the following issues in the CTK postman scripts.

    When we run the CTK, the test for value held on validFor always fails (as shown below).

    FAIL  Body includes value held on validFor | AssertionError: expected '{"id":"30fa6f87-071a-4323-9586-aea617491a45","href":"http://bm-dev.tmbmarble.com/api/shopping-cart-projection/v3/shoppingCart/30fa6f87-071a-4323-9586-aea617491a45","validFor":{"endDateTime":"2020-10-27T12:31:46.131Z","startDateTime":"2020-10-20T12:31:46.131Z"},"relatedParty":[{"id":"CUST-01","@referredType":"CUSTOMER"}],"channel":{"name":"Telesales"},"userId":"user-cust-1","status":"ACTIVE","userType":"CUSTOMER","createdOn":"2020-10-20T12:31:46.132Z","updatedOn":"2020-10-20T12:31:46.132Z","createdBy":"customer-1","updatedBy":"customer-1"}' to include { endDateTime: '2020-10-27T12:31:46.131Z', startDateTime: '2020-10-20T12:31:46.131Z' }


    From looking at the postman scripts, we suspect that the reason is due to the following:

    pm.test('Body includes value held on validFor', function () {

    pm.expect(pm.response.text()).to.include(instance['validFor']);

    });

    Here, text value (as returned by pm.response.text()) is compared with an object (as returned by instance['validFor']). These are incompatible types and would never pass, even though the validFor object is present in the response.

    The solution is to compare both as strings, as given below:

    pm.test('Body includes value held on validFor', function () {

    pm.expect(pm.response.text()).to.include(JSON.stringify(instance['validFor']));

    });

    Similarly, the VALIDFORSC01 & VALIDFORSC02 global variables that are set in the tests are also not converted to Strings. These variables are later used as parameters in the /shoppingCart?validFor={{VALIDFORSC01}} endpoint tests. These also fail, since we cannot pass [object Object] as parameters in the query string.


    We could not find a repo for CTK-TMF663-Shopping_Cart-4.0.0. If these issues are valid, then we would like raise them against the repo and maybe also provide a PR. Can anyone point us to the right repo or SPOC for shopping cart CTK?



    ------------------------------
    Santosh MK
    Tech Mahindra Limited
    ------------------------------


  • 2.  RE: Issues in CTK-TMF663-Shopping_Cart-4.0.0

    TM Forum Member
    Posted Oct 26, 2020 03:21
    Thank you Santosh for your input, 

    In a first glance I agree with everything that you said.

    I raised an Jira issue on your behalf (https://projects.tmforum.org/jira/browse/AP-2384) and we will assign time for the fix during the week, you can follow up and comment on the issue, I suggest watching it to know when it is done.

    Best Regards,

    ------------------------------
    Henrique Rodrigues
    TM Forum
    ------------------------------