最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

karate - Can I pass variable values from another file in the step response.validation contains? - Stack Overflow

programmeradmin0浏览0评论

In match response.validation contains, is it possible to check the value that changes depending on the environment? I have data.json file with values for fields which change depends on env.

I have request with json:

And request

    """
    {
        "product": {
            "name": '#(data.name)'
        }
    }
    """

and step:

Then match response.validation contains

    """
    {
        "product": {
            "name": '#(data.name)'
        }
    }
    """

This

data.name

value will change depending on the environment, at the moment such a test does not pass because in response from API I have string in

"""
{
    "product": {
        "name": 'test data'
    }
}
"""

and the comparison is to '#(data.name)' should be to 'test data'

In match response.validation contains, is it possible to check the value that changes depending on the environment? I have data.json file with values for fields which change depends on env.

I have request with json:

And request

    """
    {
        "product": {
            "name": '#(data.name)'
        }
    }
    """

and step:

Then match response.validation contains

    """
    {
        "product": {
            "name": '#(data.name)'
        }
    }
    """

This

data.name

value will change depending on the environment, at the moment such a test does not pass because in response from API I have string in

"""
{
    "product": {
        "name": 'test data'
    }
}
"""

and the comparison is to '#(data.name)' should be to 'test data'

Share Improve this question asked Mar 28 at 10:32 declutecdeclutec 435 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

My mistake, it's OK, the error was in another place....

It works fine to pass the value of a variable from another file.

发布评论

评论列表(0)

  1. 暂无评论