本文整理汇总了C#中Application.UseLicenseOfType方法的典型用法代码示例。如果您正苦于以下问题:C# Application.UseLicenseOfType方法的具体用法?C# Application.UseLicenseOfType怎么用?C# Application.UseLicenseOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.UseLicenseOfType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTest
/// <summary>
/// runs the given test and returns resutls
/// </summary>
/// <param name="testPath"></param>
/// <param name="errorReason"></param>
/// <param name="runCanclled"></param>
/// <returns></returns>
public TestRunResults RunTest(string testPath, ref string errorReason, RunCancelledDelegate runCanclled)
{
TestRunResults runDesc = new TestRunResults();
ConsoleWriter.ActiveTestRun = runDesc;
ConsoleWriter.WriteLine(DateTime.Now.ToString(Launcher.DateFormat) + " Running: " + testPath);
runDesc.ReportLocation = testPath;
runDesc.TestPath = testPath;
runDesc.TestState = TestState.Unknown;
_runCancelled = runCanclled;
if (!Helper.IsQtpInstalled())
{
runDesc.TestState = TestState.Error;
runDesc.ErrorDesc = string.Format(Resources.GeneralQtpNotInstalled, System.Environment.MachineName);
ConsoleWriter.WriteErrLine(runDesc.ErrorDesc);
Environment.ExitCode = (int)Launcher.ExitCodeEnum.Failed;
return runDesc;
}
try
{
ChangeDCOMSettingToInteractiveUser();
var type = Type.GetTypeFromProgID("Quicktest.Application");
lock (_lockObject)
{
_qtpApplication = Activator.CreateInstance(type) as Application;
Version qtpVersion = Version.Parse(_qtpApplication.Version);
if (qtpVersion.Equals(new Version(11,0)))
{
runDesc.ReportLocation = Path.Combine(testPath, "Report");
if (Directory.Exists(runDesc.ReportLocation))
{
Directory.Delete(runDesc.ReportLocation, true);
Directory.CreateDirectory(runDesc.ReportLocation);
}
}
// Check for required Addins
LoadNeededAddins(testPath);
if (!_qtpApplication.Launched)
{
if (_runCancelled())
{
QTPTestCleanup();
KillQtp();
runDesc.TestState = TestState.Error;
return runDesc;
}
// Launch application after set Addins
_qtpApplication.Launch();
_qtpApplication.Visible = false;
}
}
}
catch (Exception e)
{
errorReason = Resources.QtpNotLaunchedError;
runDesc.TestState = TestState.Error;
runDesc.ReportLocation = "";
runDesc.ErrorDesc = e.Message;
return runDesc;
}
if (_qtpApplication.Test != null && _qtpApplication.Test.Modified)
{
var message = Resources.QtpNotLaunchedError;
errorReason = message;
runDesc.TestState = TestState.Error;
runDesc.ErrorDesc = errorReason;
return runDesc;
}
_qtpApplication.UseLicenseOfType(_useUFTLicense
? tagUnifiedLicenseType.qtUnifiedFunctionalTesting
: tagUnifiedLicenseType.qtNonUnified);
if (!HandleInputParameters(testPath, ref errorReason))
{
runDesc.TestState = TestState.Error;
runDesc.ErrorDesc = errorReason;
return runDesc;
}
GuiTestRunResult guiTestRunResult = ExecuteQTPRun(runDesc);
runDesc.ReportLocation = guiTestRunResult.ReportPath;
if (!guiTestRunResult.IsSuccess)
//.........这里部分代码省略.........