Ask a Question

How to set the color of a groovy script test step?

erickyi
New Contributor

How to set the color of a groovy script test step?

For any other test step (soap request, rest request), once the test step is completed, the icon color goes to green (assuming that the assertion is met).

how do I set the color of a successful groovy script test step? Right now, I can't differentiate between a successful and a step that is not run. Is there anything I need to do? 

Looking at the other types of test step, there is an assertion setup but this configuration is missing in groovy test step. Is this feature available?

3 REPLIES 3
nmrao
Community Hero

Re: How to set the color of a groovy script test step?

There are no separate assertion steps available for groovy script test step and that is by design.

It is because, you can do the assertions in groovy script by using "assert" statement.

For example:
def val = 10
assert 9 == val, "Val is not 9"

Just have a groovy script with above two statements and you would see it failed, which is shown in red colored.

So far you might not have experienced this because, no assertions are present in the script.

Hope this helps.


Regards,
Rao.
erickyi
New Contributor

Re: How to set the color of a groovy script test step?

tnx Rao

 

I have done code assertion on failure but that itself only show failure (red icon). It does not solve my visual inspection that the test step is run (I need some form of visual indication e.g. if the icon color changes). 

 

erickyi
New Contributor

Re: How to set the color of a groovy script test step?

I searched a bit more .. looks like there was an internal change request on something similar but there does not seemed to be any progress on the change request.
[Reg] icon color of "run testCase" based on execution status

 

I tried further using a custom property "myStatus"in the testStep

testRunner.testCase.setPropertyValue("status", "testCase-done"); // setting a custom property of a test case works
def testStep = testRunner.testCase.testSteps["Step1"]
testStep.setPropertyValue("myStatus", "NONE"); // no error 
log.info("|start status=" + testStep.getPropertyValue("myStatus"));
testStep.setPropertyValue("myStatus", "FINISHED"); // no error
log.info("|finish status=" + testStep.getPropertyValue("myStatus"));

The logs showed
Sat Jun 25 10:19:29 EST 2016:INFO:step1
Sat Jun 25 10:19:29 EST 2016:INFO:testrunnner.status=RUNNING
Sat Jun 25 10:19:29 EST 2016:INFO:|start status=null
Sat Jun 25 10:19:29 EST 2016:INFO:|finish status=null

Conclusion: the properties on a test step is read only. Bummer. there goes my attempt.  😞

cancel
Showing results for 
Search instead for 
Did you mean: