Forum Discussion

Behdad's avatar
Behdad
Contributor
4 years ago

ReadyApi JSONPath match assertion with Wildcard

Hi 

I am using ReadyAPI 3.6.0 and a bit new on it πŸ™‚

In some test steps, i like to use wild card in Jsonpath Match Assertion for content , but i don't know How to define wildcard ?  Let me share a simple example:

I have some REST endpoints with Json format to test, so in Teststep , I expect some response error messages start with "BAD_REQUEST::VALUE_FORMAT" followed by the name of the key 

in this case i think i have two option :

1- Use wild card like this "BAD_REQUEST::VALUE_FORMAT * " and it means that all similar messages end with * (key name) would be PASS/accepted

2- Define OR with various messages that i expect to see like 

BAD_REQUEST::VALUE_FORMAT-Key1 OR BAD_REQUEST::VALUE_FORMAT-Key2 ......

 

Actually i cant manage to define none of them ... in this case would you please help me on it ?

 

 

 

  • Hey Behdad

    Json match content assertions support using wildcards and there is a 'allow wildcards' checkbox on the assertion form to enable them.

    So "BAD_REQUEST::VALUE_FORMAT *" should work fine as long as you enable the wildcards function.

    Im guessing you wouldve noticed thr checkbox so can you provide screenshots of your assertion form so we can see what youre doing and what error youre getting?

    Cheers

    Rich
  • richie's avatar
    richie
    Community Hero
    Hey Behdad

    Json match content assertions support using wildcards and there is a 'allow wildcards' checkbox on the assertion form to enable them.

    So "BAD_REQUEST::VALUE_FORMAT *" should work fine as long as you enable the wildcards function.

    Im guessing you wouldve noticed thr checkbox so can you provide screenshots of your assertion form so we can see what youre doing and what error youre getting?

    Cheers

    Rich
    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Hi Behdad ! Please let us know if Richie's reply was helpful!

  • nmrao's avatar
    nmrao
    Champion Level 3
    Screen shot please?

    May be wanted to try simple contains assertion rather than JsonPath Match.