Ask a Question

An Assertion To Verify Repeating Attribute Contains All Upper Case Chars?

SOLVED
richie
Community Hero

An Assertion To Verify Repeating Attribute Contains All Upper Case Chars?

Hey!

 

@nmrao  and @New2API have repeatedly helped me with some scripts to check repeating attributes in my .json response has certain attributes.

 

I now have tests that require me to verify a repeating attribute in the response contains only upper case characters.

 

The following is a script to verify that the repeating 'Name' attribute (repeated 1000s of times) in my .json response is always null 

//All Rao's work
assert context.response, 'Request parameter is correct'
def json = new groovy.json.JsonSlurper().parseText(context.response)
assert json.data.Name.every{null == it}
//assert json.data.Name.every{context.expand('${REST Request#Name}').toInteger() == it}

I was wondering if the above could be altered to assert that an attribute in the attached .json response (DataSourceId_Name) is all UPPER CASE ONLY?

 

I tried googling for groovy methods relating to upper case - but I didn't find anything that I could tailor to what I need - I found the following link but I don't know how to alter the above assertion to get what I need

 

Cheers lads/ladies,

 

richie

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
11 REPLIES 11
nmrao
Community Hero

Solved? or Taking time to test?


Regards,
Rao.
richie
Community Hero

Perfect.....sorry....was working to early hours, so didnt mark the ticket as complete.

Done!

And thank you!
richie
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: