Custom Test Type Example > ExecConfigViewerControl Example
Custom Test Types Interfaces

ExecConfigViewerControl Example

using System;
using System.Windows.Forms;
using Mercury.TD.Client.UI.Modules.Shared.Api;
using Mercury.TD.Client.Ota.Api;
using Mercury.TD.Client.Ota.Core;
using Mercury.TD.Client.Ota.Entities.Api;
using TDAPIOLELib;

namespace TestType
{
  public partial class ExecConfigViewerControl : UserControl, IExecutionConfigurationViewer
  {

    ITDConnection4 m_tdc;

    public ExecConfigViewerControl()
    {
      InitializeComponent();
    }

    #region IExecutionConfigurationViewer Members

    public void InitViewer(IConnection connection)
    {
        // Use the connection only to get the COM OTA connection reference.
        // The .NET IConnection is not a public API. It is for internal HP use.
        // None of its methods or properties are expected to be stable from release
        // to release.
        // m_tdc is the COM ITDConnection reference. For more details, see the
        // HP ALM Open Test Architecture Reference.
      m_tdc = (ITDConnection4)((connection as ITDConnectedObject).TDConnection);
    }

    public string ExecutionConfiguration
    {
      get
      {
        return "Example execution configuration";
      }
      set
      {
        MessageBox.Show("Setting execution configuration = " + value);
      }
    }

    public void ShowExecutionConfiguration(ITestInstance testInstance)
    {
        // Use the testInstance argument only to get the COM OTA ITSTest reference.
        // The .NET ITest is not a public API. It is for internal HP use.
        // None of its methods or properties are expected to be stable from release
        // to release.
        // legacyTestInstance is the COM ITSTest reference. For more details, see the
        // HP ALM Open Test Architecture Reference.
      ITSTest legacyTestInstance = (ITSTest)((testInstance as ILegacyBaseFieldProvider).LegacyBaseField);
      m_textBox.Text = "Showing test instance" + legacyTestInstance.Name + " in project " + m_tdc.ProjectName;
    }

    #endregion

  }
}


© 1993 - 2013 Hewlett-Packard Development Company, L.P.