REST API

How to integrate your test automation environment with Orcanos web services

OVERVIEW

Orcanos provides you the facility of Test Automation where we can execute and update the results of the tests via APIs.

The 3rd party automation software can use these APIs to get the set of tests to execute, map the automation scripts (script for each Orcanos test), and, write the test steps result to the Orcanos.

The Test Automation requires 2 APIs and these are:

  1. Get_Execution_Run_Details_XML: This API will return all the details of the execution set to be run with a placeholder for the test steps’ actual result.
  2. Record_Execution_Results_New: This API updates the test results into the Orcanos.

TEST AUTOMATION PROCESS FLOW:

  1. Authorization: We are using basic Authentication which needs to be sent with every request.
  2. Get Orcanos XML: Run API, Get_Execution_Run_Details_XML
  3. Set Data to Orcanos XML: Update Actual results and other field values into the XML as per requirement.
  4. Record Execution result: Copy and paste the above XML into the Record_Execution_Results_New API and execute it to update the results in Orcanos.

Step1:

Run API, Get_Execution_Run_Details_XML :

This API will return all the details of the execution set to be run with the full execution set content including tests connected to it in the XML format.

Enter the REST API URL: https://alm/orcanos.com/xxxxxxxx/api/v2/json/Get_Execution_Run_Details_XML

Here xxxxxx will be the domain name of the customer.

Step2:

Enter the fields and their details as mentioned:

Post body:

Parameter

Value

Is Mandatory?

Description

User_Name String Yes Valid Username
User_Password String Yes Valid password
Execution_Set_ID Integer Yes The id of execution to retrieve.

Note: It will display the result for all tests added in the execution set.

Run_Status_Filter String No Filter by a list of statuses, separated by [,], for example: “No run, Fail”. Default is empty=all
Assigned_Filter String No Filter by a list of users, separated by [,], for example: “user1, user2”. Default is empty=all
Work_Status_Filter String No Filter by a list of work status, separated by [,], for example: “sts1, sts2”. Default is empty=all
Test_ID String No List of test cases in the execution (multiple select, examples: “12121, 343, 555”). Default=All

Note: If you want to update results for any specific test then specify the value.

TestInExecLineID String No List of test instances to execute (multi-select, for example: “3222, 4433, 555)
Type String No “Auto”/”Manual”, default=” Auto”
convertHTMLtoText Boolean Yes TRUE/FALSE Change the HTML tags to plain text use-values ‘true’ or ‘false”

 

Code Snippet:

cURL:

curl --location --request POST 'https://xxxx.orcanos.com/xxxx/API/v2/json/Get_Execution_Run_Details_XML' \ ---> Take customer server url before web like, if your url is https://app.orcanos.com/orcanos/web then you need to take it till https://app.orcanos.com/orcanos/webhttps://app.orcanos.com/orcanos/ and add /API/v2/json/Get_Execution_Run_Details_XML after that
--header 'Content-Type: application/json' \
--header 'Accept: application/xml' \
--header 'Authorization: Basic dGVzdC51c2VyOnRlc3QucGFzc3dvcmQ=' \
--data-raw '{
  "Execution_Set_ID": 45572,
  "Run_Status_Filter": "",
  "Assigned_Filter": "",
  "Work_Status_Filter": "",
  "Test_ID": "45573",
  "TestInExecLineID": "",
  "Type": "",
  "convertHTMLtoText": true
}'

Step3:

Click on Send Button and user will get the output in XML format like,

Output:

Purpose of Each Fields:
  • Execution_Set_Run_Results id – This is the id of the Execution set where the user wants to execute the test cases.
  • Name – This is the name of the Execution set.
  • Cycle= It defines the number of run cycle of the test case

  • Run name is a unique string from DateTime parsing – created for each call for this web service and will be used to record the results with unique value.
  • Run version default is taken from the execution set version.
  • Start and End – it defines the start and end time of execution. its format is DD/MM/YYYY HH:MM: SS
  • User is the login user to the Web Service (User_Name)
  • Type – This is the type of test case that it’s manual/automation or something else.
  • TestCount – It defines the number of steps in the test case.

  • TestInExecLineID – the id of the line of the test in the execution. Each line is per test (can be duplicate due to parameter instances or double test in the execution).
  • Order – This is the order sequence of the test case in the execution set.
  • TestID – This is the test case ID and it will be entered by the User.
  • ImportStatus – Success/Fail/Empty – Used when saving the results. Each test that was saved successfully is marked Success. Each test that was failed in save marked as Fail. Default is empty.
  • ErrorDesc – This field is deprecated in Web Version.

  • Name – This is the name of the test case
  • LastRunStatus – It defines the last run status of the test case, it can be PASS/FAIL/Not Complete/No Run (Depends on last run execution)
  • LastRunVersion – It defines the last run version number of the test case.
  • Tester – It defines the tester username
  • WorkPlanStatus – This field is deprecated in Web Version.
  • Description – This is the description of the Test case.

  • Step ID – This is the id of the step of the test case.
  • Order – This is the order sequence number of the test step in the test case.
  • Description – This is the description of the test step
  • Expected – This is the expected result of the test step
  • Actual – This is the actual result of the test step and it will be entered by the User. actual results need to enter into <![CDATA[]]> tag like <![CDATA[Enter your Actual Result here]]> to get as it is without converting it into XML
  • Run Status – It defines the status of the test step. it can be PASS/FAIL/SKIP and will be entered by the User.
  • Time start and end – it defines the start and ends time of test step execution. its format is DD/MM/YYYY

  • InputTestParams – This field is deprecated in Web Version.
  • ResultParams – This field is deprecated in Web Version.

  • InputRunParams – Note that they will be added only if the instances of the test were added to the test before it added to the execution set (the test exist in the exe-set as an instance). It will not be added if the test has parameters but not instances
    • Param Name – It defines the parameter name that user selects
    • Value – It defines the value of parameters if defined in the system.

Step4:

Copy and paste the results XML of Get_Execution_Run_Details_XML into Notepad

and

After replace ” with the \” for whole XML.

NOTE:

  • Since This field (sXML) takes input data in the string so the user needs to replace double quote(“) with the backslash double quote (\”) to escape the double quote ” and pass it in API.
  • In the Automated process, this step might be not required

Step5:

Replace the step actual results value and other parameters like Run Name, Run Version, Test Parameter, etc.

Step6:

Enter the URL: https://alm/orcanos.com/xxxxxxxx/api/v2/json/Record_Execution_Results_New and enter the values in the fields,

sXML: The response of Get_Execution_Run_Details_xml will be used in this field after replacing the values.

Code Snippet:

cURL:

curl --location --request POST 'https://xxxxx.orcanos.com/xxxx/API/v2/json/Record_Execution_Results_New' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic bdGVzdC51c2VyOnRlc3QucGFzc3dvcmQ=' \
--data-raw '{
  "sXML": "<Execution_Set_Run_Results ID=\"45572\" Name=\"Exe set78\" Cycle=\"1\" xmlns=\"\">
    <Run Name=\"RUN_8_29_2021_11_25_12_AM\" Version=\"2.0.0.0\" Start=\"\" End=\"\" User=\"bansal.neha\" Type=\"Auto\" TestCount=\"1\">
        <TestInExecLine ID=\"8316\" Order=\"1\">
            <Test ID=\"45573\"></Test>
            <ImportStatus></ImportStatus>
            <ErrorDesc></ErrorDesc>
            <Name>
                <![CDATA[Test90]]>
            </Name>
            <LastRunStatus>PASS</LastRunStatus>
            <LastRunVersion>02.00.000.0000</LastRunVersion>
            <Tester>Bansal.neha</Tester>
            <WorkPlanStatus></WorkPlanStatus>
            <Description></Description>
            <Steps>
                <Step ID=\" 26575\" Order=\"1\">
                    <Description>Login
</Description>
                    <Expected>Login Success
</Expected>
                    <Actual></Actual>
                    <Command>
                        <![CDATA[]]>
                    </Command>
                    <CommandParams></CommandParams>
                    <SQLQry>
                        <![CDATA[]]>
                    </SQLQry>
                    <Run Status=\"\" />
                    <Time Start=\"\" End=\"\" />
                </Step>
                <Step ID=\" 26576\" Order=\"2\">
                    <Description>Navigate to dashbaord
</Description>
                    <Expected>Get success
</Expected>
                    <Actual></Actual>   ----> actual results need to enter into <![CDATA[]]> tag like <![CDATA[Enter your Actual Result here]]> to get as it is without converting it into XML
                    <Command>
                        <![CDATA[]]>
                    </Command>
                    <CommandParams></CommandParams>
                    <SQLQry>
                        <![CDATA[]]>
                    </SQLQry>
                    <Run Status=\"FAIL\" />
                    <Time Start=\"\" End=\"\" />
                </Step>
            </Steps>
            <InputTestParams>
                <Param Name=\"\" Value=\"\" />
            </InputTestParams>
            <ResultParams>
                <Param Name=\"\" Expected=\"\" Actual=\"\" />  ----> 
            </ResultParams>
        </TestInExecLine>
        <InputRunParams></InputRunParams>
    </Run>
</Execution_Set_Run_Results>"
}'

Step7:

Now run Record_Execution_Results_New API to send back the XML with the results.

This REST API gets XML reflecting run details (execution set, instances & run results), and updates Orcanos data with this run.

As a result, we will get a success message and our test case results will be updated for the related execution set.

RELATED LINKS:

  1. Get_Execution_Run_Details_XML
  2. Record_Execution_Results_New
Related Articles