Forum Discussion

_Oliver_'s avatar
_Oliver_
Contributor
3 years ago

Modify the default condition for smart assertion

Hi all,

 

When I use the smart assersion feature of readyAPi to validate a json response ("Received Data"), I have a mix of conditions that are either "Equals" either "Exists". 

I'd like to find away to set the many lines conditions to the same value easily. Currently, I am going through the response line by line, which is obviously very time consuming when the response contains parameters.

Is there a way to change several conditions at the same time in a few mouse clicks?

 

Please let me know if my question is not clear 🙂

 

Thanks

 

  • Hey _Oliver_,

    Ive had a look....only ever used the early version of this assertion once about 4 years ago and its changed quite a bit!

    Anyway, i believe the answer is "no".

    In some ways the SmartAssertion will save time as you dont have to generate individual assertions.....its all there for you, so if you have a huge payload you want to assert on every single attribute, then this will save time (although is quite tedious i admit)

    HOWEVER! I actually think SmartBear are making a mistake with this assertion as they intend to deprecate the individual assertions and move them into the SmartAssertion wrapper. The SmartAssertion does save time, but ONLY if you want to assert on EVERY SINGLE field in the payload.

    But think about it....how often do you actually assert on EVERY single field in the response? More often than not (excepting when the payload is brand new), you only want to assert on specific attribute changes. So youll have to disable all the assertions excepting the ones you care about. Its analagous to the situation where people say have a 500 testcase project and add in an status code assertion on every executable test step, rather than adding specific AND RELEVANT content match assertions instead!🤷‍♂️

    Sorry. Bit of a soap box moment for me there. I just dont think Smartbear have really thought about how we really should be using the tool to enable rigorous, but focused assertion coverage rather than minimally useful exhaustive coverage!

    Sorry i cant be of more help!

    Cheers

    Rich
  • richie's avatar
    richie
    Community Hero
    Hey _Oliver_,

    Ive had a look....only ever used the early version of this assertion once about 4 years ago and its changed quite a bit!

    Anyway, i believe the answer is "no".

    In some ways the SmartAssertion will save time as you dont have to generate individual assertions.....its all there for you, so if you have a huge payload you want to assert on every single attribute, then this will save time (although is quite tedious i admit)

    HOWEVER! I actually think SmartBear are making a mistake with this assertion as they intend to deprecate the individual assertions and move them into the SmartAssertion wrapper. The SmartAssertion does save time, but ONLY if you want to assert on EVERY SINGLE field in the payload.

    But think about it....how often do you actually assert on EVERY single field in the response? More often than not (excepting when the payload is brand new), you only want to assert on specific attribute changes. So youll have to disable all the assertions excepting the ones you care about. Its analagous to the situation where people say have a 500 testcase project and add in an status code assertion on every executable test step, rather than adding specific AND RELEVANT content match assertions instead!🤷‍♂️

    Sorry. Bit of a soap box moment for me there. I just dont think Smartbear have really thought about how we really should be using the tool to enable rigorous, but focused assertion coverage rather than minimally useful exhaustive coverage!

    Sorry i cant be of more help!

    Cheers

    Rich
    • _Oliver_'s avatar
      _Oliver_
      Contributor

      Thanks richie 

      That's definitely not the answer I was hoping !

       

      Anyways, thanks for taking the time to read and answer my question, I appreciate your help (as always !).