Add ability to report exact bugs into the new bug reporting 80/35380/5
authorJozef Behran <jbehran@cisco.com>
Wed, 24 Feb 2016 15:52:34 +0000 (16:52 +0100)
committerJozef Behran <jbehran@cisco.com>
Thu, 25 Feb 2016 16:21:57 +0000 (17:21 +0100)
Use SetupUtils.Set_Known_Bug_Id with the bug ID before
checking for the bug and then use SetupUtils.Set_Unknown_Bug
when the checks for the concrete bug are over.

Change-Id: I954f801ff7351b16b9978e5e77652d9a2cce3562
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/libraries/SetupUtils.robot
csit/suites/netconf/MDSAL/northbound.robot

index 1f865a28c5f5ee5035395e2d1d2f5c077735830c..60d8c92f5253541ccd05a4935b406a7cc350cc93 100644 (file)
@@ -6,6 +6,9 @@ Resource          ${CURDIR}/FailFast.robot
 Resource          ${CURDIR}/KarafKeywords.robot
 Resource          ${CURDIR}/Utils.robot
 
+*** Variables ***
+${SetupUtils__Known_Bug_ID}    ${EMPTY}
+
 *** Keywords ***
 Setup_Utils_For_Setup_And_Teardown
     [Documentation]    Prepare both FailFast and karaf logging, to be used in suite setup.
@@ -25,11 +28,24 @@ Setup_Test_With_Logging_And_Without_Fast_Failing
     FailFast.Run_Even_When_Failing_Fast
     BuiltIn.Run Keyword And Ignore Error    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
 
+Set_Known_Bug_Id
+    [Arguments]    ${id}
+    [Documentation]    Tell the Teardown keywords that any failure from now on is due to the specified known bug.
+    Set_Suite_Variable    ${SetupUtils__Known_Bug_ID}    ${id}
+
+Set_Unknown_Bug_Id
+    [Documentation]    Tell the Teardown keywords that from now on there is no longer known bug causing the failure so it should use linked bugs.
+    Set_Known_Bug_Id    ${EMPTY}
+
+SetupUtils__Report_Bugs_Causing_Failure
+    BuiltIn.Run_Keyword_And_Return_If    '${SetupUtils__Known_Bug_ID}' != ''    Utils.Report_Failure_Due_To_Bug    ${SetupUtils__Known_Bug_ID}
+    Utils.Report_Failure_And_Point_To_Linked_Bugs
+
 Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
     [Documentation]    Test case teardown. Show linked bugs and start fast failing in case of failure.
     BuiltIn.Run_Keyword_If_Test_Failed    BuiltIn.Set_Suite_Variable    ${SuiteFastFail}    True
-    Utils.Report_Failure_And_Point_To_Linked_Bugs
+    SetupUtils__Report_Bugs_Causing_Failure
 
 Teardown_Test_Show_Bugs_If_Test_Failed
     [Documentation]    Test case teardown. Show linked bugs in case of failure.
-    Utils.Report_Failure_And_Point_To_Linked_Bugs
+    SetupUtils__Report_Bugs_Causing_Failure
index df30cb6ea2337855eed2b6e215c6707f703bc9c2..ad62d2b603dc5832904d5982897ebce9f805bdbc 100644 (file)
@@ -32,6 +32,7 @@ Documentation     Metconf MDSAL Northbound test suite.
 Suite Setup       Setup_Everything
 Suite Teardown    Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 Library           RequestsLibrary
 Library           SSHLibrary
 Resource          ${CURDIR}/../../../libraries/FailFast.robot
@@ -71,12 +72,11 @@ Additional_Attributes_In_Message
 Send_Stuff_In_Undefined_Namespace
     [Documentation]    Try to send something within an undefined namespace and check the reply complains about the nonexistent namespace and element.
     ${reply}=    Load_And_Send_Message    merge-nonexistent-namespace
-    BuiltIn.Set_Test_Variable    ${bugno}    5125
+    SetupUtils.Set_Known_Bug_Id    5125
     BuiltIn.Should_Not_Contain    ${reply}    java.lang.NullPointerException
-    BuiltIn.Set_Test_Variable    ${bugno}    ${EMPTY}
+    SetupUtils.Set_Unknown_Bug_Id
     BuiltIn.Should_Contain    ${reply}    urn:this:is:in:a:nonexistent:namespace
     BuiltIn.Should_Contain    ${reply}    <rpc-error>
-    [Teardown]    BuiltIn.Run_Keyword_If    '${bugno}' != '${EMPTY}'    Utils.Report_Failure_Due_To_Bug    5125
 
 Edit_Config_First_Batch_Merge
     [Documentation]    Request a "merge" operation adding an element in candidate configuration and check the reply.