Yats – Test Repository Manager

By | March 26, 2013

A Test Repository Manager is an interface between Yats framework and test case implementation. Currently only one Manager is implemented in order to support test cases written in C# (classes implementing IYatsTestCase interface). In the future, repository managers for shell scripts, NUnit test cases and other tests should be added. Multiple Repository Managers can be implemented and used simultaneously. When the Yats program is started, it first searches for Test Repository Manager implementations in available assemblies and uses them to discover and control the test cases. This post will give a summary of what a Test Repository Manager must implement.


public interface ITestRepositoryManager
{
void Initialize();
List<ITestCaseInfo> TestCases { get; }

// should return unique names for test cases (class type name, script file name etc.)
string GetUniqueTestId(ITestCase testCase);
// return the corresponding test case by ID.
ITestCase GetByUniqueId(string uniqueId);

ITestResult Execute(ITestCase testCase, List<IParameter> testParameters, IGlobalParameterCollection globalParameters );
bool Cancel(ITestCase testCase);
string GetTestName(ITestCase testCase);

List<IParameter> GetParameters(ITestCase testCase);

bool GetTestResult(ITestCase testCase, IParameter param, out object value);
void SetParameterValue(ITestCase testCase, IParameter param, object value);
bool GetParameterValue(ITestCase testCase, IParameter param, out object value);
bool GetParameterDefault(ITestCase testCase, IParameter param, out object value);
bool CanParameterBeNull(ITestCase testCase, IParameter param);
}

  • void Initialize() – called once during application startup. A scan for test cases should be performed here. The repository manager may do assembly reflection, search in files or other places in order to find anything that looks like its test case
  • List<ITestCaseInfo> TestCases – after initialization is done, the repository manager should return its supported test case list
  • Any test case is referenced by its unique ID string when a test sequence is saved and loaded. The GetUniqueTestId(ITestCase testCase) and ITestCase GetByUniqueId(string uniqueId) perform the conversion. The test case ID should not change between program runs. For Native test cases, the Assembly-Qualified class name is used as a unique ID. For other managers, i.e. a script name could be used to identify the test case
  • string GetTestName(ITestCase testCase) – should return a user-friendly name. In the future, this interface should not handle user-visible names and these methods will be removed
  • ITestResult Execute(ITestCase testCase, List<IParameter> testParameters, IGlobalParameterCollection globalParameters ) – executes the test case
  • bool Cancel(ITestCase testCase) – try to cancel a running test case, return false if the test does not support it

The following methods are responsible for test parameter discovery, setting and getting the parameter values

  • List<IParameter> GetParameters(ITestCase testCase);
  • bool GetTestResult(ITestCase testCase, IParameter param, out object value);
  • void SetParameterValue(ITestCase testCase, IParameter param, object value);
  • bool GetParameterValue(ITestCase testCase, IParameter param, out object value);
  • bool GetParameterDefault(ITestCase testCase, IParameter param, out object value);
  • bool CanParameterBeNull(ITestCase testCase, IParameter param);

Leave a Reply

Your email address will not be published.