1. Home
  2. OpKey Help
  3. 26. Advanced OpKey Usage
  4. 26.21 Using OpKey APIs to get execution result in json

26.21 Using OpKey APIs to get execution result in json

Overview

An application program interface (API) is a set of subroutine definitions, communication protocols that allow two software programs to communicate with each other. There are few new APIs in the OpKey which allows OpKey users to get the execution result of their executed Test Cases and without accessing OpKey directly by using API Tools like Postman & SoapUI.

OpKey users can now use OpKey APIs to get the execution result of Test Case and Suites without directly accessing the OpKey Web user interface.

The Need of OpKey APIs

APIs work as a bridge of communication between two applications over a network. If an OpKey user wants to get details of the execution result of Test Cases and Suites then he/she can use these APIs with an API Tool like Postman & SoapUI. These APIs are

  1. Authorize
  2. GetSuiteResult
  3. GetTestCaseResult

Getting started with OpKey APIs

Let us start using the OpKey APIs on Postman API Tool to get the execution result details about the executed Test Case and Suites. An API URI composed of URL (OpKey Web domain URL), with Resource Path & Query Parameter i.e.

API URI = URL + Resource_Path + Query_Parameter

Note: Some API URIs don’t contain Query Parameters.

(1) Authorize

This API is used to get the Authorization Token by using the Username and Password of OpKey Web using the POST method.

If OpKey Web domain URL is http://www.xyz.myopkey.com then…

  • API URI (Variable): http://www.xyz.myopkey.com/api/OpkeyAuth/authorize
  • Resource Path (Static): /api/OpkeyAuth/authorize
  • There is no Query Parameter

Note: Here, the API URI depends on the OpKey Web domain name.

  • Select the Post Method and enter the API URL, go to the Authorization tab and enter OpKey Username and Password and then click on Send to get the Authorization Token.
  • The Authorization Token has been fetched which can be used in further APIs as input.

(2) GetSuiteResult

This API fetches the details about the execution result of Suite in Json format. This API takes few Query Parameters and Authorization Tokens as input using Get Method.

If OpKey Web domain URL is http://www.xyz.myopkey.com then…

  • API URI (Variable): http://www.xyz.myopkey.com/api/OpkeyRestV2/GetSuiteResult?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession
  • Resource Path (Static): /api/OpkeyRestV2/GetSuiteResult
  • Query Parameter (Variable): ?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession

Note: Here, the API URI and Query Parameters are variable in nature which depend on your Project, Build, Session etc.

  • Select the Get Method & enter the API URL, go to the Params tab and enter Query Parameters like ProjectName, BuildName & SessionName.

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here, you can have a look at the Suite Execution Result details in Json format under the Body tab.

 

(3) GetTestCaseResult

This API fetches the details about the execution result of the Test Case in Suite. This API takes few Query Parameters and Authorization Tokens as input using Get Method. You need to run the GetSuiteResult API in order to get the Test Case Step ID which is required as a Query Parameter in this API (GetTestCaseResult) for getting the Test Case Result.

If OpKey Web domain URL is http://www.xyz.myopkeycom then…

  • API URI (Variable): http://www.xyz.myopkey.com/api/OpkeyRestV2/GetTestCaseResult?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession&TestCaseStepID=IDOfYourTestCaseStep
  • Resource Path (Static): /api/OpkeyRestV2/GetTestCaseResult
  • Query Parameter (Variable): ?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession&TestCaseStepID=IDOfYourTestCaseStep

Note: Here, the API URI and Query Parameters are variable in nature which depend on your Project, Build, Session, Test Case Step ID etc.

  • Select the Get Method & enter the API URL, go to the Params tab and enter Query Parameters like ProjectName, BuildName, SessionName & TestCaseStepID.

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here, you can have a look at the Test Case Execution Result details in Json format under the Body tab.

Thus, you don’t need to access the OpKey Web to get the test case or Suite execution result. You can use these above-mentioned APIs to do get the test case or Suite execution result details.

Was this article helpful to you? Yes No