Forum Discussion

gid_216's avatar
gid_216
Frequent Contributor
7 years ago

Log message to report

Can anyone help me understand, if there is a way, I can log a message to report when assertion passed.

 

Thanks

5 Replies

  • Add a groovy test step

     

    // -----------------------------------------------------------------------------------------------------------------------
    // Check the assertion status of test step 'TEST_STEP_NAME'
    // -----------------------------------------------------------------------------------------------------------------------

    def assert_status1 = testRunner.testCase.getTestStepByName("TEST_STEP_NAME").getTestRequest().getAssertionStatus().toString()

    log.info " Assert status for 'TEST_STEP_NAME' = $assert_status1"

  • nmrao's avatar
    nmrao
    Champion Level 3

    Here you go:

     

    def isTestPass = false

    assert isTestPass, "The value of isTestPass variable is ${isTestPass}"

     

    EDIT:

     

    I was under impression that how to log the failure message to Test Report. Hence the above example is show.

     

    After posting the above example, it is realized that you want the way.

     

    My question to is this - why do you need a reason saying assertion passed in the passed test? The entire test is passed already i.e., assertions are passed, why would some be interested in their time here? Instead focus time on failures.

     

    If you do not mind, may I ask you what is your use case. Facing this kind of topic for the very first time from ever since I participate in the forum.

    • gid_216's avatar
      gid_216
      Frequent Contributor

      My test generates an id for few activities and those id's will be part of response. We randomly pick some of these ids from passed test case and use those for manual test flow (as the process of generating id, is lengthy and consumes more time while doing manually from UI) and it is difficult to track which id is related to a passed testcase.

      • gpavanptesting's avatar
        gpavanptesting
        New Contributor

        Hi gid_216 nmrao I'm also in need of solution. Please can you help? I have searched a lot but didn't find an solution. Thanks in advance!!