# When using OpenTAP programmatically to run a test plan, how do I set the Bench profile?

**URL:** <https://forum.opentap.io/t/when-using-opentap-programmatically-to-run-a-test-plan-how-do-i-set-the-bench-profile/2484>\
**Category:** General\
**Created:** [June 13, 2025, 5:00pm UTC](https://forum.opentap.io/t/when-using-opentap-programmatically-to-run-a-test-plan-how-do-i-set-the-bench-profile/2484 "2025-06-13T17:00:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alan\_copeland](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@alan\_copeland](https://forum.opentap.io/u/alan_copeland)\
**Post date:** [June 13, 2025, 5:00pm UTC](https://forum.opentap.io/t/when-using-opentap-programmatically-to-run-a-test-plan-how-do-i-set-the-bench-profile/2484/1 "2025-06-13T17:00:37Z")

</div>

You can find an example of using the OpenTAP API to build and run a test plan in the SDK Examples here:

> **[opentap/sdk/Examples/TestPlanExecution/BuildTestPlan.Api at main ·...](https://github.com/opentap/opentap/tree/main/sdk/Examples/TestPlanExecution/BuildTestPlan.Api)**
>
> This is the code for the base OpenTAP package. See https://opentap.io. This includes the OpenTap.dll (base classes and sequencer), OpenTap.Package.dll (package manager), tap.exe (CLI) and OpenTap.P...

**Answer:** to load a bench profile called “Profile2” and print out the list of configured instruments, the following code works (_tested with OpenTAP 9.26.1_)

```csharp
OpenTap.PluginManager.SearchAsync();

// Set the Bench to Profile2
OpenTap.EngineSettings.SetSettingsProfile("Bench", "Profile2");

// Load the current instrument settings and print out a list of instruments that are configured in Profile2
var instrumentType = OpenTap.PluginManager.LocateType("OpenTap.InstrumentSettings");
OpenTap.InstrumentSettings instruments = OpenTap.EngineSettings.GetCurrent(instrumentType) as OpenTap.InstrumentSettings;

foreach (var instrument in instruments)
{
    Console.WriteLine($"Instrument: {instrument.Name}, Type: {instrument.GetType().Name}");
}

```
