What's the maximum concurrent number of test plan execution?

Can we execute multiple TestPlans at the same time? If yes, how many test plans can be executed simultaneously?Thanks.

1 Like

You can execute as many as you’d like. But depending on how you want to share resources there are a few strategies you can use.

The simplest is by using the Test Plan Reference step. This technically integrates your sub-plans into the parent plan.

If you want separate test plan runs, you can run the plans in separate “Sessions”.


            // create new resources and everything else by overlaying component settings.
            using (Session.Create(SessionOptions.OverlayComponentSettings))
            {
                // Recommended: Deserialize the test plan inside the new session.
                TestPlan plan = TestPlan.Load(xmlStream);

                var subRun = plan.Execute();
             }

Additionally, you can redirect the log messages if you want to separate those out.

This PR implements test plan isolation as a test step, maybe you can use that for inspiration: 946 Run Isolated Test Plans: Fix by rmadsen-ks · Pull Request #948 · opentap/opentap · GitHub

1 Like

I find ExecuteAsync() Function in TestPlan Class, does it work?

In other words, can I use ExecuteAsync() Function to do my test plans at the same time?

1 Like

I recommend using ExecuteAsync. This ensures that it has its own thread context, which can be aborted separately from everything else. Otherwise you might by accident abort your main thread when aborting the test plan thread and this would cause an issue if you want to run a test plan again later.

However, you should not try to execute the same test plan instance multiple times asynchronously. It has internal state that prevents this from working. Instead you can clone the test plan by serializing and deserializing it and then run those asynchronously.

Additionally, when running multiple test plans in parallel, I recommend using separate sessions is that your resources (DUTs, Instruments…) also have internal state, so unless you are very careful, this could also give you issues.

For simplicity and safety you could also consider running the test plan in separate processes, but that is a lot more complicated to develop and slower to execute.

1 Like