Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / libraries / FailFast.robot
1 *** Settings ***
2 Documentation     Robot keyword library (Resource) for implementing fail fast behavior in Robot suites.
3 ...
4 ...               Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...
11 ...               This Resource uses suite variable SuiteFastFail, beware of possible conflicts.
12 ...
13 ...               Recommended usage:
14 ...               In suite setup, call Do_Not_Fail_Fast_From_Now_On
15 ...               Set Fail_This_Fast_On_Previous_Error as Test Setup
16 ...               and Start_Failing_Fast_If_This_Failed as Test Teardown
17 ...               in the suite setting table.
18 ...               If you do not want the test teardown, use this in test case:
19 ...               [Teardown] Do_Not_Start_Failing_If_This_Failed
20 ...               If you do not want the test setup in a particular test, use this in the test case:
21 ...               [Setup] Run_Even_When_Failing_Fast
22 ...               If success of such "run even when failing" test case can return the system under test
23 ...               back to corret state, call at the end of such test case this:
24 ...               Do_Not_Fail_Fast_From_Now_On
25
26 *** Keywords ***
27 Do_Not_Fail_Fast_From_Now_On
28     [Documentation]    Set suite to not fail fast.
29     BuiltIn.Set_Suite_Variable    ${SuiteFastFail}    False
30
31 Fail_This_Fast_On_Previous_Error
32     [Documentation]    Mark (immediately) this test case as failed when fast-fail is enabled in suite.
33     BuiltIn.Run_Keyword_If    '''${SuiteFastFail}'''=='True'    BuiltIn.Fail    SKIPPED due to a failure in a previous fundamental test case.
34
35 Start_Failing_Fast_If_This_Failed
36     [Documentation]    Set suite fail fast behavior on, if current test case has failed.
37     BuiltIn.Run_Keyword_If_Test_Failed    BuiltIn.Set_Suite_Variable    ${SuiteFastFail}    True
38
39 Run_Even_When_Failing_Fast
40     [Documentation]    This is just a more readable 'None' to override [Setup].
41     BuiltIn.No_Operation
42
43 Do_Not_Start_Failing_If_This_Failed
44     [Documentation]    This is just a more readable 'None' to override [Teardown].
45     BuiltIn.No_Operation