Absent Member.
Absent Member.
5620 views

Automail from Test Lab/Test Set in Quality Center 10.0

Is there a way to set up a notification or automail to be sent to a group when a Test is changed to the status of failed /failed in Test Lab/test set modules.

Currently quality center 10.00 supporting only modules Defect to send auto mail.
0 Likes
47 Replies
Fleet Admiral
Fleet Admiral

If you are not getting any message boxes, that means your code is not executing. So quite naturally no emails are sent.

This code you are using should execute from Test Plan when you change status. Can you catch any Test_FieldChange event by a MsgBox.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Absent Member.
Absent Member.

Hi

I tried a simple code from the TestLab_TestSetTests_FieldChange.

this code will trigger a mail when the status of the any test becomes failed. Please find the code

Sub TestLab_TestSetTests_FieldChange(FieldName)
On Error Resume Next

if TestSetTest_Fields.Field("TC_STATUS").Value="Failed" then
tdc.SendMail "you can enter any user name"," yu can enter the user name from whom it got trigger","xxx","body",NULL,"HTML"

end if
On Error GoTo 0
End Sub
0 Likes
Absent Member.
Absent Member.

Hi Jan,

Thanks for your immediate response. Msgbox working fine and getting one error message.

Pleas see the attached screenshot and reply.

Thanks again for your help

0 Likes
Fleet Admiral
Fleet Admiral

OK, your problem is simply that the PrintError function is not defined. Put a comment mark (') in front of that line and try again.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Absent Member.
Absent Member.

HiJan,

code not generating for defect module workflow when i click Apply Scripts changes and Apply & View in quality center 10.0

It was working fine till yesterday and today nothing was there.

pls advice
0 Likes
Fleet Admiral
Fleet Admiral

No idea. I never use the workflow wizards, so I don't know how buggy they are.

You can check if the workflow file (detects.tds) is still present on the file system in the project repository scripts folder, but I suspect your changes are gone.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Absent Member.
Absent Member.

Hi Jan,

Automail not working in Test Lab as per your instruction..

Code is here below for your ref.
Sub TestSetTests_FieldChange(FieldName)


if FieldName = "TC_STATUS" Then
strSubject = "Test case execution status From Test Lab" & _
" for project " & TDConnection.ProjectName & _
" in domain " & TDConnection.DomainName
strComment = "The user " & User.FullName & _
" changed the status of the test " & _
Test_Fields("TC_NAME").Value & _
" to " & Test_Fields("TC_ STATUS").Value
'tdc.SendMail "","","xxx","body",
'NULL,"HTML"
' MsgBox "Hello ...Message from testset field change "
if TestSetTest_Fields.Field("TC_STATUS").Value="Failed" then
MsgBox "Manual: Failed "

SendMail Test_Fields("TC_TEST_ID").Value, _
Test_Fields("TC_TESTER_NAME").Value, "[Test Manager]", _
strSubject, StrComment
else

if TestSetTest_Fields.Field("TC_STATUS").Value="Passed" then
MsgBox "Manual scripts : Passed"
SendMail Test_Fields("TC_TEST_ID").Value, _
Test_Fields("TC_TESTER_NAME").Value, "[Test Manager]", _
strSubject, StrComment

End if
End if
End if

' On Error GoTo 0
End Sub
0 Likes
Fleet Admiral
Fleet Admiral

I never told you this would work from Test Lab. Typically you won't change test instance status manually, so your code will not be triggered. If you want to send an email when you test fails you should go for the Manual Runner workflow like I told you.

Moreover, "Test_Fields" won't work for referring to test instance fields - it will only work in Test Plan. You should use "TestSetTest_Fields" for referring to all the TC fields.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Absent Member.
Absent Member.

Hi Jan,

Thanks for your response.

My code and errors are below for your review.
Sub TestSetTests_FieldChange(FieldName)
'On Error Resume Next

Dim strSubject1, strComment1
'if TestSetTest_Fields = "TC_STATUS" Then

'strSubject = "Test Case Exeuction Status Change Notification" & _
'" for project " & TDConnection.ProjectName & _
'" in domain " & TDConnection.DomainName
'strComment = "The user " & User.FullName & _
'" changed the status of the test " & _
'Test_Fields("TC_NAME").Value & _
'" to " & Test_Fields("TC_ STATUS").Value


'if TestSetTest_Fields ="TS_STATUS" and _
'Test_Fields("TC_STATUS").Value = "Failed" then
if TestSetTest_Fields.Field("TC_STATUS").Value="Failed" then
strSubject = "Test Case Exeuction Status Change Notification" & _
" for project " & TDConnection.ProjectName & _
" in domain " & TDConnection.DomainName
strComment = "The user " & User.FullName & _
" changed the status of the test " & _
TestSetTest_Fields.Field("TC_NAME").Value & _
" to " & TestSetTest_Fields.Field("TC_ STATUS").Value
MsgBox "TC Failed"
SendMail TestSetTest_Fields.Field("TC_TEST_ID").Value, _
TestSetTest_Fields("TC_TESTER_NAME").Value, "[Test Manager]", _
strSubject1, StrComment1

else

'if TestSetTest_Fields ="TS_STATUS" and _
'Test_Fields("TC_STATUS").Value = "Passed" then
if TestSetTest_Fields.Field("TC_STATUS").Value="Passed" then
strSubject = "Test Case Exeuction Status Change Notification" & _
" for project " & TDConnection.ProjectName & _
" in domain " & TDConnection.DomainName
strComment = "The user " & User.FullName & _
" changed the status of the test " & _
TestSetTest_Fields.Field("TC_NAME").Value & _
" to " & TestSetTest_Fields.Field("TC_ STATUS").Value
MsgBox "TC Passed"
SendMail TestSetTest_Fields.Field("TC_TEST_ID").Value, _
TestSetTest_Fields("TC_TESTER_NAME").Value, "[Test Manager]", _
strSubject1, StrComment1



End if
End if

' On Error GoTo 0
End Sub

Sub SendMail (iObjectId, strTo, strCc, strSubject1, strComment1)
'On Error Resume Next
Dim objBugFactory, objBug
Set objBugFactory = TDConnection.TestSetFactory
Set objBug = objBugFactory.Item(iObjectId)
objBug.Mail strTo, strCc, 2, strSubject1, strComment1
Set objBug = Nothing
Set objBugFactory = Nothing
'PrintError "SendStatus"
'On Error GoTo 0
End Sub



Error:

Error at Line 319, (character 1)
Object doesn't support this property or method: 'objBug.Mail':
====================
Set objBugFactory = TDConnection.TestSetFactory
Set objBug = objBugFactory.Item(iObjectId)
==> objBug.Mail strTo, strCc, 2, strSubject1, strComment1
Set objBug = Nothing
====================


Pls advice
0 Likes
Fleet Admiral
Fleet Admiral

I think you need to take a new look at the OTA reference and think things through again. You are calling your SendMail sub with a test instance ID.

But in this sub you are using this ID to get a TestSet object which you call "objBug":

Set objBugFactory = TDConnection.TestSetFactory
Set objBug = objBugFactory.Item(iObjectId)

Moreover, neither the TestSet nor the TSTest object support the .Mail method. You need to use the TDConnection.SendMail method instead.

And as I explained earlier, you need to clarify for yourself exactly when you want an automatic email to be sent. When you change test instance status manually? When you fail a run? Or when you create a new defect?
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Absent Member.
Absent Member.

Hi Jan,
Thanks for your reply.

I what to an automatic email to be sent when I change the test instance status manually from testset?

â ¢ When the status is failed, the automatic mail need to be sent to Group1,Group2
â ¢ When the status is passed, the automatic mail need to be sent to Group3,Group4
â ¢ When the test cases assigned to responsible tester after schedule, the automatic mail need to be sent to Group5,Group6
â ¢ When the status is complete, the automatic mail need to be sent to Group7,Group8

Pls advice
0 Likes
Fleet Admiral
Fleet Admiral

OK, if that is what you want, I suggest you start from the code here below and then add more details when you have seen that this works:

Sub TestSetTests_FieldChange(FieldName)
If FieldName = "TC_STATUS" Then
TDConnection.SendMail youremail@xyz.com, "", "Test email", "Testing"
End If
End Sub
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.