Ejemplo n.º 1
0
 public string CommentTests(string commaSeparatedIDs, string mess)
 {
     try
     {
         TestRun.CommentTestRuns(commaSeparatedIDs, mess);
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
     return("OK");
 }
Ejemplo n.º 2
0
    public string RunTest(string strRequestID, string strCommandName, string strUserName, string strTestRunID)
    {
        // if it is release, we need rerun test in the last TESTREQUESTS with the same version
        string SQL_Command = "select (select max(t.id) from TESTREQUESTS t where t.versionid = x.versionid  and t.ProgAbb = x.ProgAbb) , x.ProgAbb from TESTREQUESTS x where x.id = $id";

        string ProgAbb;
        string strLastReqestID;

        using (DataSet ds = CbstHelper.GetDataSet(SQL_Command.Replace("$id", strRequestID)))
        {
            ProgAbb         = ds.Tables[0].Rows[0][1].ToString();
            strLastReqestID = ds.Tables[0].Rows[0][0].ToString();
        }
        if (ProgAbb.ToUpper() == "ADMIN")
        {
            strRequestID = strLastReqestID;
        }

        strCommandName = (strCommandName.Replace('`', '"').Replace('~', '\\'));

        // get db type from strCommandName
        string dbtype = GetParam(strCommandName, "dbtype:");

        dbtype = (dbtype == "" ? "NULL" : "'" + dbtype + "'");

        string y3dv = GetParam(strCommandName, "special:");

        y3dv = (y3dv.Contains("3DV") ? "1" : "NULL");

        // get PCName from strCommandName
        string strSQLPCName = "", sPCName = GetParam(strCommandName, "PCName:");

        if (sPCName == "")
        {
            strSQLPCName = "NULL";
        }
        else
        {
            strSQLPCName = "(select T1.ID from PCS T1 where T1.PCNAME = '" + sPCName + "')";
            if (strCommandName.IndexOf("\"PCName:") < 0)
            {
                sPCName = " PCName:" + sPCName;
            }
            else
            {
                sPCName = " \"PCName:" + sPCName + "\"";
            }
        }
        string strGuid     = Guid.NewGuid().ToString();
        string strPRIORITY = "4";

        string strSetSQL =
            @"INSERT INTO SCHEDULE (COMMAND, REQUESTID, PCID, USERID, PRIORITY, SEQUENCENUMBER, SEQUENCEGUID, DBTYPE, Y3DV) VALUES" +
            " ('" + strCommandName + "', " + strRequestID + "," + strSQLPCName + ",(select T2.ID from PERSONS T2 where T2.USER_LOGIN = '******'), " + strPRIORITY + ",2, '" + strGuid + "', " + dbtype + ", " + y3dv + ")";

        strSetSQL = strSetSQL.ToUpper();

        CbstHelper.SQLExecute(strSetSQL);

        TestRun.CommentTestRuns(strTestRunID, "Rerun");
        FeedLog("Next command has been rerun: " + strCommandName);
        return("OK");
    }