在Eclipse上运行的其余api测试用例自动将测试结果发布到JIRA Adaptavist Tool中

时间:2019-02-03 20:03:02

标签: java testng jira

我正在寻找一种在JIRA Adaptavist测试管理工具中更新自动化测试用例的想法。测试用例用Java和TestNg编写,并在VM上运行。请提出在JIRA Adaptavist测试管理工具中自动更新测试结果(通过或失败)的一种好方法。当前,我们正在工具中手动更新结果。

使用Zephyr和XRay或任何其他第三方的COTS工具时遇到的问题是,审批过程繁琐且延迟。

感谢您的时间,帮助和支持。

我们的Android测试团队开发了以下代码,我们不知道如何实现。

Here is the android team's code :

Open class rTestCaseHelper {

@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()

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

}

}

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

1 个答案:

答案 0 :(得分:0)

不确定您要寻找的是什么。 这是执行此操作的一种方法: 创建一个新的自定义批注,该批注可用于引用代表特定测试用例的Jira ID。 用新的注释注释@Test方法,以便将测试方法绑定到其JIRA ID。 现在,通过实现ITestNGListener来构建TestNG侦听器,并在其onTestFailure()内通过ITestResult.getTestMethod()。getConstructorOrMethod()。getMethod()检索自定义批注来检索Jira ID,然后将RESTful调用激发到您的Jira实例更新测试结果。 “生活中所有可取的东西都是非法的,昂贵的,发胖的或爱上别人的!”

testManager.postWebLinkToTestCycle()

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

}

}

}
fun initializeSDK(activeProtection: Boolean = false): Boolean {
rSdkEnvironment.initializeSDK(activeProtection, InstrumentationRegistry.getInstrumentation().targetContext)
return rSdk.isInitialized() 
}
相关问题