Forum Discussion

rupam_rajvanshi's avatar
rupam_rajvanshi
New Contributor
4 years ago

How to get pass/fail status of groovy scripting in excel sheet

Hello Everyone, I am taking data from excel sheet for that I am using data source. I have written groovy script for asserting response. I want get status of groovy scripts status as pass or fail and...
  • ChrisAdams's avatar
    ChrisAdams
    4 years ago

    Hi,

     

    I use one Groovy script per condition to test.  In my own main test suite, I have approx. 20 groovy scripts.

     

    I suppose you could return an array from your groovy script where each element is a condition test and then update your datasink step to reference the element of interest.  Not tried, but I imagine it's possible.  You could also return a JSON object from the Groovy script. E.g.

    [
        {
            "surname": "Scholes",
            "forename": "Paul",
            "surnameCheckResult": "PASS",
            "forenameCheckResult": "FAIL"
        }
    ]

    And then reference the values in the Datasink...  E.g.

    ${MyCheck#result.someConditionName}

    Again, not sure if this would work.