Settings to be performed in Mercury tours application before creating the script:-
1. start server (start->programs->mercury tours->start server)
2. open mercury tours application
3. login as admin and mercury as password
4. Select Data driven popup error
How to get Test Path in QTP/UFT?
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application objectqtpApp.Test.Location TestLoc = qtApp.Test.Location MsgBox TestLoc
However, you need to save the test before the run. Else will give
2.temp directory as output.
How to Send Email via VBScript?
Function SendMail(SendFrom, SendTo, Subject, Body) Set objMail=CreateObject("CDONTS.Newmail") ObjMail.From = SendFrom ObjMail.To = SendTo ObjMail.Subject = Subject ObjMail.Body = Body ObjMail.Send Set objMail = Nothing End Function Function SendMail(SendTo, Subject, Body, Attachment) Set ol=CreateObject("Outlook.Application") Set Mail=ol.CreateItem(0) Mail.to=SendTo Mail.Subject=Subject Mail.Body=Body If (Attachment <> "") Then Mail.Attachments.Add(Attachment) End If Mail.Send ol.Quit Set Mail = Nothing Set ol = Nothing End Function
How to add Defects to Quality Center from UFT/QTP/Vbscript?
Here is a sample code to Connects to Quality Center (TestDirector) from a QuickTest test and adds a bug to the database. This code was taken from here
Dim TDConnection Set TDConnection = CreateObject("TDApiOle.TDConnection") TDConnection.InitConnection "http://hpqc/tdbin" ' URL for the DB TDConnection.ConnectProject "TD76","abc","xyz" ' Valid login information If TDConnection.Connected Then MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName _ + chr (13) +"Project " + TDConnection.ProjectName ) Else MsgBox("Not Connected") End If 'Get the IBugFactory Set BugFactory = TDConnection.BugFactory 'Add a new empty bug Set Bug = BugFactory.AddItem (Nothing) 'Fill the bug with relevant parameters Bug.Status = "New" Bug.Summary = "Connecting to TD" Bug.Priority = "4-Very High" ' depends on the DB Bug.AssignedTo = "admin" ' user that must exist in the DB's users list Bug.DetectedBy = "admin" ' user that must exist in the DB's users list 'Post the bug to database (commit) Bug.Post