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.

Setup tests - Run before Standard tests

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Setup test: doesn't seem to be working for multiple iterations
Hi,
In my tests, I have one scenario containing 5 different test cases. In the scenario, I tried to setup test as methods and output of those methods, I need to use as request parameter for those 5 different testcases execution.

- I have a comprehensive datasource which is the main source of inputs parameters for all my tests. I set it up according to my testing needs
- Methods in setup tests are reading values from this datasource (currently, its datatable but I will be using Excel spreadsheet).
- In Method 1, I am reading a few values from datatable and setting up my final request parameters. Same for Method 2 and Method 3. I need to use these methods to create my final request parameters so that I don't need to make complex changes in my base input source and can keep it simple to read / configure.
- Out put of those methods are used as parameters in request.

Issue: when I run test for 1 iteration, it works fine but when I run multiple iterations, only last value is being sent in request param. I was expecting that after 1st iteration, setup test should take next set of values from datatable and then send it as parameter for iteration 2 and so on. However, this is not happening.. May be I am doing something wrong but can you suggest ?

Thanks,
Ash
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Set-Up tests are run before any other standard tests. This means it will iterate over your data table data source rows completely before it moves into the standard test. Move your Method tests into the same test suite as your other test cases as a standard test and not a Set-Up test and it should iterate over the test as you have expected.

    Hi,
    In my tests, I have one scenario containing 5 different test cases. In the scenario, I tried to setup test as methods and output of those methods, I need to use as request parameter for those 5 different testcases execution.

    - I have a comprehensive datasource which is the main source of inputs parameters for all my tests. I set it up according to my testing needs
    - Methods in setup tests are reading values from this datasource (currently, its datatable but I will be using Excel spreadsheet).
    - In Method 1, I am reading a few values from datatable and setting up my final request parameters. Same for Method 2 and Method 3. I need to use these methods to create my final request parameters so that I don't need to make complex changes in my base input source and can keep it simple to read / configure.
    - Out put of those methods are used as parameters in request.

    Issue: when I run test for 1 iteration, it works fine but when I run multiple iterations, only last value is being sent in request param. I was expecting that after 1st iteration, setup test should take next set of values from datatable and then send it as parameter for iteration 2 and so on. However, this is not happening.. May be I am doing something wrong but can you suggest ?

    Thanks,
    Ash

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Yeah. I had it that way and it works perfectly. The reason why I wanted to put my methods in setup tests is I needed to use outputs in my all test cases for that scenario and to eliminate need of adding 3 methods to each individual test case. Yes. I wanted setup test to run before those standard tests but if it iterates over the data table before moving on to standard tests, that doesn't serve purpose of having 'setup test' in my scenario. I feel, it should work like.

    datasource value 1-->Setup tests-->standard tests
    datasource value 2-->Setup tests-->standard tests

    But anyway, thanks for your response.

    Set-Up tests are run before any other standard tests. This means it will iterate over your data table data source rows completely before it moves into the standard test. Move your Method tests into the same test suite as your other test cases as a standard test and not a Set-Up test and it should iterate over the test as you have expected.

    Hi,
    In my tests, I have one scenario containing 5 different test cases. In the scenario, I tried to setup test as methods and output of those methods, I need to use as request parameter for those 5 different testcases execution.

    - I have a comprehensive datasource which is the main source of inputs parameters for all my tests. I set it up according to my testing needs
    - Methods in setup tests are reading values from this datasource (currently, its datatable but I will be using Excel spreadsheet).
    - In Method 1, I am reading a few values from datatable and setting up my final request parameters. Same for Method 2 and Method 3. I need to use these methods to create my final request parameters so that I don't need to make complex changes in my base input source and can keep it simple to read / configure.
    - Out put of those methods are used as parameters in request.

    Issue: when I run test for 1 iteration, it works fine but when I run multiple iterations, only last value is being sent in request param. I was expecting that after 1st iteration, setup test should take next set of values from datatable and then send it as parameter for iteration 2 and so on. However, this is not happening.. May be I am doing something wrong but can you suggest ?

    Thanks,
    Ash

Tagged