Method to Skip Data / Force Failure

As far as I understand, when I create and run a TestCase script with parameters, it runs using the default value as set under the ‘Parameter’ tab once. However, if you were to include a excel data source file, it runs as many as the amount of row data in the excel file, replacing the parameters as needed be.

What I want to know: is there any way to include a parameter in the source file that, if meets the condition, will skip that particular row of data and continue on to the next row?

Alternatively, if the parameter meets the condition, to force-induce a failure, so that I can use the Continue Test option in the step’s Advance Settings to do the same.

#|Data Name|To Skip
2|DEF|Y - this will be skipped
3|GHI|Y - this will be skipped

So, in the end, only data 1,4 and 5 will run through the entire test script; 2, 3 are basically ignored and skipped.

Hi @erik.yeow ,

Let me first clarify about the data source file itself, it is a CSV file and not an excel file.

So actually, you have a couple of solutions for that scenario:

  1. First, you can follow the steps in this article that will show you how to execute a flow based in the data source:
    Execute a flow based on Datasource - Data Driven testing | TestProject Help Center

  2. The second option is to create a project parameter that will store one row of data at a time, and it will be inside a test that will act as a subtest in the main test it will look something like this:

  • The first step in the subtest you will add the “read CSV row” action, this action will store the specific row you want in the project parameter.

  • In the same step you will add the conditions that you want, it can be if the row in the project parameter equals the same value it will pass if not it will skip (again it depends on what you are trying to achieve).

  • Then you will have to add a new step manually and create a loop, this loop will store a new row every time until it will get to a certain number you set.
    You can find more information about loops in this article:
    Dynamic loop | TestProject Help Center

If you still need help understanding the idea, there is a simple way to create loops:

In this example I will iterate a loop of type in +1 each in the google search box:

  • Create a test that adds 1 to an input value.

  • Do the action you wanted to do on the list then using the parameter you have increased before.

  • Add the increased value to a test parameter output value.

  • Make sure you defined your input and output parameters of the inner test

  • Create a different test that calls the test that uses the one you made before that increases the number and performs the list action.
    Create a test parameter in it that will be your starting value, I have set it to 1 in this example, then call that test using that value as both the input and output parameter.
    This should iterate the list and perform the action multiple times, I have set this test to repeat 10 times:

Let me know if it helped you, and if you have further questions please feel free :slight_smile:

Looks abit complex, but let’s see if I got this straight: basically, I’m putting my sub case inside another sub case and using the if-else condition the the higher subcase to check?

SubCase A - upper subcase
SubCase B - actual execution

SubCase A checks condition and calls SubCase B.
Which means, instead of using Subcase B, Im using SubCase A for inside my job and the data source used for A is exactly the same as B with the addition of the one additional variable that Im asking for.

Definitely sounds complex and maintenance and debugging feels like it’s gonna be a pain.

I have not study your 2nd suggestion yet as of this post.

This topic was automatically closed after 180 days. New replies are no longer allowed.