Workflow example of using TA-TFS Extensibility

An example of using TA-TFS Extensibility.

Workflow of using TA-TFS Extensibility

Suppose that we’d like to implement the extensibility ClassInitialized() method, which is invoked after execution of a ClassInitialize().

[TAExtensibilityMethod(LoaderConstant.ClassInitialized)]
 public void ClassInitialized(TAExecutionArguments args)
{
   //Code implementation						
}

In the implementation code of ClassInitialized(), we first provide values for several TA constants, such as RepositoryServer, RepositoryName, RepositoryPort, ProjectName, UserName, and Password.

Your snippet of code may resemble the following:


execObj.ExecutionInfo[TAExecutionConstant.RepositoryServer] = "localhost";
execObj.ExecutionInfo[TAExecutionConstant.RepositoryName] = "SampleRepository";
execObj.ExecutionInfo[TAExecutionConstant.RepositoryPort] = "53400";
execObj.ExecutionInfo[TAExecutionConstant.ProjectName] = "Car Rental";
execObj.ExecutionInfo[TAExecutionConstant.UserName] = "administrator";
execObj.ExecutionInfo[TAExecutionConstant.Password] = "";

Furthermore, TFS test ID is used to name the TA test results uploaded to TFS.


((TestContext)e.TestContext).Properties[TAExecutionConstant.UseTestIDForUploadedResults] = "Yes";

Additionally, we enable startup settings in code, and then define a list of startup settings to be invoked. In this case, we define:

Your snippet of code may resemble the following:


List<StartupSetting> listStartupSettings = new List<StartupSetting>();

StartupSetting browser = new StartupSetting("use browser", "chrome", "default browser", StartupSettingType.BUILT_IN_SETTING);
StartupSetting AUT = new StartupSetting("path", "D:\Sample.exe", "AUT path", StartupSettingType.USER_DEFINE_SETTING);

listStartupSettings.Add(browser);
listStartupSettings.Add(AUT);

execObj.ExecutionInfo[TAExecutionConstant.StartupSettings] = listStartupSettings;
execObj.ExecutionInfo[TAExecutionConstant.StartupSettingsMode] = "yes";

Ultimately, the final code to implement the extensibility ClassInitialized() method may resemble the following:


/// <summary>
/// code to be run after TestInitialize
/// </summary>
         
[TAExtensibilityMethod(LoaderConstant.TestInitialized)]
         
public void TestInitialized(TAExecutionArguments e)
{
   ITAExecution execObj = TAIntegrationLoader.Instance.ITAExecution;
         
   execObj.ExecutionInfo[TAExecutionConstant.RepositoryServer] = "localhost";
   execObj.ExecutionInfo[TAExecutionConstant.RepositoryName] = "SampleRepository";
   execObj.ExecutionInfo[TAExecutionConstant.RepositoryPort] = "53400";
   execObj.ExecutionInfo[TAExecutionConstant.ProjectName] = "Car Rental";
   execObj.ExecutionInfo[TAExecutionConstant.UserName] = "administrator";
   execObj.ExecutionInfo[TAExecutionConstant.Password] = "";
   
  ((TestContext)e.TestContext).Properties[TAExecutionConstant.UseTestIDForUploadedResults] = "Yes";

   List<StartupSetting> listStartupSettings = new List<StartupSetting>();
         
   StartupSetting browser = new StartupSetting("use browser", "chrome", "default browser", StartupSettingType.BUILT_IN_SETTING);
   StartupSetting AUT = new StartupSetting("path", "D:\Sample.exe", "AUT path", StartupSettingType.USER_DEFINE_SETTING);
         
   listStartupSettings.Add(browser);
   listStartupSettings.Add(AUT);
         
   execObj.ExecutionInfo[TAExecutionConstant.StartupSettings] = listStartupSettings;
   execObj.ExecutionInfo[TAExecutionConstant.StartupSettingsMode] = "yes";
         
   execObj.Save();
}

Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGearはLogiGear Corporationの登録商標であり、Action Based TestingおよびTestArchitectはLogiGear Corporationの商標です。ここに記載されているその他の商標は、各所有者の財産です。

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400