qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          soapUI中多個TestCase之間傳遞參數

           SoapUI中可以定義一個個的測試用例TestCase,但是有些用例是依賴于之前的用例的,如果純拷貝的話可能會導致用例比較臃腫而且不好維護,比如說存在如下兩個TestCase:
            1)CreateUserTestCase:測試創建用戶,通過發送Soap報文方式創建用戶同時需要校驗數據庫中值是否正確
            2)ChangUserInfoTestCase:測試修改用戶信息,通過發送Soap報文方式修改用戶信息,需要校驗修改前和修改后的用戶信息
            ChangUserInfo之前必須得創建一個用戶,純拷貝肯定是不可取的,因為后續如果創建用戶的接口稍有變動,則需要同時在ChangUserInfoTestCase和CreateUserTestCase修改請求報文。
            SoapUI在TestCase中提供Run TestCase的Step,可以直接調用指定的TestCase,但是需要前一個TestCase中將屬性傳遞出來,步驟如下:
            1)在被調用TestCase中設置返回屬性
            testRunner.testCase.setPropertyValue("屬性名稱",“屬性值”)
            2)在調用TestCase中增加Run TestCase指向被調用TestCase
            3)在調用TestCase中的其它Test Step中獲取屬性
            例如:在CreateUserTestCase中將創建好的用戶ID傳給ChangUserInfoTestCase,則步驟如下:
            1)在CreateUserTestCase中通過Groovy Script. 設置返回屬性:
            testRunner.testCase.setPropertyValue("UserID",context.getProperty("UserID"))
            2) 在ChangUserInfoTestCase中增加Run TestCase:RunNewUserTestCase指向CreateUserTestCase并指定UserID屬性為輸入值
            3)在ChangUserInfoTestCase中獲取執行CreateUserTestCase得到的用戶ID
          def NewUserProperties = testRunner.testCase.getTestStepByName( "RunNewUserTestCase" );
          log.info(NewUserProperties .getPropertyValue( "UserID" ))
          本文出自 wendy-qian 的51Testing軟件測試博客:http://www.51testing.com/?15017055

          posted on 2014-01-16 11:17 順其自然EVO 閱讀(3985) 評論(0)  編輯  收藏 所屬分類: web 前端性能測試

          <2014年1月>
          2930311234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 马山县| 阿图什市| 隆林| 怀仁县| 甘谷县| 兴业县| 垣曲县| 湘潭县| 新宾| 嘉荫县| 邵武市| 项城市| 德江县| 稻城县| 璧山县| 潢川县| 汉寿县| 保靖县| 鄢陵县| 将乐县| 东丽区| 泸西县| 南乐县| 金门县| 塔城市| 屯昌县| 海林市| 南昌市| 涿州市| 陆良县| 仁怀市| 洪雅县| 沈阳市| 瓮安县| 涿州市| 通榆县| 石首市| 天津市| 江都市| 东乡县| 杭州市|