Forum Discussion

gid_216's avatar
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.



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() " Assert status for 'TEST_STEP_NAME' = $assert_status1"

  • nmrao's avatar
    Champion Level 3

    Here you go:


    def isTestPass = false

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




    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
      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
        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!!