def errorMessage ='客户端版本无效。客户端版本不能包含以下任何字符:\“&'(),/ :; <> \'
def ExpectedMessage ='客户端版本无效。客户端版本不能包含以下任何字符:\“&'(),/ :; <> \'
然后匹配errorMessage包含ExpectedMessage。
由于我的错误消息和预期的消息中包含特殊字符,因此断言失败
答案 0 :(得分:2)
您可以转义一些特殊字符,例如单引号和双引号
# Client version is invalid. The client version cannot contain any of the following characters: \"&'(),/:;<>
* def errorMessage = 'Client version is invalid. The client version cannot contain any of the following characters: \\"&\'(),/:;<>'
* def expectedMessage = 'Client version is invalid. The client version cannot contain any of the following characters: \\"&\'(),/:;<>'
* match errorMessage == expectedMessage