Forum Discussion

goutamm's avatar
goutamm
New Contributor
2 years ago

Different Assertion output for a loop testcase

Hello,

I am new to Readyapi, I have test requirement for huge api testing, possibly 1000s of testcases. I have  a scenario where I need to test a Post request with 10 for valid and invalid outputs. I understand I can add 'data source' and 'data loop' the run the request 10 times with different payload. 

For testcase 1: with all valid inputs..record will be created..and result will be 'Pass' with any insertion

for testcase 2: with invalid input.. record will not be created as api will return error (expected behaviour) .. so I expect result to be Passed

 

So can my question is can I handle above 2 cases with one request and data loop with different assertions? or do i need to create multiple request for each assertion of valid and invalid inputs?

 

 

 

  • goutamm,

    specifying and organizing test cases is part of the testing art, so there is no simple answer.  

     

    I would ask myself at least:

    • Which way is more understandable for test structure, running tests and checking results?
    • Will I need to run the positive and negative test case separately, or rather as a single test case?
    • Is it easier to put it all into a single test case or does it complicate the stuff?

     

    From what you write, I would choose to create two test cases, one for positive and second for negative. Each of them would have a data source/loop, request and appropriate assertions. I would probably need only one simple set of assertions in each test case.

     

  • KarelHusa's avatar
    KarelHusa
    Champion Level 1

    goutamm,

    specifying and organizing test cases is part of the testing art, so there is no simple answer.  

     

    I would ask myself at least:

    • Which way is more understandable for test structure, running tests and checking results?
    • Will I need to run the positive and negative test case separately, or rather as a single test case?
    • Is it easier to put it all into a single test case or does it complicate the stuff?

     

    From what you write, I would choose to create two test cases, one for positive and second for negative. Each of them would have a data source/loop, request and appropriate assertions. I would probably need only one simple set of assertions in each test case.