chr
2026-04-05 fe750b791d5b517cc4e9bc8e99a9a75139a0cfba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//            Copyright Keysight Technologies 2012-2019
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using System;
 
namespace OpenTap
{
    /// <summary>
    /// Interface forming the basis for all ResultListeners.
    /// </summary>
    [Display("Result Listener")]
    public interface IResultListener : IResource, ITapPlugin
    {
        /// <summary>
        /// Called just when test plan starts.
        /// </summary>
        /// <param name="planRun">Test plan run parameters.</param>
        void OnTestPlanRunStart(TestPlanRun planRun);
 
        /// <summary>
        /// Called when test plan finishes. At this point no more result will be sent 
        /// to the result listener from said test plan run.
        /// </summary>
        /// <param name="planRun">Test plan run parameters.</param>
        /// <param name="logStream">The log file from the test plan run as a stream.</param>
        void OnTestPlanRunCompleted(TestPlanRun planRun, System.IO.Stream logStream);
 
        /// <summary>
        /// Called just before a test step is started.
        /// </summary>
        /// <param name="stepRun">Step run parameters.</param>
        void OnTestStepRunStart(TestStepRun stepRun);
 
        /// <summary>
        /// Called when a test step run is completed.
        /// Result might still be propagated to the result listener after this event.
        /// </summary>
        /// <param name="stepRun">Step run parameters.</param>
        void OnTestStepRunCompleted(TestStepRun stepRun);
 
        /// <summary>
        /// Called when a result is received.
        /// </summary>
        /// <param name="stepRunID"> Step run parameters.</param>
        /// <param name="result">Result structure.</param>
        void OnResultPublished(Guid stepRunID, ResultTable result);
    }
 
    /// <summary>
    /// An enum containing the execution states of a step.
    /// </summary>
    public enum StepState
    {
        /// <summary>
        /// The step is not running.
        /// </summary>
        Idle,
        /// <summary>
        /// The step is executing its PrePlanRun code.
        /// </summary>
        PrePlanRun,
        /// <summary>
        /// The step is executing its Run code.
        /// </summary>
        Running,
        /// <summary>
        /// The step is executing deferred actions after Run.
        /// </summary>
        Deferred,
        /// <summary>
        /// The step is executing its PostPlanRun code.
        /// </summary>
        PostPlanRun
    }
 
    /// <summary>
    /// Interface to listen to when steps execute what.
    /// </summary>
    [Display("Execution Listener")]
    public interface IExecutionListener : IResultListener
    {
        /// <summary>
        /// Called whenever a step changes its execution state.
        /// </summary>
        /// <param name="stepId">The given step</param>
        /// <param name="stepRun">The given step run. For PrePlanRun and PostPlanRun this is null.</param>
        /// <param name="newState">The state that the teststep transitioned into.</param>
        /// <param name="changeTime">The precise timestamp of when the change happened.</param>
        void OnTestStepExecutionChanged(Guid stepId, TestStepRun stepRun, StepState newState, long changeTime);
    }
}