Вы еще не интегрировали TestComplete с HP Quality Center? А вот ребята из SmartBear эту проблему уже решали, а именно:
- Подсоединиться к HP Quality Center.
- Создать test set
- Добавить test case к test set.
- Выложить результаты test case
- Прикрепить логи пронона к test set
- Отсоединиться от HP Quality Center
Подсоединиться к HP Quality Center или Отсоединиться от HP Quality Center
Создать test set
var testSetFolder = treeManager.NodeByPath (testSetFolderName);
var testSet = testSetFactory.AddItem (testSetName);
testSet.TestSetFolder = testSetFolder;
testSet.Field (‘CY_COMMENT’) = testSetComment;
testSet.Post ();{/syntaxhighlighter}
Выложить результаты test case
{syntaxhighlighter brush: jscript;fontsize: 100; first-line: 1; }// Start of Test
var startTime = aqDateTime.Now();
var errorCountBefore = Log.ErrCount;
TestCase ();
// End of Test
var endTime = aqDateTime.Now ();
var totalTime = aqDateTime.TimeInterval (endTime, startTime);
totalTime = (aqDateTime.GetSeconds(totalTime)) + (aqDateTime.GetMinutes(totalTime) * 60) + (aqDateTime.GetHours(totalTime) * 60 * 60);
errorCountAfter = Log.ErrCount; var result = (errorCountBefore == errorCountAfter) ? ‘Passed’ : ‘Failed’;
QualityCenter.PostTestRun (myTestRun, result, totalTime);{/syntaxhighlighter}{syntaxhighlighter brush: jscript;fontsize: 100; first-line: 1; }Log.SaveResultsAs (resultsDir, lsHTML);
var fileList = slPacker.GetFileListFromFolder (resultsDir);
if (slPacker.Pack (fileList, resultsDir, resultsZip))
{
QualityCenter.CloseTestSet (myTestSet, resultsZip);
}
else
{
Log.Error (‘Error archiving files.’);{/syntaxhighlighter}
Полный скрипт
{
var host = ‘http://url//qcbin’;
var domain = ‘myDomain’;
var project = ‘myProject’;
var user = ‘UserName’;
var password = ‘ThisIsABadPassword’;
var testSetFolder = ‘Root\Test Lab Folder 1\Folder2’
var testSetName = ‘TestComplete Tests’;
var testSetComment = ‘Created by TestComplete’;
var testCase = ‘Subject\Test Plan Folder 1\Folder 2\Test Case’;
var testRunName = ‘TestComplete automated test run’;
var resultsDir = ‘C:\temp\results’;
var resultsZip = ‘C:\temp\TestCompleteLog.zip’;
QualityCenter.Connect (host, domain, project, user, password);
if (QualityCenter.returnCode != null)
{ /* Deal with failure to connect. */ }
var myTestSet = QualityCenter.NewTestSet (testSetFolder, testSetName, testSetComment);
if (QualityCenter.returnCode != null)
{ /* Deal with failure to create test set. */ }
var myTestCase = QualityCenter.GetTestCase (testCase);
if (QualityCenter.returnCode != null)
{ /* Deal with failure to get a test case. */ }
var myTestRun = QualityCenter.AddRunToTestSet(myTestSet, myTestCase, testRunName);
if (QualityCenter.returnCode != null)
{ /* Deal with failure to add test run. */ }
// Start of Test
var startTime = aqDateTime.Now();
var errorCountBefore = Log.ErrCount;
TestCaseSample ();
// End of Test
var endTime = aqDateTime.Now ();
var totalTime = aqDateTime.TimeInterval (endTime, startTime);
totalTime = (aqDateTime.GetSeconds(totalTime)) + (aqDateTime.GetMinutes(totalTime) * 60)
+ (aqDateTime.GetHours(totalTime) * 60 * 60);
errorCountAfter = Log.ErrCount;
var result = (errorCountBefore == errorCountAfter) ? ‘Passed’ : ‘Failed’;
QualityCenter.PostTestRun (myTestRun, result, totalTime);
if (QualityCenter.returnCode != null)
{ /* Deal with failure to post result. */ }
Log.SaveResultsAs (resultsDir, lsHTML);
var fileList = slPacker.GetFileListFromFolder (resultsDir);
if (slPacker.Pack (fileList, resultsDir, resultsZip))
{
QualityCenter.CloseTestSet (myTestSet, resultsZip);
}
else
{
Log.Error (‘Error archiving files.’);
}
QualityCenter.Disconnect ();
}
function TestCaseSample ()
// I wish all test cases were this easy to write…
{
Delay (1000);
}{/syntaxhighlighter}
Источник: blog.smartbear.com