Meyn.TestLink.TestLink.ReportTCResult C# (CSharp) Method

ReportTCResult() public method

Record the outcome of a test case execution
public ReportTCResult ( int testcaseid, int testplanid, TestCaseResultStatus status, int platformId, string platformName = null, bool overwrite = false, bool guess = true, string notes = "", int buildid, int bugid ) : GeneralResult
testcaseid int Id of test case
testplanid int Id of test plan
status TestCaseResultStatus The result of the test (pass, fail or blocked)
platformId int Id of the platform. Optional if platform name is given
platformName string name of the platform. Optional if the platform id is given
overwrite bool if true, then last execution for (testcase,testplan,build,platform) will be overwritten.
guess bool (assumed to be true) defining whether to guess optinal params or require them explicitly default is true
notes string any notes or info to be added to the description field
buildid int If not given, then highest build id willl be used
bugid int Id for a bug if used in conjunction with a defect tracker
return GeneralResult
        public GeneralResult ReportTCResult(int testcaseid, int testplanid, TestCaseResultStatus status, int platformId = 0, string platformName = null, bool overwrite = false, bool guess = true, string notes = "", int buildid = 0, int bugid = 0)
        {
            stateIsValid();

            string statusChar = "";
            switch (status) {
                case TestCaseResultStatus.Blocked:
                    statusChar = "b";
                    break;
                case TestCaseResultStatus.Pass:
                    statusChar = "p";
                    break;
                case TestCaseResultStatus.Fail:
                    statusChar = "f";
                    break;
            }
            object response = null;
            if (platformName != null) {
                if (bugid == 0) {
                    if (buildid == 0)
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformName, overwrite, notes, guess);
                    else
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformName, overwrite, notes, guess, 0, buildid);
                } else {
                    if (buildid == 0)
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformName, overwrite, notes, guess, bugid);
                    else
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformName, overwrite, notes, guess, bugid, buildid);
                }
            } else {
                if (platformId == 0)
                    throw new TestLinkException("must supply either a platform id or a platform name");
                if (bugid == 0) {
                    if (buildid == 0)
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformId, overwrite, notes, guess);
                    else
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformId, overwrite, notes, guess, 0, buildid);
                } else {
                    if (buildid == 0)
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformId, overwrite, notes, guess, bugid);
                    else
                        response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformId, overwrite, notes, guess, bugid, buildid);
                }
            }
            handleErrorMessage(response);

            //object response = proxy.reportTCResult(devkey, testcaseid, testplanid, statusChar, platformId, overwrite, notes, guess, buildid, bugid);
            //handleErrorMessage(response);
            return handleReportTCResult(response);
        }