From 53e656200368a983e563550e2cc1acbc6d86b729 Mon Sep 17 00:00:00 2001
From: chr <chrry550@outlook.com>
Date: 星期三, 08 四月 2026 19:57:14 +0800
Subject: [PATCH] 完善代码

---
 OpenTap/BasicSteps/SequenceCallStep.cs |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/OpenTap/BasicSteps/SequenceCallStep.cs b/OpenTap/BasicSteps/SequenceCallStep.cs
index 325d804..b92061c 100644
--- a/OpenTap/BasicSteps/SequenceCallStep.cs
+++ b/OpenTap/BasicSteps/SequenceCallStep.cs
@@ -30,6 +30,11 @@
             public Guid Guid2 { get; set; }
         }
 
+        protected override void OnRootChanged(TestPlan plan)
+        {
+            LoadTestPlan();
+        }
+
         /// <summary>
         /// This is the list of path of test plan loaded and used to prevent recursive TestPlan references.
         /// </summary>
@@ -87,7 +92,6 @@
                 {
                     realPath = this.GetParent<TestPlan>()?.Path;
                 }
-                LoadTestPlan();
             }
         }
 
@@ -107,7 +111,7 @@
             }
         }
 
-        [Display("共享变量")]
+        //[Display("共享变量")]
         public bool ShareGlobals { get; set; }
 
         [Browsable(false)]
@@ -268,25 +272,30 @@
                 var xml = plan.SerializeToString();
                 var listeners = OpenTap.Log.GetListeners();
                 var resultSetting = ResultSettings.Current;
+                var fileGlobalsContext = PlanRun.fileGlobalsContext;
                 using (Session.Create())
                 {
+                    SequenceContext.SetLocals(new VariableContext(null));
                     var plan2 = Utils.DeserializeFromString<TestPlan>(xml);
                     plan2.PrintTestPlanRunSummary = false;
+                    plan2.VisualPath = plan.Path;
                     foreach (var listener in listeners)
                     {
                         OpenTap.Log.AddListener(listener);
                     }
                     TestPlanRun subRun;
-                    if (ShareGlobals)
-                    {
-                        subRun = plan2.Execute(SequenceName, resultSetting, null, null,
-                            new VariableContainer(GetMergeContainer(), this.PlanRun.FileGlobalsRuntime, this.PlanRun.StationGlobalsRuntime));
-                    }
-                    else
-                    {
-                        subRun = plan2.Execute(SequenceName, resultSetting, null, null, new VariableContainer(GetMergeContainer(), null,
-                            this.PlanRun.StationGlobalsRuntime));
-                    }
+                    subRun = plan2.Execute(SequenceName, resultSetting, null, null,
+                           new VariableContainer(GetMergeContainer(), fileGlobalsContext, this.PlanRun.StationGlobalsRuntime));
+                    //if (ShareGlobals)
+                    //{
+                    //    subRun = plan2.Execute(SequenceName, resultSetting, null, null,
+                    //        new VariableContainer(GetMergeContainer(), fileGlobalsContext, this.PlanRun.StationGlobalsRuntime));
+                    //}
+                    //else
+                    //{
+                    //    subRun = plan2.Execute(SequenceName, resultSetting, null, null, new VariableContainer(GetMergeContainer(), null,
+                    //        this.PlanRun.StationGlobalsRuntime));
+                    //}
                     UpgradeVerdict(subRun.Verdict);
                 }
             }

--
Gitblit v1.9.1