Build own gui to run test plan, not workable with myTestPlan.execute(resultListeners)

I’m going to build a very simple user interface,click the “start” button to run a test plan automatically.

Then I copied code from “BuildTestPlan” example for run command. When the code goes to “myTestPlan.Execute(resultListeners);”, it will quit abnormally. But the code run successfully with no resultlistener like “myTestPlan.Execute()”.


The console application could be running without any issues. Could anyone tell me why the GUI couldn’t work? thanks

2 Likes

@hongbo.huo , did you inspect the SessoinLogs? They should contain additional details on why OpenTAP stops running.

Are you using the same Result Listener, when you’re running test plans using the CLI?

2 Likes

@witold.pietraszek Thanks for reply. It seems sessionlogs has a lot of information. But I couldn’t understand what was happening.

  1. The unsuccessful run generated a sessionlog named “console_log.txt”. It was not in “SessionLogs” folder
  2. The unsuccessful log is as below. I really have no idea what to do next.
    2021-03-20 10:47:56.389690 ; Session ; Debug ; Session log loaded as ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\SessionLogs\openTAPrun 2021-03-20 10-47-52.txt’. [15.0 ms]

2021-03-20 10:47:56.416620 ; Session ; Debug ; Running '“F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\openTAPrun.exe” ’ in ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug’.

2021-03-20 10:47:56.447419 ; Session ; Debug ; Microsoft Windows 10.0.19042 X64

2021-03-20 10:47:56.447419 ; Session ; Debug ; .NET Framework 4.8.4341.0

2021-03-20 10:47:56.463534 ; Session ; Debug ; Session log loaded as ‘console_log.txt’. [9.51 ms]

2021-03-20 10:47:56.464642 ; Session ; Debug ; Running '“F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\openTAPrun.exe” ’ in ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug’.

2021-03-20 10:47:56.521426 ; Resolver ; Debug ; Found 8/26 assembly files. [31.6 ms]

2021-03-20 10:47:56.532205 ; Session ; Debug ; OpenTAP Engine 9.12.3+81c8e2eb X86

2021-03-20 10:47:56.621512 ; Resolver ; Debug ; Found match for System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a in F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Dependencies\System.Reflection.Metadata.1.4.3.0\System.Reflection.Metadata.dll

2021-03-20 10:47:56.665933 ; Resolver ; Debug ; Found match for System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a in F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Dependencies\System.Collections.Immutable.1.2.3.0\System.Collections.Immutable.dll

2021-03-20 10:47:56.800393 ; Searcher ; Debug ; Ordered 7 assemblies according to references. [274 ms]

2021-03-20 10:47:56.854461 ; PluginManager ; Debug ; Found 4 plugin assemblies containing 147 plugin types. [328 ms]

2021-03-20 10:47:56.855463 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.dll

2021-03-20 10:47:56.855463 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.Package.dll

2021-03-20 10:47:56.855463 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.Plugins.BasicSteps.dll

2021-03-20 10:47:56.855463 ; PluginManager ; Debug ; Found version 0.0.0.0 of sdkrunCMD.exe

2021-03-20 10:47:56.855463 ; PluginManager ; Debug ; Searched 8 Assemblies. [329 ms]

2021-03-20 10:47:56.867914 ; PluginManager ; Debug ; Loaded OpenTap. [419 us]

2021-03-20 10:47:56.868912 ; PluginManager ; Debug ; Loaded OpenTap.Plugins.BasicSteps. [200 us]

2021-03-20 10:47:56.919809 ; PluginManager ; Debug ; Loaded mscorlib. [700 ns]

2021-03-20 10:47:56.981613 ; PluginManager ; Debug ; Loaded OpenTap.Package. [15.4 ms]

2021-03-20 10:47:59.955807 ; TestPlan ; Information ; -----------------------------------------------------------------

2021-03-20 10:47:59.970796 ; TestPlan ; Information ; Starting TestPlan ‘Untitled’ on 2021/3/20 10:47:59, 4 of 4 TestSteps enabled.

2021-03-20 10:47:59.977783 ; Settings ; Debug ; No settings file exists for EngineSettings. A new instance with default values has been created. [2.84 ms]

2021-03-20 10:47:59.981771 ; Settings ; Debug ; No settings file exists for DutSettings. A new instance with default values has been created. [642 us]

2021-03-20 10:47:59.996698 ; Settings ; Debug ; No settings file exists for InstrumentSettings. A new instance with default values has been created. [220 us]

2021-03-20 10:47:59.998725 ; Settings ; Debug ; No settings file exists for ConnectionSettings. A new instance with default values has been created. [206 us]

2021-03-20 10:48:00.000897 ; Settings ; Debug ; No settings file exists for ResultSettings. A new instance with default values has been created. [162 us]

2021-03-20 10:48:00.003680 ; Settings ; Debug ; No settings file exists for PackageManagerSettings. A new instance with default values has been created. [977 us]

2021-03-20 10:48:00.012933 ; TestPlan ; Debug ; Saved Test Plan XML [4.80 ms]

2021-03-20 10:48:02.059357 ; TestPlan ; Information ; Waiting for resources to open:

2021-03-20 10:48:02.059357 ; TestPlan ; Information ; - Log

2021-03-20 11:04:30.431372 ; Session ; Debug ; Session log loaded as ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\SessionLogs\openTAPrun 2021-03-20 11-04-25.txt’. [56.8 ms]

2021-03-20 11:04:30.458299 ; Session ; Debug ; Running '“F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\openTAPrun.exe” ’ in ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug’.

2021-03-20 11:04:30.521709 ; Session ; Debug ; Session log loaded as ‘console_log.txt’. [10.3 ms]

2021-03-20 11:04:30.526696 ; Session ; Debug ; Running '“F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\openTAPrun.exe” ’ in ‘F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug’.

2021-03-20 11:04:30.587396 ; Resolver ; Debug ; Found 34/89 assembly files. [37.1 ms]

2021-03-20 11:04:30.621426 ; Resolver ; Debug ; Found match for System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a in F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Dependencies\System.Runtime.InteropServices.RuntimeInformation.4.0.2.0\System.Runtime.InteropServices.RuntimeInformation.dll

2021-03-20 11:04:30.630282 ; Session ; Debug ; Microsoft Windows 10.0.19042 X64

2021-03-20 11:04:30.630282 ; Session ; Debug ; .NET Framework 4.8.4341.0

2021-03-20 11:04:30.656212 ; Session ; Debug ; OpenTAP Engine 9.12.3+81c8e2eb X86

2021-03-20 11:04:30.687407 ; Resolver ; Debug ; Found match for System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a in F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Dependencies\System.Reflection.Metadata.1.4.3.0\System.Reflection.Metadata.dll

2021-03-20 11:04:31.160624 ; Searcher ; Debug ; Ordered 30 assemblies according to references. [570 ms]

2021-03-20 11:04:31.211488 ; PluginManager ; Debug ; Found 21 plugin assemblies containing 327 plugin types. [622 ms]

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.Plugins.BasicSteps.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of Keysight.OpenTap.Wpf.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.Package.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of PackageManager.exe

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of Editor.exe

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 0.0.0.0 of keboda_DUTs.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 1.0.0.0 of OpenTap.Plugins.ExamplePlugin.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 1.0.0.0 of OpenTap.Plugins.PluginDevelopment.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 1.0.0.0 of PluginDevelopment.Gui.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.10.1+cb7f7c7a of Csv.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of ResultsViewer.exe

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of RunExplorer.exe

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 0.0.0.0 of sdkrunCMD.exe

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.1+b350c60f of Keysight.OpenTap.CommunityEditionPopup.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 1.0.0 of OpenTap.OSIntegration.Windows.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.12.3+81c8e2eb of OpenTap.Sdk.New.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.4.2+3009aace of Keysight.OpenTap.Plugins.ResultListener.SqlDatabase.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.4.2+3009aace of Keysight.OpenTap.Plugins.ResultListener.PostgreSQL.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 9.4.2+3009aace of Keysight.OpenTap.Plugins.ResultListener.SQLite.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Found version 1.1.2+dda72af5 of OpenTap.VSSdk.Installer.dll

2021-03-20 11:04:31.212486 ; PluginManager ; Debug ; Searched 34 Assemblies. [623 ms]

2021-03-20 11:04:31.225162 ; PluginManager ; Debug ; Loaded OpenTap. [408 us]

2021-03-20 11:04:31.227158 ; PluginManager ; Debug ; Loaded OpenTap.Plugins.BasicSteps. [195 us]

2021-03-20 11:04:31.258109 ; Resolver ; Debug ; Found match for System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 in F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Dependencies\System.ValueTuple.4.0.3.0\System.ValueTuple.dll

2021-03-20 11:04:31.295975 ; PluginManager ; Debug ; Loaded mscorlib. [600 ns]

2021-03-20 11:04:31.365786 ; PluginManager ; Debug ; Loaded Keysight.OpenTap.Wpf. [32.5 ms]

2021-03-20 11:04:31.376953 ; PluginManager ; Debug ; Loaded PackageManager. [46.3 ms]

2021-03-20 11:04:31.391717 ; PluginManager ; Debug ; Loaded OpenTap.Plugins.PluginDevelopment. [49.9 ms]

2021-03-20 11:04:31.401702 ; PluginManager ; Debug ; Loaded ResultsViewer. [65.9 ms]

2021-03-20 11:04:31.405681 ; PluginManager ; Debug ; Loaded OpenTap.Package. [71.6 ms]

2021-03-20 11:04:31.412060 ; PluginManager ; Debug ; Loaded RunExplorer. [70.3 ms]

2021-03-20 11:04:31.417648 ; PluginManager ; Debug ; Loaded Editor. [86.5 ms]

2021-03-20 11:04:31.464614 ; PluginManager ; Debug ; Loaded OpenTap.OSIntegration.Windows. [6.41 ms]

2021-03-20 11:04:35.760367 ; TestPlan ; Information ; -----------------------------------------------------------------

2021-03-20 11:04:35.776340 ; TestPlan ; Information ; Starting TestPlan ‘Untitled’ on 2021/3/20 11:04:35, 4 of 4 TestSteps enabled.

2021-03-20 11:04:35.783283 ; Settings ; Debug ; No settings file exists for EngineSettings. A new instance with default values has been created. [2.56 ms]

2021-03-20 11:04:35.787304 ; Settings ; Debug ; No settings file exists for DutSettings. A new instance with default values has been created. [662 us]

2021-03-20 11:04:35.803261 ; Settings ; Debug ; No settings file exists for InstrumentSettings. A new instance with default values has been created. [225 us]

2021-03-20 11:04:35.805222 ; Settings ; Debug ; No settings file exists for ConnectionSettings. A new instance with default values has been created. [216 us]

2021-03-20 11:04:35.807244 ; Settings ; Debug ; No settings file exists for ResultSettings. A new instance with default values has been created. [154 us]

2021-03-20 11:04:35.835305 ; PluginManager ; Debug ; Loaded PresentationFramework. [400 ns]

2021-03-20 11:04:35.894019 ; Settings ; Debug ; GuiControlsSettings loaded from F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Settings\GUI Controls.xml [85.7 ms]

2021-03-20 11:04:35.921943 ; Settings ; Debug ; EditorSettings loaded from F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Settings\Editor.xml [27.4 ms]

2021-03-20 11:04:35.922940 ; Settings ; Debug ; No settings file exists for PackageManagerSettings. A new instance with default values has been created. [925 us]

2021-03-20 11:04:35.923940 ; Settings ; Debug ; No settings file exists for PackageManagerGuiSettings. A new instance with default values has been created. [359 us]

2021-03-20 11:04:35.932914 ; Settings ; Debug ; PanelSettings loaded from F:\test only\openTap\openTapSDK\openTAPrun\bin\Debug\Settings\GUI Panels.xml [8.98 ms]

2021-03-20 11:04:35.933912 ; Settings ; Debug ; No settings file exists for CustomBenchSettingsList. A new instance with default values has been created. [244 us]

2021-03-20 11:04:35.935904 ; Settings ; Debug ; No settings file exists for ExampleSettings. A new instance with default values has been created. [346 us]

2021-03-20 11:04:35.936904 ; Settings ; Debug ; No settings file exists for ViewerSettings. A new instance with default values has been created. [340 us]

2021-03-20 11:04:35.937899 ; Settings ; Debug ; No settings file exists for RunExplorerSettings. A new instance with default values has been created. [835 us]

2021-03-20 11:04:35.947350 ; TestPlan ; Debug ; Saved Test Plan XML [4.93 ms]

2021-03-20 11:04:37.996318 ; TestPlan ; Information ; Waiting for resources to open:

2021-03-20 11:04:37.996318 ; TestPlan ; Information ; - Log

I use the following method to run the tap plan using result listeners, it is running successfully for me.

public void Test()
        {
            Task.Run(() =>
            {
                while (true)
                {
                    if (isTapPlanReadyForRun)
                    {
                        Dispatcher.CurrentDispatcher.Invoke(() =>
                        {                     
                            cancellationToken = new CancellationTokenSource();
                            myTestPlan.ExecuteAsync(resultListeners, null, null, cancellationToken.Token);
                        });

                        break;
                    }
                }
            });

        }
3 Likes

I’m so happy this works! Thanks a lot :smile:
It seems myTestPlan.ExecuteAsync() is the key to run. Below is my finally running code:
> // Execute the TestPlan. This is the equivalent of the Run button in the TAP GUI.

        //myTestPlan.Execute();
        CancellationToken cancellationToken = new CancellationToken();
        //myTestPlan.Execute(resultListeners,null);
        myTestPlan.ExecuteAsync(resultListeners, null, null, cancellationToken);
3 Likes