Custom Test Types Interfaces

TestTypeScriptViewerControl Example

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 TestTypeScriptViewerControl : UserControl, IScriptViewer
  {

    ITDConnection4 m_tdc;

    public TestTypeScriptViewerControl()
    {
      InitializeComponent();
    }

    #region Implementation of IScriptViewer

    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 void ShowTest(Mercury.TD.Client.Ota.Entities.Api.ITest test)
    {
        // Use the test argument only to get the COM OTA ITest 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.
        // legacyTest is the COM ITest reference. For more details, see the
        // HP ALM Open Test Architecture Reference.
      ITest2 legacyTest = (ITest2)((test as ILegacyBaseFieldProvider).LegacyBaseField);
      m_textBox.Text = "Showing test " + legacyTest.Name + " in project " + m_tdc.ProjectName;
    }

    public void SaveScript()
    {
      MessageBox.Show("Saving script.");
    }

    public bool ReadOnly
    {
      set { MessageBox.Show("Setting read only = " + value); }
    }

    #endregion

  }
}


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