How to determine if a test is executed from Quality center test lab
Hmmm. I’m back after a long time. Okay.. lets get started.. How do we know if the test is being executed from a testset in testlab module of HP Quality center ?.. During development of the test script, we have to execute the code to see if the testscript is performing the test the way we wanted it to. We execute them directly from QTP IDE, even though we have connected to QC from QTP IDE. Let’s say one of your function does something that is dependent on the testscript name. Usually we use qcutil.CurrentTest.Name to determine the testscript name. But if we are not connected to QC, then this call will fail. In that situation, if we want to know if the test is executed from QC or from local system, we can use this function. Here’s the function. Enjoy.. In another post, I’ll provide the code for determining the testscript name irespective of whether QTP is connected to QC or not.
Public function IsExecutedFromQC()
Dim CurrentTSTest
if qcutil.IsConnected then
Reporter.ReportEvent micPass,"Connected to QC", "Connected to Quality Center Server: " & qcutil.QCConnection.ServerName & vbcrlf & _
"Project : " & qcutil.QCConnection.ProjectName & vbcrlf & " Domain : " & qcutil.QCConnection.DomainName
Set CurrentTSTest = qcutil.CurrentTestSetTest
if CurrentTSTest is Nothing then
Reporter.ReportEvent micFail,"IsExecutedFromQC", "QTP is connected to quality center server. But the test is **not** executed from a Testlab in QC"
IsExecutedFromQC = FALSE
else
Reporter.ReportEvent micPass,"IsExecutedFromQC", "The test is executed from a Testlab in QC"
IsExecutedFromQC = TRUE
end if
else
Reporter.ReportEvent micDone,"IsExecutedFromQC", "QTP is not connected to quality center server"
IsExecutedFromQC = FALSE
end if
End Function
No comments yet.
Leave a comment
-
Archives
- June 2009 (1)
- April 2009 (1)
- March 2009 (1)
- August 2008 (5)
- July 2008 (4)
- May 2008 (2)
- April 2008 (3)
- February 2008 (3)
-
Categories
-
RSS
Entries RSS
Comments RSS