private void SetCorrectTrendReportID()
        {
            PCErrorResponse pcErrorResponse = new PCErrorResponse("", 0);

            try
            {
                // If the user selected "Use trend report associated with the test" we want the report ID to be the one from the test
                string msg = "No trend report ID is associated with the test.\n" +
                             "Please turn Automatic Trending on for the test through LoadRunner Enterprise UI.\n" +
                             "Alternatively you can check 'Add run to trend report with ID' on Jenkins job configuration.";
                if (_pcModel.AddRunToTrendReport.Equals("AssociatedTrend"))
                {
                    PCTest pcTest = _pcRestProxy.GetTestData(int.Parse(_pcModel.TestId), ref pcErrorResponse);
                    if (pcTest.ReportId > -1)
                    {
                        _pcModel.TrendReportId = pcTest.ReportId.ToString();
                    }
                    else
                    {
                        _fileLog.Write(LogMessageType.Error, string.Format("SetCorrectTrendReportID failed, reason: {0}", msg));
                        //throw new PcException(msg);
                    }
                }
            }
            catch (Exception ex)
            {
                _fileLog.Write(LogMessageType.Error, string.Format("SetCorrectTrendReportID failed, reason: {0}", ex));
                if (pcErrorResponse.ErrorCode > 0)
                {
                    _fileLog.Write(LogMessageType.Error, string.Format("SetCorrectTrendReportID failed, ExceptionMessage: {0}, ErrorCode: {1}", pcErrorResponse.ExceptionMessage, pcErrorResponse.ErrorCode));
                }
            }
        }
        private bool TestExist(int testID, ref PCErrorResponse pcErrorResponse)
        {
            PCTest pcTest = _pcRestProxy.GetTest(testID, ref pcErrorResponse);

            if (pcTest == null)
            {
                return(false);
            }
            return(true);
        }
Exemple #3
0
        private void btnTestData_Click(object sender, EventArgs e)
        {
            PCTest pcTest = pcRestProxy.GetTestData(int.Parse(txtTestID.Text));

            if (pcTest != null)
            {
                List <PCTest> pcTestList = new List <PCTest>();
                pcTestList.Add(pcTest);
                dgvForAll.DataSource  = pcTestList;
                btnTestData.Text      = "TestData received";
                btnTestData.BackColor = Color.Green;
            }
            else
            {
                btnTestData.Text      = "TestData not received";
                btnTestData.BackColor = Color.Red;
            }
        }
        public string GetTestName()
        {
            PCErrorResponse pcErrorResponse = new PCErrorResponse("", 0);

            try
            {
                PCTest pcTest = _pcRestProxy.GetTestData(int.Parse(_pcModel.TestId), ref pcErrorResponse);
                return(pcTest.Name);
            }
            catch (Exception e)
            {
                _fileLog.Write(LogMessageType.Error, string.Format("getTestName failed, reason: {0}", e.Message));
                if (pcErrorResponse.ErrorCode > 0)
                {
                    _fileLog.Write(LogMessageType.Error, string.Format("GetTestName failed, ExceptionMessage: {0}, ErrorCode: {1}", pcErrorResponse.ExceptionMessage, pcErrorResponse.ErrorCode));
                }
                return("");
            }
        }