Как реализовать условие If на основе основанного на результате ключевого слова в каркасе робота? - PullRequest
0 голосов
/ 26 октября 2018

В моем тестовом примере ниже, если ключевое слово Сравнить системное время, полученное в момент создания, со временем, записанным в макете , должно выполнить второе ключевое слово Добавить время к системному времени и сравнить со временем, записанным в макете Должно перейти на третье ключевое слово Вычесть время из системного времени и сравнить его со временем, записанным в макете , если второе ключевое слово также дает сбой. Пожалуйста, помогите мне сконструировать его как условный оператор в . Убедитесь, что последняя последняя измененная / созданная оценка превысила список

*** Settings ***
Resource  ../settings.robot

*** Variables ***
${modified_date_row_1}       css=#estimateTable > tbody > tr.item-name.highlighted > td:nth-child(4)

*** Test Cases ***
Last modified/created estimates should top the list of estimates displayed
  Verify that the last last modified/created estimate tops the list

*** Keywords ***
Compare system time retrieved at the time of creation with time recorded in the layout
  Sleep  5s
  ${get_modified_date_row_1}  Get Text  ${modified_date_row_1}
  ${compare}  Should Be Equal  ${get_modified_date_row_1}  ${date_time}

Add time to sys time and compare it with time recorded in the layout
  Sleep  5s
  ${get_modified_date_row_1}  Get Text  ${modified_date_row_1}
  ${add_time}  Add Time To Date  ${sys_date_time}  01:00
  ${converted_add_time}  Convert Date  ${add_time}  result_format=%b %d %Y %I:%M %p
  ${compare}  Should Be Equal  ${get_modified_date_row_1}  ${converted_add_time}

Subtract time from sys time and compare it with time recorded in the layout
  Sleep  5s
  ${get_modified_date_row_1}  Get Text  ${modified_date_row_1}
  ${subtract_time}  Subtract Time From Date  ${sys_date_time}  01:00
  ${converted_sub_time}  Convert Date  ${subtract_time}  result_format=%b %d %Y %I:%M %p
  ${compare}  Should Be Equal  ${get_modified_date_row_1}  ${converted_sub_time}

 Verify that the last last modified/created estimate tops the list
   Run Keyword If  Compare system time retrieved at the time of creation with time recorded in the layout == 'FAIL'  Add time to sys time and compare it with time recorded in the layout
   ...  ELSE IF  Add time to sys time and compare it with time recorded in the layout == 'FAIL'  Subtract time from sys time and compare it with time recorded in the layout

1 Ответ

0 голосов
/ 26 октября 2018

Получите статус ключевых слов и примените их в качестве условий для вашего 4-го ключевого слова, как в примере, указанном ниже:

Verify that the last last modified/created estimate tops the list       

${Status1}=    Run Keyword and Return Status    Compare system time retrieved at the time of creation with time recorded in the layout

${Status2}=    Run Keyword If    '${Status1}'=='Fail'    Run Keyword and Return Status    Add time to sys time and compare it with time recorded in the layout

Run Keyword If    '${Status1}'=='Fail'    And    '${Status2}'=='Fail'    Subtract time from sys time and compare it with time recorded in the layout
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...