Forum Discussion

Sachin_Sawe's avatar
Sachin_Sawe
Contributor
18 years ago

Can a Test Coverage reflect elements covered by groovy script?

Ole,

soapUI has neat indications in green and red bars that show how much of your result xmls are test covered. This, however, works only if you use standard Assertions for a given soap request. It does not understand what all elements are covered by my groovy script. Is there a way that test coverage can understand those? Let me give an example to explain the problem:

Say I have a list of items coming back in my result. each item has certain properties and further children which are also of the nature of some sort of list. Now I need to verify certain referential integrity of these items  and its children with respect to each other. In order to do this I need to iterate through these items. soapUI does not have functionality to iterate through stuff and have asserts. For example, in soapUI I can assert if item[1] value is something or item[1] attribute is something that I expect. but I cannot assert the same for a list of items or so. To achieve this I land up writing a groovy script that can do all this programmatically. However the soapUI test coverage does not understand how many elements of resulting xml I have covered. Instead it only picks the elements that I covered by standard assertion steps I created using soapUI GUI.

Please let me know if there is anyway to either have test coverage understand my assertions and reflect those in green bars OR
If I can assert things for a SET or COLLECTION of ITEMS in result via soapUI GUI so that test coverage green bar do cover these

Thanks,
Sachin

11 Replies

  • mkp's avatar
    mkp
    Occasional Contributor
    This thread is really a useful one for all who are interested in soapUI. I have learned many facts about soapUI form this forum. After reading this thread I have thought whether a Test Coverage reflect element can be covered by groovy script for hours. But I haven’t got any right solution. Then I tried doing it as omatzura told and I successfully covered Test Coverage reflect element by groovy script. Thank you so much for providing this great solution for the problem and I will definitely share this thread with my friends too.