我正在尝试从SOAP-UI groovy脚本更新HpQC结果
但我目前无法修改ST_ACTUAL
设计步骤,
只读取当前值。
每次尝试进行groovy异常(" designStep.item(c).Field(ST_ACTUAL)"是一个方法调用表达式,但它应该是一个变量表达式"例如)
对于我的尝试,我在测试中有两个步骤。你能帮忙解决我的问题并告诉我哪里错了吗?提前,非常感谢您的帮助和解答。
//############# Connexion a HpQC ###############
def tdc = new ActiveXObject ('TDApiOle80.TDConnection')
tdc.InitConnectionEx(addresse_qc)
tdc.Login(login_qc, psw_qc)
tdc.Connect(domain_qc, project_qc)
log.info "*** connected to QC ***"
//Catch the testSet campain in the Test Lab
oTestSetFolder = tdc.TestSetTreeManager.NodeByPath(chemin_dans_qc)
list_TestSetList = oTestSetFolder.FindTestSets(testSet_name_qc)
oTestSet = list_TestSetList.Item(1)
//catch the test list in the Test Lab
oTestSetFactory = oTestSet.TSTestFactory
testList = oTestSetFactory.NewList("")
def nb_test = testList.Count()
// select first test (item(1) -- Current status test Run - should be "No Run"
selected_test = testList.Item(1)
log.info("OnGoing test : " + "ID="+ selected_test.ID +" - "+ selected_test.name + " - status= "+selected_test.Status)
// Create a new Test Run and modified final status for try
OnGoing_RunTest= selected_test.RunFactory.AddItem('Comment 1')
OnGoing_RunTest.Status = 'Blocked'
def b=OnGoing_RunTest.ID
OnGoing_RunTest.Post()
OnGoing_RunTest.CopyDesignSteps()
OnGoing_RunTest.Post()
Stepslist_of_OnGoing_RunTest = OnGoing_RunTest.StepFactory.NewList("")
//def nbsteps= Stepslist_of_OnGoing_RunTest.count()
def c=1
for(designStep in Stepslist_of_OnGoing_RunTest)
{
// lecture designStep
def a=designStep.ID
// checking previous information : ok
//log.info("DesignStep_ID="+designStep.ID)
//log.info("ST_STEP_NAME = "+ designStep.field("ST_STEP_NAME"))
//log.info("ST_STATUS = "+ designStep.field("ST_STATUS"))
//log.info("ST_DESCRIPTION = "+ designStep.field("ST_DESCRIPTION"))
//log.info("ST_EXPECTED = "+ designStep.field("ST_EXPECTED"))
// updating Status and ST_ACTUAL field
designStep.Status="Not Completed" // : OK
// Updating ST_ACTUAL field
// designStep.Field("ST_ACTUAL")="123" // => KO
//designStep.item(c).Field("ST_ACTUAL")="123" // ==> KO
// designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO
// designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO
c++
log.info("ST_ACTUAL = "+ designStep.field("ST_ACTUAL"))
designStep.post()
}
//Updating Run QC
selected_test.Post()
log.info("*** ---- END Test --- ***")
//######### déconnection de QC ############
tdc.Disconnect()
//On écrit dans le log
log.info("### -- QC disconnect -- ### -- END -- ###")
答案 0 :(得分:0)
我从未在Groovy中尝试过但在Ruby中我不得不使用这样的东西(未经测试的示例代码):
designStep["ST_ACTUAL"]="123"