Katalon自動化測試框架

Katalon自動化測試project結構圖

其中commen-》action, pagecontol

testcase->function test case

utility->method

1.在profile中定義需要用到的常用參數,配置文件

2.在object repository中定義頁面元素,按頁面及form拆分建議文件夾

3.Action 的test case中定義操作元素的方法,並定義 變量

 

if(!CustomKeywords.'com.ashford.method.Operation.isEmpty'(Country))

    WebUI.selectOptionByValue(findTestObject('Common/Checkout/Payment Option/Billing Address/Billing Address - Country Name'),

        Country, false)

WebUI.delay(2)    

    WebUI.sendKeys(findTestObject('Common/Checkout/Payment Option/Billing Address/Billing Address - First Name'), FirstName)

4.在Method中調用相應的action

 

WebUI.callTestCase(findTestCase('Common Test Case/Status Check/Page Control - Current Location/Is Checkout Shipping Page'),

    [:], FailureHandling.STOP_ON_FAILURE)

if (CustomKeywords.'com.ashford.method.Operation.convertY'(UseDefaultAddress)) {

    CustomKeywords.'com.ashford.global.Constant.getDebugMessageLabel'('Using default shipping address.')

} else {

    WebUI.callTestCase(findTestCase('Common Test Case/Checkout/Shipping Address/Input Shipping Address'), [('CountryName') : CountryName

            , ('FirstName') : FirstName, ('LastName') : LastName, ('StreetAddress1') : Address1, ('StreetAddress2') : Address2

            , ('City') : City, ('State') : State, ('ZipCode') : ZipCode, ('PhoneNumber') : Phone1, ('OtherPhone') : Phone2

            , ('EmailAddress') : EmailAddress, ('District') : District, ('TestSite') : TestSite], FailureHandling.STOP_ON_FAILURE)

       if (EmailAddress!="Generate")

       {

           WebUI.callTestCase(findTestCase('Common Test Case/Checkout/Shipping Address/Next Step From Shipping Address'), [:],

               FailureHandling.STOP_ON_FAILURE)

       }

}

5.在case中調用方法完成測試用例

 

WebUI.callTestCase(findTestCase('Utility/Home Page/Enter Home Page'), [('SiteURL') : SiteURL], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase('Utility/PDP/Add to Cart from PDP By Search ID'), [('ProductID') : ProductID, ('Size') : Size

        , ('Qty') : QTY], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase('Utility/Shopping Cart/Shopping Cart to Checkout Flow'), [('IsGuestUser') : IsGuestCheckout,('HostURL') : SiteURL],

    FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase('Utility/Checkout/Checkout Shipping/Input Checkout Shipping Address'), [('UseDefaultAddress') : UseDefaultAddress

        , ('EmailAddress') : EmailAddress, ('CountryName') : Country, ('FirstName') : FirstName, ('LastName') : LastName

        , ('State') : State, ('City') : City, ('District') : District, ('Address1') : Address1, ('Address2') : Address2, ('ZipCode') : ZipCode

        , ('Phone1') : Phone1, ('TestSite') : Site], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase('Utility/Checkout/Checkout Shipping/Select Checkout Shipping Method'), [('ShippingMethodID') : ShippingMethodID

        , ('CitizenId') : CitizenID], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase('Utility/Checkout/Checkout Payment/Input checkout billing info and Click Submit'), [('PayBy') : PayBy

        , ('CardNumber') : CardNumber, ('Month') : Month, ('Year') : Year, ('CVV') : CVV, ('SameAsShipping') : SameAsShipping, ('Site') : Site, ('Country') : BD_Country

        , ('FirstName') : BD_FirstName, ('LastName') : BD_LastName, ('State') : BD_State, ('City') : BD_City, ('District') : BD_District

        , ('Address1') : BD_Address1, ('Address2') : BD_Address2, ('ZipCode') : BD_Zip, ('Phone1') : BD_Phone1],

    FailureHandling.STOP_ON_FAILURE)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章