当用户单击列标题对列表进行排序时,我希望检查“排序”功能。
我计划分步骤进行:
*** Settings ***
Library Browser
Library String
Library Collections
Resource ../Resources/BrowserFunctions.robot
Suite Setup Start New Browser
Suite Teardown Close Browser
*** Test Cases ***
001-Models
Open New Page To Server
Navigate To Models Module
${elements} = Get Elements table tr td:nth-child(2)
${modelList}= Create List
FOR ${elem} IN @{elements}
${text}= Get Text ${elem}
${new elem}= Set Variable ${text}
Append To List ${modelList} ${new elem}
END
Log To Console ${modelList}
}然后通过
发布于 2022-04-29 18:05:41
*** Test Cases ***
Test_Sort_And_Compare_Asc
[Tags] compareAsc
${expected} Create List z x y
${Actual} Create List x y z
Sort List ${expected}
# Sort List ${Actual}
Lists Should Be Equal ${expected} ${Actual}
Test_Sort_And_Compare_Desc
[Tags] compareDesc
${expected} Create List x y z
${Actual} Create List z y x
Reverse List ${expected}
Lists Should Be Equal ${expected} ${Actual}
Test_Compare
[Tags] compare
${expected} Create List z x y
${Actual} Create List x y z
Lists Should Be Equal ${expected} ${Actual} 您可以使用适合您的第三种情况,因为您已经在预期变量中对列表进行了排序,在实际变量中对实际列表进行了排序。因为您正在从预期变量中的应用程序中获取排序列表。
https://stackoverflow.com/questions/72053107
复制相似问题