Skip to content

ComponentSettings don't work reliable

Environment:

Windows 10, 64-bit

OpenTAP 9.5.1

Steps to reproduce:

This defect is driving me nuts. It comes from the ComponentSettings of Resource Arbiter. I use a bool to enable/disable the Resource Arbiter integration. This always has effect on the corresponding Setting.xml file, however the value seen in code during execution of EnterTestPlanRun is often not updated. Workaround is then to exit TAP and restart it. It also seems to help to open the Setting, and then press the Cancel button. That seems to actually load the settings correctly.

Whenever i want to reproduce the problem things are working reliable.

------------------ Stop Reading here ------------------

Procedure not yet reliable to reproduce. I still have not found the boundary condition when it happens and when not

My impression is that it has to do with some longer wait time (TAP sitting idle for long time before you again use it).

This is a simplified version of the ComponentSetting I use in Resource Arbiter. It has both a ComponentSetting and ITestPlanRunMonitor. The value of the ComponentSetting property is observed in the EnterTestPlanRun method:

  public class Setting : ComponentSettings<Setting>, ITestPlanRunMonitor
  {
    public bool Enabled { set; get; } = false;

    private static readonly TraceSource _log = Log.CreateSource("Setting");

    public void EnterTestPlanRun(TestPlanRun plan)
    {
      _log.Info($"Enabled = {Enabled}.");
      _log.Info($"Setting.Current.Enabled = {Setting.Current.Enabled}.");
    }

    public void ExitTestPlanRun(TestPlanRun plan)
    {
    }
  }```

1. Compile above ComponentSetting or use [TapComponentSettingsDefect.dll](/uploads/09d335bf57c3140e509cb02736fda3fd/TapComponentSettingsDefect.dll)
2. Load Test Plan [Delay.TapPlan](/uploads/6406b454cc2cc1ea0b95a519ff8aae80/Delay.TapPlan)
3. Run Test Plan, you see in the log:

18:40:50.485 Setting Enabled = False. 18:40:50.485 Setting Setting.Current.Enabled = False.

4. Change the Enabled in the Menu
![image](/uploads/d1018c401dc7931659142b83593ead16/image.png)
5. Run the Test Plan, you see in the log:

18:46:41.945 Setting Enabled = True. 18:46:41.945 Setting Setting.Current.Enabled = True.

6. Wait long time
7. Disable the "Enabled" again in the menu
8. Run Test Plan, you still see enabled in the log
9. Examine the Setting.xml file: this is correctly reflecting the 

**Actual result:**

(Please also attach a log file from %TAP_PATH%\SessionLogs\ that shows the issue when possible/relevant)

**Expected result:**

**Other remarks:**
Edited by Guenter Tietz