How to create a VBScript application using Quality Center API?
Description:
This example adds a defect to a project using VBScript.
Usage:
1. Open a text editor.
2. Add the code below.
3. Save it with .asp extenstion.
4. Place the file on your Web server.
Example:
C:\inetpub\scripts
5. Open the .asp page by entering the URL:
http://<servername>/scripts/AddDefect.asp
Code:
<%@ LANGUAGE=VBSCRIPT %>
<HTML>
<HEAD>
<TITLE> Example using TDAPI </TITLE></HEAD>
<BODY>
<FORM NAME="Example TDAPI">
<%
dim td 'TDConnection
dim mybug
dim bfact
'Create TDConnection object
set td = createobject("TDApiOle80.TDConnection.1")
'Connecting to your tdserver
td.initconnectionex "http://<servernam>/tdbin"
'Note: For Quality Center, connect by using the URL below:
'td.InitConnectionEx "http://<servername>:port/qcbin"
'Connecting to the project
td.ConnectProjectEx "DomainName", "ProjectName", "UserName", "Password"
'Get bug factory
Set bfact = td.BugFactory
'Add defects
Set mybug = bfact.AddItem("Defect")
mybug.Summary = "Test"
mybug.Status = "Open"
mybug.Post
'Release Project Connection.
if td.Connected then
if td.ProjectConnected then
td.DisconnectProject
end if
td.releaseconnection
end if
%>
Defect added!!!
</FORM>
</BODY>
</HTML>
<%
mybug = null
bfact = null
td = null
%>
Description:
This example adds a defect to a project using VBScript.
Usage:
1. Open a text editor.
2. Add the code below.
3. Save it with .asp extenstion.
4. Place the file on your Web server.
Example:
C:\inetpub\scripts
5. Open the .asp page by entering the URL:
http://<servername>/scripts/AddDefect.asp
Code:
<%@ LANGUAGE=VBSCRIPT %>
<HTML>
<HEAD>
<TITLE> Example using TDAPI </TITLE></HEAD>
<BODY>
<FORM NAME="Example TDAPI">
<%
dim td 'TDConnection
dim mybug
dim bfact
'Create TDConnection object
set td = createobject("TDApiOle80.TDConnection.1")
'Connecting to your tdserver
td.initconnectionex "http://<servernam>/tdbin"
'Note: For Quality Center, connect by using the URL below:
'td.InitConnectionEx "http://<servername>:port/qcbin"
'Connecting to the project
td.ConnectProjectEx "DomainName", "ProjectName", "UserName", "Password"
'Get bug factory
Set bfact = td.BugFactory
'Add defects
Set mybug = bfact.AddItem("Defect")
mybug.Summary = "Test"
mybug.Status = "Open"
mybug.Post
'Release Project Connection.
if td.Connected then
if td.ProjectConnected then
td.DisconnectProject
end if
td.releaseconnection
end if
%>
Defect added!!!
</FORM>
</BODY>
</HTML>
<%
mybug = null
bfact = null
td = null
%>
No comments:
Post a Comment