|
| 1 | +*** Settings *** |
| 2 | +Documentation This suite covers a special case where an incomplete rollback inside a |
| 3 | +... scenario which is split up for refinement, could cause two scenarios |
| 4 | +... to be inserted for a single refinement. To get into that situation the |
| 5 | +... high-level scenario has two steps that require refinement. The first |
| 6 | +... one only checks that a certain name is inserted, it does not check the |
| 7 | +... number of names. The second one checks that the total number of names |
| 8 | +... is three. This should be an unreachable situation, because refinements |
| 9 | +... are always a single scenario and each of the scenarios only inserts a |
| 10 | +... single name. If the rollback of the middle part (2.2 in the trace) was |
| 11 | +... incomplete, i.e. its rollback did not include the refinement scenario |
| 12 | +... as well, then inserting the second low-level scenario would satisfy |
| 13 | +... the first exit conditions and inserting another low-level scenario for |
| 14 | +... the second refinement would satisfy exit conditions for both steps and |
| 15 | +... incorrectly complete the suite. |
| 16 | +Suite Setup Expect failing suite processing |
| 17 | +Resource ../../resources/birthday_cards_flat.resource |
| 18 | +Library robotmbt |
| 19 | + |
| 20 | + |
| 21 | +*** Test Cases *** |
| 22 | +Buying a card |
| 23 | + When someone buys a birthday card |
| 24 | + then there is a blank birthday card available |
| 25 | + |
| 26 | +high-level scenario |
| 27 | + Given there is a birthday card |
| 28 | + when The first person writes their name on the birthday card |
| 29 | + and Two more people write their name on the birthday card |
| 30 | + then the birthday card has 3 names written on it |
| 31 | + |
| 32 | +low-level scenario A |
| 33 | + Given there is a birthday card |
| 34 | + and we are in refinement |
| 35 | + when Someone writes their name on the birthday card |
| 36 | + then the birthday card has 'Someone' written on it |
| 37 | + |
| 38 | +low-level scenario B |
| 39 | + Given there is a birthday card |
| 40 | + and we are in refinement |
| 41 | + when Someone writes their name on the birthday card |
| 42 | + then the birthday card has 'Someone' written on it |
| 43 | + |
| 44 | +low-level scenario C |
| 45 | + Given there is a birthday card |
| 46 | + and we are in refinement |
| 47 | + when Someone writes their name on the birthday card |
| 48 | + then the birthday card has 'Someone' written on it |
| 49 | + |
| 50 | + |
| 51 | +*** Keywords *** |
| 52 | +The first person writes their name on the birthday card |
| 53 | + [Documentation] *model info* |
| 54 | + ... :IN: scenario.count = len(birthday_card.names) |
| 55 | + ... :OUT: Someone in birthday_card.names |
| 56 | + Skip when unreachable |
| 57 | + Should Contain ${names} Someone |
| 58 | + |
| 59 | +Two more people write their name on the birthday card |
| 60 | + [Documentation] *model info* |
| 61 | + ... :IN: scenario.count |
| 62 | + ... :OUT: len(birthday_card.names) == scenario.count+3 |
| 63 | + Skip when unreachable |
| 64 | + Length should be ${names} ${2} |
| 65 | + |
| 66 | +we are in refinement |
| 67 | + [Documentation] Helper to prevent lower-level scenarios from being valid |
| 68 | + ... at the top-level. (Better for performance) |
| 69 | + ... *model info* |
| 70 | + ... :IN: scenario.count |
| 71 | + ... :OUT: None |
| 72 | + No Operation |
| 73 | + |
| 74 | +Expect failing suite processing |
| 75 | + Run keyword and expect error Unable to compose* Treat this test suite Model-based |
| 76 | + Set suite variable ${expected_error_detected} ${True} |
| 77 | + |
| 78 | +Skip when unreachable |
| 79 | + [Documentation] |
| 80 | + ... If the scenario is inserted after proper detection of the expected error, |
| 81 | + ... then this keyword causes the remainder of the scenario to be skipped and |
| 82 | + ... the test passes. When inserted without detected error, the scenario will |
| 83 | + ... fail. |
| 84 | + IF ${expected_error_detected} |
| 85 | + Pass execution Accepting intentionally unreachable scenario |
| 86 | + END |
0 commit comments