Search code examples
python-3.xrestselenium-webdriverrobotframeworkhp-quality-center

Working around HP ALM Rest api


There has been many link and question around this problem but I still have my doubts.

In my project i am using Robot Framework with selenium for automation, things are smooth till here.

Now the next step is to consume the HP ALM Rest API and integrate with my robot framework, so that test cases pass/fail status, screenshot as attachment, defect log is done automatically.

Currently i have no idea how to proceed with this, like from where i can get the API for HP ALM QC and how to work around with this?

Hope you got my doubts.


Solution

  • I believe that I understood your question correctly.

    You should give a look to QCRI (https://github.com/douville/qcri).

    This will enable you to publish the your Robot Framework results directly in QC! You just have to confirm if it works with your ALM version.

    Probably you should use a custom robot framework runner, that in the end calls a python script or the QCRI command line prompt that do the import automatically.

    runner.sh with calling a python script that uses QCRI API:

    #runner.sh  
    
    #runs the robot framework script first
    pybot "$@"
    
    #imports the results to QC
    python importQC.py 
    

    importQC.py:

    import qcri
    
    loc = 'c:/TestResults/output.xml'
    parsers = qcri.get_parsers(loc)
    results = qcri.parse_results(parsers[0], loc)
    conn = qcri.connect('http://localhost:8080/qcbin', 'QA', 'WEBTEST', tester, secret)
    qcri.import_results(conn, 'GroupA/SubGroup', results, attach_report=False)
    

    runner.sh that uses the QCRI command line prompt:

    #runner.sh  
    
    #runs the robot framework script first
    pybot "$@" 
    
    #imports the results to QC    
    qcri --url http://localhost:8080/qcbin --domain QA --project WEBTEST --username tester --pasword secret --source c:/TestResults/output.xml --destination GroupA/SubGroup --attach_report True 
    

    In the end you just have to call your RF script using the runner.sh:

    sh runner.sh RF-Script.txt
    

    The solutions above are highly automated, but if you want to have more control on what you import to QC you could also use the QCRI GUI.