Вот строгий скрипт, который делает утверждение, которое вы ищете.
//String sample to test both negative and positive tests
//This string should fail the test
def string1 = 'two three thousand four hundred fifty five'
//this string should pass validation
def string2 = 'two three thousand'
//Expected space count
def expectedSpaces = 2
//Check for number of occurances of spaces in the given string
def group1 = (string1 =~ /\s/)
def group2 = (string2 =~ /\s/)
println "${string2} has ${group2.size()} spaces"
println "${string1} has ${group1.size()} spaces"
//Positive assertion
assert expectedSpaces == group2.size(), "${string2} failed assertion"
//You may find this failing as expected, so negative assertion
assert expectedSpaces != group1.size(), "${string1} failed assertion"
Вы можете быстро проверить это script.
Какое утверждение вы пытаетесь применить? Является ли 'Script Assertion' или' Xpath'? – Rao
Вы можете взглянуть на этот ответ и принять подходящий для вас. – Rao
Xpath in Содержит –