Automatically post test results in JIRA Adaptavist Tool from rest api test cases run on eclipse

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Feb 3, 2019, 11:45:37 PM via Website

I need some guidance for recording Test Results Automatically in JIRA Adaptavist Test Management Tool using Java and Testng or any other method within the framework of Java. my automation test cases are in JIRA Adaptavist Test Management Tool. The test cases are written in Java & TestNg and are running on a VM. Our Android team developed some code to deal with this problem. It is just that I don't know how to solve this. they used kotlin to build the code mapping the automation test case names to that of the TestIDs in JIRA Adaptavist Test Management Tool.

Every time we run the automation, the team has to input the results in JIRA Adaptavist Test Management Tool manually. It is becoming cumbersome for us to deal with this.

Here is the android team's code :

Open class WrTestCaseHelper {

@rule
@jvmField
val grantWriteStorageAccess: GrantPermissionRule = GrantPermissionRule.grant(
android.Manifest.permission.WRITE_EXTERNAL_STORAGE)

@rule
@jvmField
val reportRule :TestWatcher = Object : TestWatcher() {
var startTime = 0
override fun starting(description: Description?) {
startTime = System.currentTimeMillis().toInt()

if (sharedPreference.getTestCount() == 0) {
testManager.getTestIdAndStoreToSharedPreference()
testManager.createTestCycle()
}

}

override fun succeeded(description: Description?) {
if(description != null) {
val executionTime = System.currentTimeMillis().toInt() - startTime
testManager.generateExecutionReport(description.methodName, result: "Pass", executionTime)

}

}

override fun failed(e: Throwable?, description: Description?) {
super.failed(e.description)
if(description != null) {
val executionTime = System.currentTimeMillis().toInt() - startTime
testManager.generateExecutionReport(description.methodName, result: "Fail", executionTime, e)

}

}

override fun finished(description: Description?) {
sharedPreference.setTestCount(sharedPreference.getTestCount() -1)
//Post artfact report link to test cycle (TODO)
testManager.postWebLinkToTestCycle()

WrSharedPreference.preference.edit().clear()
Log.d(tag: "QAA", msg: "Automation suite finished and sharedPreference data is cleared!")

}

}

}
fun initializeSDK(activeProtection: Boolean = false): Boolean {
WrSdkEnvironment.initializeSDK(activeProtection, InstrumentationRegistry.getInstrumentation().targetContext)
return WrSdk.isInitialized()
}

Be the first to answer
Recommended articles