// 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
{
///
/// Interface forming the basis for all ResultListeners.
///
[Display("Result Listener")]
public interface IResultListener : IResource, ITapPlugin
{
///
/// Called just when test plan starts.
///
/// Test plan run parameters.
void OnTestPlanRunStart(TestPlanRun planRun);
///
/// Called when test plan finishes. At this point no more result will be sent
/// to the result listener from said test plan run.
///
/// Test plan run parameters.
/// The log file from the test plan run as a stream.
void OnTestPlanRunCompleted(TestPlanRun planRun, System.IO.Stream logStream);
///
/// Called just before a test step is started.
///
/// Step run parameters.
void OnTestStepRunStart(TestStepRun stepRun);
///
/// Called when a test step run is completed.
/// Result might still be propagated to the result listener after this event.
///
/// Step run parameters.
void OnTestStepRunCompleted(TestStepRun stepRun);
///
/// Called when a result is received.
///
/// Step run parameters.
/// Result structure.
void OnResultPublished(Guid stepRunID, ResultTable result);
}
///
/// An enum containing the execution states of a step.
///
public enum StepState
{
///
/// The step is not running.
///
Idle,
///
/// The step is executing its PrePlanRun code.
///
PrePlanRun,
///
/// The step is executing its Run code.
///
Running,
///
/// The step is executing deferred actions after Run.
///
Deferred,
///
/// The step is executing its PostPlanRun code.
///
PostPlanRun
}
///
/// Interface to listen to when steps execute what.
///
[Display("Execution Listener")]
public interface IExecutionListener : IResultListener
{
///
/// Called whenever a step changes its execution state.
///
/// The given step
/// The given step run. For PrePlanRun and PostPlanRun this is null.
/// The state that the teststep transitioned into.
/// The precise timestamp of when the change happened.
void OnTestStepExecutionChanged(Guid stepId, TestStepRun stepRun, StepState newState, long changeTime);
}
}