2016-05-16 21 views
0

我正在使用拆卸腳本進行API測試,以便在每次運行後修改標題值,現在我已經像測試套件的第一次運行一樣編寫了腳本,在最後一個測試套件中添加了像下面這樣的拆卸腳本Sopaui拆卸腳本

testSuite.project.setPropertyValue("BRAND_TYPE","L") 
testSuite.project.setPropertyValue("BRAND_CLIENT","LD") 

因此,這將更新我的頭,我可以運行我的測試套件,第二次,但我必須要改變頭運行測試套件進行了第三次,這樣可以在任何一個建議推倒腳本請。

+0

這個問題不清楚。你可以讓它更清楚一點嗎? – Rao

回答

0

沒有魔法,你只需要整個代碼的邏輯:

def brandTypeFirstRun = "first_value" 
def brandTypeSecondRun = "second_value" 
def brandTypeThirdRun = "third_value" 

def bradTypeCurrentValue = testSuite.project.getPropertyValue("BRAND_TYPE") 

if (bradTypeCurrentValue == brandTypeFirstRun) 
    testSuite.project.setPropertyValue("BRAND_TYPE", brandTypeSecondRun) 
else if (bradTypeCurrentValue == brandTypeSecondRun) 
    testSuite.project.setPropertyValue("BRAND_TYPE", brandTypeThirdRun) 
else if (bradTypeCurrentValue == brandTypeThirdRun) 
    testSuite.project.setPropertyValue("BRAND_TYPE", brandTypeFirstRun)