Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a script to email from a passed value

Status
Not open for further replies.

rjurgens

MIS
Jul 9, 2003
37
GB
I trying to write a script that will allow an email to be send to a person once the test script has completed and passed. I created a new field in the Test Lab area call 'Passed To', and wish to have the code take the value (person's user name) and email him letting him know that the particular script has successfully completed. Can anyone help?

Thanks
 
You need to look at the Environ set of variables - in particular one called USERNAME.

But more help is probably available if we know that you are running WinRunner7.5, or QTP8.0 etc..etc...

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Sorry, it would be more helpful. This is all in Test Director 8.0. I have no VBScript knowledge whatsoever, but when a test script is set to Passed (I believe the field name is TC_STATUS), I want an email to be sent automatically to a user, whose userid name is in field TC_USER_01. Of course, the email address is associated with the username somewhere (no idea where). So a knowledge of Test Director would help alot.

Thanks in advance.
 
You'll need to speak to your Domain Administrator. TD allows a number of fields to be customised for different purposes, and there are a series of fields like TC_USER_01, TC_USER_02 etc. These fields are part of the TESTCYCL table and represent the TD username of the person who ran the test.

You will need to find out where the Domain Admin has stored the information (assuming email addresses have been captured - it's not a requirement in TD). At that point it would seem to be a SQL request to return the email address where the username is <whatever>.


Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Hi Rjurgens,

Please use the below function...all yo u need to do is place create a function call to that function in the last action of your test script.
Example:

If DataTable("Status",dtGlobalSheet) = "Pass" Then
aTo = "emailaddress"
Subject = "Test passed"
TextBody = "your comment"
Call SendMailaTo, Subject, TextBody)
End If

Function SendMail(aTo, Subject, TextBody)

'Create an Outlook object
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")

'Create e new message
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
'You can display the message To debug And see state
'.Display

.Subject = Subject
.Body = TextBody

'Set destination email address
.Recipients.Add (aTo)

'Set sender address If specified.
Const olOriginator = 0

'Send the message
.Send
End With
End Function



Let me know if this wot you were looking after..
and if you stil have pbs..plz let me know,
thx,
kev
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top