Rally Software

  • 1.  JSON formatted data is stored in teststeps input section. How to get json formatted teststep input through rally rest api?

    Posted Jun 23, 2018 10:51 PM

    In rally, I am adding multiple test steps. And each teststep input section contains the json formatted data:

    Example:

    {
    "operation": "LoginToPortalUI",
    "interface":"ANALYTICS_RESTAPI",
    "data": {
    "Username": "admin",
    "Password": "7layereyal7"
    }
    }

     

    Rally APIs called:

    ...

    String tstep = tcsteps.get(teststepIndex).getAsJsonObject().get("Input").getAsString();

     

    Output (tstep above) from rest api has values with unexpected chars:

    <div class="rally-rte-class-00878dddd80d18 rally-rte-class-0b98933b9a8138"><div class="rally-rte-class-0d4912bd480226">{</div><div class="rally-rte-class-0d4912bd480226">"operation": "LoginToPortalUI",</div><div class="rally-rte-class-0d4912bd480226">"interface":"ANALYTICS_RESTAPI",</div><div class="rally-rte-class-0d4912bd480226">"data": {</div><div class="rally-rte-class-0d4912bd480226">"Username": "admin",</div><div class="rally-rte-class-0d4912bd480226">"Password": "7layereyal7"</div><div class="rally-rte-class-0d4912bd480226">}</div><div class="rally-rte-class-0d4912bd480226">}</div></div>



  • 2.  Re: JSON formatted data is stored in teststeps input section. How to get json formatted teststep input through rally rest api?

    Broadcom Employee
    Posted Jun 25, 2018 11:02 AM

    Hi Madhusudhan,

     

    The WSAPI docs are found at: https://rally1.rallydev.com/slm/doc/webservice/ 

    You can click the TestCaseStep under Object Model to learn the available fields as well as the endpoints. 

     

    Here is what it says about the Input field:

     

     

    As you can see it's a String based field.

     

     

    How did you set the Input value, did you do that using the user interface of via WSAPI?

     

     

    Thanks,

    Sagi



  • 3.  Re: JSON formatted data is stored in teststeps input section. How to get json formatted teststep input through rally rest api?

    Posted Jun 26, 2018 12:40 AM

    Thanks Sagi for reply. For Automation testing, REST API test data, we need to store in Json format. I have set the json input in teststep while creating test case manually.

    Is there a consistent alternate way to remove the unexpected html chars, etc. after i read the json input from RALLY REST API?



  • 4.  Re: JSON formatted data is stored in teststeps input section. How to get json formatted teststep input through rally rest api?
    Best Answer

    Broadcom Employee
    Posted Jun 26, 2018 03:11 PM

    Hi Madhusudhan,

     

    I confirmed that indeed there are the HTML tags and special characters. I can see it in the raw value that's being set to the Test Case Steps' input field, see the screen shot from Post Man:

     

     

    The reason for this - by the way - is that the editor that Agile Central provides for this field is a HTML editor and so it formats it in a way that will later be compliant with that same editor so that you can watch it nicely from inside the product.

     

    To answer your question:

    There isn't a way that we - that is Agile Central - provide to strip out the undesirable characters from this field. However, you can certainly convert the format, strip out the characters yourself. 

     

    Doing that would depend on the technology you're using. Here is an example in PHP and another in JavaScript. You shall certainly do more online searches to find something suitable for your need:

     

    PHP: strip_tags - Manual 

    Strip HTML Tags in JavaScript | CSS-Tricks 

     

    Thanks,

    Sagi