Forum Discussion
The issue is in order to confirm the values it needs to read all the XML. I wouldn't think this is an unusual request.
I'm not a novice but I'm not an expert either. Below is my assertion, can you see a better way to do this assert?
declare namespace ns1='http://xxx.org/';
declare namespace a='http://xxxxx.V3.ServiceTypes';
(count(//a:Coverages[1]/a:Coverage/a:Form/a:Name[text() = "${#TestSuite#FormName13}"]) = count(//a:Coverages[1]/a:Coverage/a:Form/a:Name))
and
(count(//a:Coverages[1]/a:Coverage/a:Form/a:Name)>0)
The first part: Counts the possible form names, every coverage MUST have a form name. So if there is only one kind of form name then every coverage should be accounted for. Sometimes there is more than one and I take that into account.
The second part: confirms there are coverages, otherwise it should fail.
Would it be better to split these up into separate assertions? I'm not convinced this wouldn't be a problem still.
Thanks for any advice!
So if I understand your assertion correctly, and if I understand xpath in general, here's what you are saying:
(Find the count of every Name object whose text is equal to ${#TestSuite#FormName13}) and compare that to (Find the Count of how many Coverages[1]/Coverage/Form/Name objects there are)
Here, you are finding the count of all the objects twice. I am going to make some assumptions here to generalize the problem. For 10000 lines, assuming 1 object per line, that's parsing 20000 lines twice. Assume each 10 lines takes 1 second. That's 10000 lines for 100 seconds, twice, so 200 seconds. Again, just generic numbers and assumptions, but it should show the case that you are counting all 10000 lines/objects twice.
An easier way may be to write a groovy script assertion. When I typically need to tackle a problem like this, I do so with groovy. Groovy scripts can be very powerful, but require some knowledge of scripting/programming languages. I could assist if that is something you want to work with.
Related Content
- 2 years agojerry91
- 10 months agoKimdoengart
- 6 years agorizzomeister
Recent Discussions
- 16 hours agoKay