Skip to Content
Technical Articles
Author's profile photo Taranam Dhindsa

Testing ABAPUnit using POSTMAN

When you are executing gctsExecuteABAPUnitTests pipeline in Jenkins and getting errors like 405 etc.; you can test the ABAPUnit functionality by using POSTMAN to find the root cause of errors

  1. Firstly, get the X-CSRF-TOKEN using GET Request in POSTMAN.

In Postman, using GET Request where xxxxxxx is server name

In header tab, add the below syntax

This will return x-csrf-token

2. And afterward you can use the Request  POST                       

In Header, pass the CSRF Token obtained from step 1 and pass the key values for Accept and Content-Type as shown below

In the Body part; pass the below details – you need to pass the object name on which you  plan to execute ABAPUnit

<?xml version=”1.0″ encoding=”UTF-8″?>
<aunit:runConfiguration xmlns:aunit=””>
<coverage active=”false”/>
<uriType value=”semantic”/>
<testDeterminationStrategy appendAssignedTestsPreview=”true” assignedTests=”false” sameProgram=”true”/>
<testRiskLevels critical=”true” dangerous=”true” harmless=”true”/>
<testDurations long=”true” medium=”true” short=”true”/>
<withNavigationUri enabled=”false”/>
<adtcore:objectSets xmlns:adtcore=””>
<objectSet kind=”inclusive”>
<adtcore:objectReference adtcore:uri=”/sap/bc/adt/oo/classes/CLASS_NAME“/>

Example in place of CLASS_NAME pass value of class ‘ZCL_ABAPUNIT_DEMO’ on which you plan to execute ABAP Unit. If everything is fine; it will return the status code as 200 and below response :

<?xml version=”1.0″ encoding=”utf-8″?>
<aunit:runResult xmlns:aunit=””>
<program adtcore:uri=”/sap/bc/adt/oo/classes/zcl_abapunit_demo” adtcore:type=”CLAS/OC” adtcore:name=”ZCL_ABAPUNIT_DEMO” uriType=”semantic” xmlns:adtcore=””>
<testClass adtcore:uri=”/sap/bc/adt/oo/classes/zcl_abapunit_demo#testclass=LTCL_” adtcore:name=”LTCL_” uriType=”semantic” durationCategory=”short” riskLevel=”harmless”>
<testMethod adtcore:uri=”/sap/bc/adt/oo/classes/zcl_abapunit_demo#testclass=LTCL_;testmethod=FIRST_TEST” adtcore:name=”FIRST_TEST” executionTime=”0″ uriType=”semantic” unit=”s”/>

In case of any errors, it will not return status code as 200 and you can validate the reason behind the errors as shown in response


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo dinesh k
      dinesh k

      Interesting that we can run ABAPUnit from POSTMAN as well ;thanks for sharing