Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

export test steps along with the test scripts from ETM v7.0.2

Hello,
I need to export the test steps along with the test scripts from ETM v7.0.2. I am trying to use reportable rest api and python script (see below). However I am getting following error. Any ideas? Also, is there another way to achive this?

Error:
AppData\Roaming\Python\Python313\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Script:
import requests
from requests.auth import HTTPBasicAuth

# Constants
RQM_BASE_URL = 'https://*****:9443/qm'
RQM_USERNAME = '***'
RQM_PASSWORD = '***'
TEST_SCRIPT_ID = '10155'

# Endpoint to fetch test steps for a given test script
TEST_STEPS_ENDPOINT = f"'{RQM_BASE_URL}/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Test(QM)/testscript/urn:com.ibm.rqm:testscript:10155"

def fetch_test_steps():
    print ("Endpoint ",TEST_STEPS_ENDPOINT)

    # Set up the authentication
    auth = HTTPBasicAuth(RQM_USERNAME, RQM_PASSWORD)

    # Set up the headers
    headers = {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    }
    # Make the GET request to fetch test steps
    response = requests.get(TEST_STEPS_ENDPOINT, auth=auth, headers=headers, verify=False)

    # Check if the request was successful
    if response.status_code == 200:
        print ("Status ", response.json())
        # Parse the JSON response
        #test_steps = response.json()
        print("Test Steps fetched successfully:")
        #print(test_steps)
    else:
        print(f"Failed to fetch test steps. Status code: {response.status_code}")
        print(f"Response: {response.text}")

if __name__ == "__main__":
    fetch_test_steps()

0 votes

Comments

I have seen this kind of errors typically if authentication fails. I have explained how this is supposed to work here: https://rsjazz.wordpress.com/2021/10/15/elm-authentication/

I would suggest you use a browser to log into ELM and then use a RESTClient in that browser to try out your requests to elm. Then you know you are authenticated and you can see what happens. Fix your authentication and you are good.



3 answers

Permanent link

Thanks for the response Ralph! The rest client works fine. It even retruns the data. In the script, the status_code returned is 200, so I am assuming the authetication is also successful? Do you think the URI could be wrong? 


Thanks!
Rama

0 votes


Permanent link

No, just because it returns a 200 does not mean authentication works. I provided you with the link to the blog post, that explains this in details. You can also look here: https://github.com/IBM/ELM-Python-Client for example code.

The REST client does the authentication for you and you can't see what is happening, unless you record an HAR file.
There is an authentication dance and that you have to follow and that included information in response headers such as Location.

0 votes


Permanent link

Thank you for pointing to ELM client. I was trying to use something like CCM example (link below) to get the test script and steps.



However, I am not sure what is the correct syntax for following for ETM.
qcbase = p.get_query_capability_uri("oslc_cm1:ChangeRequest")

Can you please point me the documentation where I can get such details?

Thank you for your help!
Rama

0 votes

Comments

I pointed to the ELM-Python-Client for you to look at the authentication. The project is open source, I am not a maintainer for it. It supports OSLC and reportable REST API.
It provides examples and documentation: https://github.com/IBM/ELM-Python-Client/tree/master/elmclient/examples there is only one ETM example, but at least that is a starting point. The ETM Reportable RESt API is documented on Jazz.net. Find it here: https://jazz.net/wiki/bin/view/Deployment/ELMProductAPILanding

However, regardless which API you use, you need the authentication part.


My reportable REST examples are for EWM, not ETM and you can find them in the article series containing my Authentication post - see the link.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,079

Question asked: Mar 17 '25, 3:40 p.m.

Question was seen: 1,646 times

Last updated: Mar 21 '25, 6:01 a.m.

Confirmation Cancel Confirm