Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Using Data Sources

Options
Jimbo_SOA
Jimbo_SOA Posts: 2

I have one excel file as a Data Sources
I have two Test Steps added under 1 Scenario.

  1. Test number 1: I must pass the ID value (Valid) on the Payload - Happy Path

    • The ID Value that I need to pass on the Payload is mentioned on the 1st Row of the Data Sources (excel file) under ID Column
  2. Test number 2: I must pass the ID value (Invalid) on the Payload - Negative test

    • The ID Value that I need to pass on the Payload is mentioned on the 2nd Row of the Data Sources (excel file) under ID Column

Now since I have 2 different Values on each row under ID Column in Excel file (Data Sources)

  • Value in ROW 1 = ABC
  • Value in Row 2 = XYZ

Now, how do I configure to be able to use the value of only ROW 1 (not Row 2) in Test Step 1 and how do i use the Value of only ROW 2 (not Row 1) in test Step 2

I was able to do using groovy script, but is there a way we could do this without using the groovy script?

Suggestion and Instructions is appreciated!!

Answers

  • benken_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    Options

    Now, how do I configure to be able to use the value of only ROW 1 (not Row 2) in Test Step 1 and how do i use the Value of only ROW 2 (not Row 1) in test Step 2

    Data sources are used to make a test or a group of tests iterate together over rows, one row at a time. You do not assign specific rows to specific tests. However, I have some recommendations.

    If you have a positive test case and a negative test case then I would recommend setting up two separate data sources, one with the row data for the positive test case and a second with the row data for the negative test case. This way, your positive test case can iterate over the positive test data and your negative test case can independently iterate over the negative test data.

    As another option, you can also configure tests to be executed or skipped depending on the value of a test suite variable. In the test suite editor you would first define a test suite variable on the Variables tab. Next, under Execution Options > Test Flow Logic, you would select the test you sometimes want skipped and select that variable as a "variable condition" for the test. Lastly, you would need to add an Extension Tool to your test suite that would change the value of the test suite variable depending on the current row data, depending whether you wanted test 1 to be skipped for that row or not. However, this adds extra complexity.

    If you have data that is intended for separate test cases or separate groups of test cases then you should split up the data into separate data sources.

  • Jimbo_SOA
    Jimbo_SOA Posts: 2
    Options

    Thank you Benken. Looks like I am currently following the same as you recommended. Two data source (positive and negative). However in some cases, there are some values we need to extract into multiple tests within a Positive scenario in which i added a extension tool and configured around variable and flow logics and worked with it

    But it would have been great if the tool had the capability to select a specific rows to run a specific test like other tools does. ReadyAPI has that capability.

    I guess this is something on the future enhancement if Parasoft considers in implementing in the future.

    I really appreciate your feedback.