Exemple #1
0
 private void ChangeBtnState(TestExecutionResult resultFlag)
 {
     if (this.CheckAccess())
     {
         this.pBar.IsIndeterminate = false;
         this.pBar.Value           = 100;
         //如果通过
         if (TestExecutionResult.Complete == resultFlag)
         {
             this.pBar.IsIndeterminate = false;
             this.pBar.Value           = 100;
             System.Windows.MessageBox.Show("测试完成!", "提示", MessageBoxButton.OK);
         }
         else if (TestExecutionResult.Error == resultFlag)
         {
             this.pBar.IsIndeterminate = false;
             this.pBar.Value           = 100;
             System.Windows.MessageBox.Show("测试期间发生错误!", "提示", MessageBoxButton.OK);
         }
         else if (TestExecutionResult.Init == resultFlag)
         {
             this.pBar.Value           = 0;
             this.pBar.IsIndeterminate = true;
         }
     }
     else
     {
         this.Dispatcher.BeginInvoke(new ChangeBtnStateHandler(this.ChangeBtnState), new object[] { resultFlag });
     }
 }
 public void Save(TestExecutionResult testResult)
 {
     using (BuildManagerContext context = new BuildManagerContext())
     {
         context.TestResults.Add(testResult);
         context.SaveChanges();
     }
 }
 public void RaiseOnTestCompletion(TestExecutionResult testResult)
 {
     var local = OnTestCompletion;
     if (local != null)
     {
         local(this, new TestExecutionResultEventArgs(-1, testResult));
     }
 }
Exemple #4
0
 public override void ExecutionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult)
 {
     if (testExecutionResult.Status == FAILED)
     {
         ResultsObserved++;
         string exceptionMessage = testExecutionResult.Throwable.map(Exception.getMessage).orElse(EMPTY);
         assertThat(exceptionMessage, containsString("Fail to cleanup test directory for lockFileAndFailToDeleteDirectory"));
     }
 }
Exemple #5
0
        public TestExecutionResult Parse(TestResult test)
        {
            TestExecutionResult res = new TestExecutionResult
            {
                DateUtc  = DateTime.UtcNow,
                FullName = test.FullName
            };

            return(res);
        }
 public static TestResult ConvertToVsResult(this TestExecutionResult result, TestCase testCase)
 {
     return(new TestResult(testCase)
     {
         Duration = result.ExecutionTime,
         Outcome = result.Outcome.ToVsResultOutcome(),
         DisplayName = result.TestCase.Name,
         ErrorMessage = result.Exception?.Message,
         ErrorStackTrace = result.Exception?.StackTrace
     });
 }
        private void OutputTestMessage(TestExecutionResult result)
        {
            string m;

            m = $"##teamcity[testStarted name='{Escape(result.FullName)}']";
            Console.WriteLine(m);
            Console.Out.Flush();

            m = $"##teamcity[testFinished name='{Escape(result.FullName)}']";
            Console.WriteLine(m);
            Console.Out.Flush();
        }
Exemple #8
0
 public void OnNext(TestExecutionResult value)
 {
     try
     {
         _send(JsonConvert.SerializeObject(value, new JsonSerializerSettings {
             TypeNameHandling = TypeNameHandling.All
         }));
     }
     catch (Exception e)
     {
         NotifySocketServerException(e);
     }
 }
Exemple #9
0
        /// <summary>
        /// Executes the specified test suite.
        /// </summary>
        /// <param name="testSuite">The test suite.</param>
        /// <returns></returns>
        public TestExecutionResult Execute(ITestCase testCase)
        {
            testCase.EnsureNotNull(nameof(testCase));

            testCase.Steps.EnsureNotNull(nameof(testCase.Steps));

            var result = new TestExecutionResult
            {
                TestCaseName = testCase.Name,
                Status       = Enums.TestExecutionStatus.Successful
            };

            _reporter.NewTestCase(testCase.Name, testCase.Description);
            var activityResultSet = new List <IActivityExecutionResult>();

            foreach (var step in testCase.Steps)
            {
                string activityDescription = string.Empty;
                IActivityExecutionResult activityResult;
                try
                {
                    var activity = ActivityFactory.GetActivity(step, _reporter, _driver);
                    activityResult = activity.Execute();
                    activityResultSet.Add(activityResult);
                    if (activityResult.Status == Enums.ActivityExecutionStatus.Failed)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    result.Status = Enums.TestExecutionStatus.Failed;
                    _reporter.Exception(e);
                    break;
                }
            }

            if (activityResultSet.Any(r => r.Status == Enums.ActivityExecutionStatus.Failed))
            {
                _reporter.Fail($"{testCase.Name} failed.");
                result.Status = Enums.TestExecutionStatus.Failed;
            }
            else
            {
                _reporter.Pass($"{testCase.Name} passed.");
            }

            return(result);
        }
Exemple #10
0
        public Task <IExecutionResult> Execute(PoisonTestAggregateCommand command)
        {
            if (!IsNew)
            {
                Context.Stop(Self);
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult(ExecutionResult.Success()));
        }
Exemple #11
0
        public Task <IExecutionResult> Execute(ReceiveTestCommand command)
        {
            if (!IsNew)
            {
                Emit(new TestReceivedEvent(command.SenderAggregateId, command.TestToReceive));
                Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult(ExecutionResult.Success()));
        }
Exemple #12
0
        public Task <IExecutionResult> Execute(AddTestCommand command)
        {
            if (!IsNew)
            {
                Emit(new TestAddedEvent(command.Test));
                Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult((IExecutionResult) new SuccessTestExecutionResult(command.Metadata.SourceId)));
        }
Exemple #13
0
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            SocketClientHandler.OutputMessage("Channel reading");
            var byteBuffer = message as IByteBuffer;

            if (byteBuffer != null)
            {
                try
                {
                    string s = byteBuffer.ToString(Encoding.UTF8);

                    _log.Info($"RECEIVED RAW: {s}");
                    var obj = JsonConvert.DeserializeObject(s, new JsonSerializerSettings {
                        TypeNameHandling = TypeNameHandling.All
                    });

                    StatusMessage       statusMessage = obj as StatusMessage;
                    TestExecutionResult testResult    = obj as TestExecutionResult;

                    if (testResult != null)
                    {
                        OutputTestMessage(testResult);
                    }

                    if (statusMessage != null)
                    {
                        if (statusMessage.Message == "DONE")
                        {
                            OutputMessage("Test run complete");
                            ShutDown(0);
                        }
                        OutputStatusMessage(statusMessage);
                    }
                    else
                    {
                        OutputMessage(obj.GetType().FullName);
                    }
                }
                catch (Exception ex)
                {
                    HanldeException(ex);
                    ShutDown(1);
                }
            }
        }
Exemple #14
0
        public Task <IExecutionResult> Execute(CreateTestCommand command)
        {
            if (IsNew)
            {
                Emit(new TestCreatedEvent(command.AggregateId), new EventMetadata {
                    { "some-key", "some-value" }
                });
                Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult((IExecutionResult) new SuccessTestExecutionResult(command.Metadata.SourceId)));
        }
Exemple #15
0
        public Task <IExecutionResult> Execute(CreateAndAddTwoTestsCommand command)
        {
            if (IsNew)
            {
                var createdEvent         = new TestCreatedEvent(command.AggregateId);
                var firstTestAddedEvent  = new TestAddedEvent(command.FirstTest);
                var secondTestAddedEvent = new TestAddedEvent(command.SecondTest);
                EmitAll(createdEvent, firstTestAddedEvent, secondTestAddedEvent);
                Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult(ExecutionResult.Success()));
        }
Exemple #16
0
        public Task <IExecutionResult> Execute(AddFourTestsCommand command)
        {
            if (!IsNew)
            {
                var events = Enumerable.Range(0, 4).Select(x => new TestAddedEvent(command.Test));

                // ReSharper disable once CoVariantArrayConversion
                EmitAll(events.ToArray());
                Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult(ExecutionResult.Success()));
        }
Exemple #17
0
        public Task <IExecutionResult> Execute(GiveTestCommand command)
        {
            if (!IsNew)
            {
                if (State.TestCollection.Any(x => x.Id == command.TestToGive.Id))
                {
                    Emit(new TestSentEvent(command.TestToGive, command.ReceiverAggregateId));
                    Reply(TestExecutionResult.SucceededWith(command.Metadata.SourceId));
                }
            }
            else
            {
                TestErrors++;
                Throw(new TestedErrorEvent(TestErrors));
                ReplyFailure(TestExecutionResult.FailedWith(command.Metadata.SourceId));
            }

            return(Task.FromResult(ExecutionResult.Success()));
        }
Exemple #18
0
        private void TestResultReceived(TestResult result)
        {
            // TODO: Add the result to the database

            Console.WriteLine($"TEST RESULT : {result.FullName}");

            TestExecutionResult testExecutionResult = _parser.Parse(result);

            // Notify subscribers of the result
            _testResultMonitor.notifyNext(testExecutionResult);

            if (_expectedTests.ContainsKey(result.FullName))
            {
                _expectedTests.Remove(result.FullName);
            }

            // Check if all results have been received
            if (_expectedTests.Count == 0)
            {
                _allReceived = true; // this should be the only thread writing to that value
            }
        }
        /// <summary>
        /// Sends out a notification indicating that the test has completed.
        /// </summary>
        /// <param name="result">The test result.</param>
        /// <param name="report">The report describing the results of the test.</param>
        public override void OnTestCompleted(TestExecutionResult result, IReport report)
        {
            try
            {
                var htmlTransformer = new HtmlReportTransformer();
                htmlTransformer.Transform(report, CopyStream);
            }
            catch (Exception)
            {
                // Just continue with processing
            }

            try
            {
                var xmlTransformer = new XmlReportTransformer();
                xmlTransformer.Transform(report, CopyStream);
            }
            catch (Exception)
            {
                // Just continue with processing
            }
        }
 /// <summary>
 /// Sends out a notification indicating that the test has completed.
 /// </summary>
 /// <param name="result">The test result.</param>
 /// <param name="report">The report describing the results of the test.</param>
 public abstract void OnTestCompleted(TestExecutionResult result, IReport report);
 public ExecutionResultSteps(TestExecutionResult testExecutionResult, HooksDriver hooksDriver)
 {
     this.testExecutionResult = testExecutionResult;
     this.hooksDriver         = hooksDriver;
 }
Exemple #22
0
 public ExecutionResultSteps(TestExecutionResult testExecutionResult)
 {
     this.testExecutionResult = testExecutionResult;
 }
Exemple #23
0
 public void Init()
 {
     _executionResult = new TestExecutionResult(new Mock <IFaultlessExecutionService>());
 }
Exemple #24
0
 public ConfigurationSteps(TestExecutionResult testExecutionResult)
 {
     _testExecutionResult = testExecutionResult;
 }
Exemple #25
0
        public void AutoRun(SystemHardware inSys, Test_Paramter testParam, out TestExecutionResult outTestExecuteResultFlag)
        {
            try
            {
                outTestExecuteResultFlag = TestExecutionResult.Init;
                if (CurCtrlDut == null)
                {
                    MessageBox.Show("被测件没有连接!");
                    outTestExecuteResultFlag = TestExecutionResult.Error;
                    return;
                }
                else
                {
                    //需要获取测试项内容
                    //初始化结果
                    this.m_CurResult           = new Test_Result(testParam);
                    m_CurResult.TestParam      = testParam;
                    m_CurResult.TestResultList = new List <TestResultByFreq>();

                    //inSys.SpectrumAnalyzer.Preset();
                    int freqN = (int)Math.Floor(1 + (testParam.SGAndPxaParamter.StopFreq - testParam.SGAndPxaParamter.StartFreq) / testParam.SGAndPxaParamter.FreqSpac);
                    TestStructParameters inParam = new TestStructParameters();
                    inParam = Get_testParam(testParam);
                    List <TestResultByFreq> resultList = new List <TestResultByFreq>();
                    List <double>           freqList   = new List <double>();

                    CurCtrlDut.SETChannel(testParam.ChannelNumber);
                    //todo

                    //
                    for (int i = 0; i < freqN; i++)
                    {
                        freqList.Add(testParam.SGAndPxaParamter.StartFreq + i * testParam.SGAndPxaParamter.FreqSpac);
                    }

                    if (testParam.isTxWork)//是否是发射
                    {
                        CurCtrlDut.CtrlTWork();
                        Thread.Sleep((int)(testParam.sleepTime * 1000));
                    }
                    else
                    {
                        CurCtrlDut.CtrlRWork();
                        Thread.Sleep((int)(testParam.sleepTime * 1000));
                    }

                    if (testParam.IsPowerTest || testParam.IsClutterTest)
                    {
                        for (int i = 0; i < freqN; i++)
                        {
                            if (stopRun)
                            {
                                if (MessageBoxResult.Yes == MessageBox.Show("测试强行停止,是否停止?", "提 示", MessageBoxButton.YesNo))
                                {
                                    outTestExecuteResultFlag = TestExecutionResult.Error;
                                    return;
                                }
                            }
                            if (i == 0)
                            {
                                inParam.m_FirstTest = true;
                                inParam.m_LastTest  = false;
                            }
                            else
                            {
                                inParam.m_FirstTest = false;
                            }
                            if (i == freqN - 1)
                            {
                                inParam.m_LastTest = true;
                            }
                            if (testParam.isTxWork)//是否是发射
                            {
                                inParam.m_SGFreq = testParam.DUTOutFreq;
                                inParam.m_SAFreq = freqList[i];

                                Thread.Sleep((int)(testParam.sleepTime * 1000));
                            }
                            else
                            {
                                inParam.m_SAFreq = testParam.DUTOutFreq;
                                inParam.m_SGFreq = freqList[i];
                            }
                            //设置本振频率
                            CurCtrlDut.CtrlFreq(freqList[i]);
                            Thread.Sleep((int)(testParam.sleepTime * 1000));

                            TestStructResults rest      = new TestStructResults();
                            TestResultByFreq  oneResult = new TestResultByFreq();
                            inParam.m_SGOffsetValue = this.GetOFFset(inParam.m_SGFreq, testParam.InputFileoffst);
                            double outputloss = this.GetOFFset(inParam.m_SAFreq, testParam.OutputFileoffst);
                            double inputloss  = this.GetOFFset(inParam.m_SAFreq, testParam.InputFileoffst);
                            inParam.m_SAGlobalOffset = outputloss - inputloss;


                            this.ExecuteTestSpurious(inSys, inParam, out rest);
                            oneResult.TestFreq = freqList[i];

                            oneResult.MaxClutter       = rest.m_NOSourcePower;
                            oneResult.OutPower         = rest.m_CarrierPower;
                            oneResult.ClutterRejection = rest.m_SpuriousSuppression;
                            oneResult.Gain             = rest.m_CarrierPower - inParam.m_InputPower;
                            resultList.Add(oneResult);
                        }
                    }

                    CurResult.TestResultList = resultList;
                    outTestExecuteResultFlag = TestExecutionResult.Complete;
                }
                outTestExecuteResultFlag = TestExecutionResult.Complete;
            }
            catch (Exception ex)
            {
                outTestExecuteResultFlag = TestExecutionResult.Error;
                throw new Exception(ex.ToString());
            }
            finally
            {
                GC.Collect();
            }
        }
Exemple #26
0
        public void OnNext(TestExecutionResult value)
        {
            string testResult = value.Passed ? "PASSED" : "FAILED";

            Console.WriteLine($"Observer: [{testResult}] {value.FullName}");
        }
 private void CompleteTest(int test, TestExecutionResult result)
 {
     RaiseOnTestCompletion(test, result);
 }
 private void RaiseOnTestCompletion(int id, TestExecutionResult result)
 {
     var local = OnTestCompletion;
     if (local != null)
     {
         local(this, new TestExecutionResultEventArgs(id, result));
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TestExecutionResultEventArgs"/> class.
 /// </summary>
 /// <param name="id">The ID of the test.</param>
 /// <param name="result">The status result of the test execution.</param>
 public TestExecutionResultEventArgs(int id, TestExecutionResult result)
 {
     m_Id = id;
     m_Result = result;
 }
Exemple #30
0
        public void OnNext(TestExecutionResult value)
        {
            string testResult = value.Passed ? "PASSED" : "FAILED";

            _log.Info($"Observer: [{testResult}] {value.FullName}");
        }