cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP UI responses -How to check the format of a node value

Highlighted
Contributor

SOAP UI responses -How to check the format of a node value

Hi All,

 

I have two SOAP UI responses .I need to compare Only the node value format and print the mismatches for the smaethe smae.

 

1.Check if the nodes (tag names) are same if not same then print it.

 

2.Check if the node values are of the same format or not .I do not want to compare with the actual node values

4 REPLIES 4
Highlighted
Contributor

Re: SOAP UI responses -How to check the format of a node value

can you give an example of the response you are wanting to compare? What formats are you comparing?

Highlighted
Contributor

Re: SOAP UI responses -How to check the format of a node value

Hi team can someone assist.
Highlighted
Contributor

Re: SOAP UI responses -How to check the format of a node value

hi,

 

Please find attached the samples.

 

Highlighted
Contributor

Re: SOAP UI responses -How to check the format of a node value

// Iterate through your nodes grabbing the value of each tag you are needing to validate and check for the acceptable patterns. Assert pass or failure accordingly

a = "alDMMKG-JJG'Haja" // passes for all acceptable patterns
b = "sliuugie3jksl" // fails for a number in the string
c = "-ksaieJKLU" // fails for begining with a special character

// this will look for all of the acceptable characters are present and if something else appears then you can assert a failure
if (a ==~ /^[a-zA-Z-']+$/) { 
    log.info "pass"
}else{
    log.info "fail"
}

// this will look at the first digit for non alpha characters and will fail if anything other than an alpha character appears at the beginning of the string
if ( a.take(1) ==~ /^[a-zA-Z]+$/) { 
    log.info "pass"
}else{
    log.info "fail"
}
New Here?
Join us and watch the welcome video:
Top Kudoed Authors