【QC】VBscript/Javascript通过OTA调用QC
http://tbook.yahubb.com/forum-f5/topic-t9.htm
function QCFactory (strServer,strDomain,strProject,strUser,strPwd) {
this.qcServer = strServer;
this.qcDomain = strDomain;
this.qcProject = strProject;
this.qcUser = strUser;
this.qcPwd = strPwd;
}
QCFactory.prototype.createConnect=function(){
var tdc = new ActiveXObject("TDApiOle80.TDConnection");
tdc.InitConnectionEx(this.qcServer);
tdc.ConnectProjectEx(this.qcDomain,this.qcProject,this.qcUser,this.qcPwd);
return tdc;
}
QCFactory.prototype.disConnect=function(objTDConnection){
if (objTDConnection)
{
if (objTDConnection.Conneted)
{
objTDConnection.Disconnect();
}
if (objTDConnection.LoggedIn)
{
objTDConnection.Logout();
}
alert("cuttent connect was released.");
} else {
alert("TDConnect is undefined.");
}
}
function Operator(TDConnection) {
this.tdc = TDConnection;
}
Operator.prototype.actionEnable=function(strField){
actPer = this.tdc.ActionPermission;
if (actPer.ActionEnabled(strField))
{
// code.
return true;
} else {
// code.
return false;
}
}
在调用的时候:
var strServer = "http://<host>:<port>/qcbin/";
strDomain = "<DOMAIN>";
strProject = "<PROJECT>";
strUser = "<USRENAME>";
strPwd = "<PWD>";
var factory = new QCFactory(strServer,strDomain,strProject,strUser,strPwd);
var con = factory.createConnect();
var operator = new Operator(con);
operator.actionEnable("ac_add_bug");
//operator.runTest();
factory.disConnect(con);

浙公网安备 33010602011771号