Reading a CSV file with test parameter combinations?

Hi there, totally new to OpenTAP (but not testing :slight_smile: )

Our test setup has a number parameters we need to vary in our measurements (RF freq, Temp, Supply voltage, BW etc).

We can’t make a sweep of all combinations of all parameters, but we have selected the interesting combinations in a spreadsheet test plan.

We would like to have OpenTAP read a given test plan (in e.g. CSV format), and loop over all the lines in the testplan, setting the parameters for each test step, as specified in each line in the test plan (CSV file).

Can anyone direct me to how this is done most optimal in OpenTAP?



Welcome to the OpenTAP community! Glad you’re taking a look!

So I would posit two different approaches, and see what you think.

The main issue here is that CSV is not OpenTAP format, but rather OpenTAP test plans are XML and consist of a sequence of mostly custom user-created test steps and child test steps. So the first way I see is creating a program that runs outside of OpenTAP (but still uses the OpenTAP SDK) to convert the CSV file to an OpenTAP test plan. I’ll be clear - in either case I’m presenting, one or more custom test steps is needed, and it’s true here; the test plan would consist of some custom test steps that only contain sweep information. The exact implementation would depend on what your tests actually look like, but certainly the best approach is to create one or more very general test steps and have your sweeps fit into the test step parameters. Once the test plan is converted, use in OpenTAP as normal!

The second way I see, the less elegant (in my opinion) but faster (in terms of development) way to do this is to create one custom test step that reads in and processes the CSV file and runs all the sweeps in it, and your test plan would consist of this one step. I see several issues with this one right off, but the main theme is that you lose out on many OpenTAP features, with your entire test plan only being one massive step. It would be (temporarily) convenient, though, and maybe a good way to test how OpenTAP works with your test system, if you wanted to do so quickly.

Also, will note, for any approach you might need to create your own Instrument classes for interacting with your intstruments, but this is quite simple, especially if you already have C# or Python code.

I will say, neither of these approaches would be very difficult at all. You’re free to choose either or do something completely different!


Hello @michaelsideniusmti and Welcome to the opentap forum!

Like John mentioned there are plenty of ways to accomplish what you are asking. Depending on the complexity of your test system, the number of combinations on the input csv file, how many parameters to sweep, etc. there could be different approaches. My two suggestions are:

  1. Implement a “test converter” that can read your input csv file and convert it to a TAP sequence, this approach can give you a lot of flexibility but also requires more code to implement the converter.
  2. Use the Sweep Parameter test step from tap. I would suggest this to start with. The Sweep Parameter can sweep parameters from child steps, so here you would input your csv file. Looks like you already have a Test Plan, so some of the steps are setting the temperature, voltage etc.

Here is a quick example on how to use Sweep Parameter:

Add a Sweep Parameter test as the parent of your current test plan. My example test plan has 4 tests that are setting the parameters (Temp, Volt, Freq and BW) after this tests you can add your tests, or you can a reference to a test plan that you already have:

Notice the warning on the sweep, is because you have not defined any sweep parameter, so go to each one of the setting tests, in this case Temperature and right click on the temperature parameter, then select “Parametrize on Parent”:

Repeat for Voltage, RF Frequency and Bandwidth steps, notice the sweep test has now changed and it includes the parameters you want to sweep:

Now click on the Edit button and here you can define your combinations by clicking on the Add row (+) button:


Here you can define your combinations, you can also import a csv file from the File | Import Values menu.

I think the Sweep Parameter test will give you an easy way to test all the combinations.

Again, Welcome to opentap!


Hi @michaelsideniusmti

As @john.berlien and @carlos.montes point out there are a few ways to do this. I found it much easier to create my own parent loop steps that defined the parameters I wanted to loop through. This however depends on how much programming you want to do though.
I initially started by using the off-the-shelf steps but very quickly realised I needed more control and flexibility.
If the parameters are embedded in a ListOfObjects class then your test plan parameters are native to OpenTap and no longer need to exist in a spreadsheet. Even then it’s easy to copy-paste directly from Excel into the test step as data manipulation is always easier in Excel.

Once you get your head around ListOfObjects you can really start to get creative. Ignoring all the other stuff in the image below, you can see WLAN Test Modes is spreadsheet-like. The test plan is now stored in OpanTaps native XML format when the test plan is saved and an external third-party application or file is no longer needed (CSV, xlsx, etc…).
You should also note the ‘WLAN Test Modes’ window is opened by the Edit button to the right of the ‘WLAN Test Modes’ parameter in the Test Step Setting pane.

I suggest you take a look at the Examples.sln in the Developer’s System package. LisOfObjects.cs is the foundation for my own custom loop steps, and I use combinations of the examples to create some pretty powerful test steps.