Beispiel #1
0
        public int SetTrackId(string trackId)
        {
            if (trackId.Length != 10)
            {
                throw new MQSException(TestCoreMessages.ParseMessages(TestCoreMessages.INVALID_TRACKID_FORMAT));
            }

            this.trackId      = trackId;
            logResult.TrackId = this.trackId;
            return(TestCoreMessages.SUCCESS);
        }
        public string GetValueConfiguration(string session, string property)
        {
            string config = data[session][property];

            if (config == null)
            {
                throw new Exception(TestCoreMessages.ParseMessages(TestCoreMessages.CONFIG_FILE_PARAMETER_NOT_FOUND));
            }

            return(config);
        }
Beispiel #3
0
        private static void isClosedJig(TestCoreRunner runner)
        {
            if (!runner.tcc.Jig.IsJigClosed())
            {
                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, TestCoreMessages.ParseMessages(TestCoreMessages.JIG_NOT_CLOSED));

                while (!runner.tcc.Jig.IsJigClosed())
                {
                    Thread.Sleep(1000);
                    runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, ". ");
                }

                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.WARNING, TestCoreMessages.ParseMessages(TestCoreMessages.JIG_CLOSED));
            }
        }
Beispiel #4
0
        public void readSambaModInfoFile(string pathOfFile)
        {
            string       line;
            StreamReader file = null;

            dicSambaModInfo.Clear();

            try
            {
                file = new StreamReader(@pathOfFile);

                while ((line = file.ReadLine()) != null)
                {
                    if (line.Equals(""))
                    {
                        continue;
                    }

                    if (line.Contains(TEST_AMPS))
                    {
                        if (line.Contains(AMPS_HISTORY))
                        {
                            string[] ts = line.Split(' ');
                            dicSambaModInfo.Add(ts[1], ts[0]);
                            return;
                        }

                        string[] testResult = line.Split(' ');
                        dicSambaModInfo.Add(testResult[1], testResult[0]);

                        continue;
                    }

                    string[] substring = line.Split(':');
                    dicSambaModInfo.Add(substring[0], substring[1]);
                }
            }
            catch (Exception)
            {
                throw new ModException(TestCoreMessages.ParseMessages(TestCoreMessages.FILE_NOT_FOUND));
            }
            finally
            {
                file.Close();
            }
        }
Beispiel #5
0
        public MQS()
        {
            logResult       = new BzLogResult();
            strErrorMessage = new StringBuilder(256);
            strErrorMessage.Insert(0, TestCoreMessages.ParseMessages(TestCoreMessages.FAIL_INITIALIZE_BZ_EQUIPAMENTS));

            int retCode = -1;

            retCode = logResult.LoadLogResult(strErrorMessage.ToString());

            if (retCode != TestCoreMessages.SUCCESS)
            {
                CheckReturn(retCode);
            }

            retCode = logResult.StartLogResult(strErrorMessage.ToString());

            if (retCode != TestCoreMessages.SUCCESS)
            {
                CheckReturn(retCode);
            }
        }
Beispiel #6
0
        private static void run(List <TestCaseBase> testCases, TestCoreRunner runner)
        {
            bool hasFailTests = false;

            runner.tcc.Andon.SetState(Domain.Andon.State.OFF);

            try
            {
                //AdbManager.installSambaAppIfNeeded(runner.PrintModInfo);
                //runner.tcc.Mod.GetModInfo(runner.PrintModInfo);

                //Check if have match ModTrackId with scanned trackId.
                if (!runner.modTrackId.Equals(runner.trackId))
                {
                    //runner.tcc.runTest = false;
                    //throw new Exception("No match ModTrackId with scanned trackId.");
                }
            }
            catch (Exception ex)
            {
                runner.tcc.Andon.SetState(Domain.Andon.State.FAIL);
                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, ex.Message);
                hasFailTests = true;
                runner.tcc.SetLogNameTo(hasFailTests ? "FAIL" : "PASS");

                TestCaseBase.SaveTestResultListToFile(runner.tcc.newLogFileLocation);

                return;
            }

            TestCaseBase.TestResultList.Clear();

            int    totalTestCases = (testCases.Count) * 3; // *3 because we have Prepare, Execute and Evaluate Results
            double percentByTest  = 100 / totalTestCases;
            double currentPercent = 0;

            foreach (TestCaseBase item in testCases)
            {
                isClosedJig(runner);

                if (!runner.tcc.runTest)
                {
                    runner.tcc.Andon.SetState(Domain.Andon.State.FAIL);
                    hasFailTests = true;
                    runner.tcc.SetLogNameTo("CANCELED");
                    TestCaseBase.SaveTestResultListToFile(runner.tcc.newLogFileLocation);
                    return;
                }

                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.WARNING, "==================================================\n");

                int result = -1;

                //Preparing...
                currentPercent = currentPercent + percentByTest;
                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.UPDATE_TEST_PERCENTUAL, (string.Format("{0:0}", (currentPercent))));
                if (!TryExecute(item.Prepare, item.Timeout, out result))
                {
                    runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, TestCoreMessages.ParseMessages(TestCoreMessages.REACHED_TIMEOUT) + " => " + item.Timeout + " ms.");
                }
                if (result != TestCoreMessages.SUCCESS)
                {
                    hasFailTests = true;
                    continue;
                }

                //Executing...
                currentPercent = currentPercent + percentByTest;
                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.UPDATE_TEST_PERCENTUAL, (string.Format("{0:0}", (currentPercent))));
                if (!TryExecute(item.Execute, item.Timeout, out result))
                {
                    runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, TestCoreMessages.ParseMessages(TestCoreMessages.REACHED_TIMEOUT) + " => " + item.Timeout + " ms.");
                }
                if (result != TestCoreMessages.SUCCESS)
                {
                    hasFailTests = true;
                    continue;
                }

                //Evaluating...
                currentPercent = currentPercent + percentByTest;
                runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.UPDATE_TEST_PERCENTUAL, (string.Format("{0:0}", (currentPercent))));
                if (!TryExecute(item.EvaluateResults, item.Timeout, out result))
                {
                    runner.tcc.NotifyUI(TestCoreMessages.TypeMessage.ERROR, TestCoreMessages.ParseMessages(TestCoreMessages.REACHED_TIMEOUT) + " => " + item.Timeout + " ms.");
                }
                if (result != TestCoreMessages.SUCCESS)
                {
                    hasFailTests = true;
                    continue;
                }

                //Set andon state
                if (item.ResulTest == TestCaseBase.TestEvaluateResult.PASS)
                {
                    runner.tcc.Andon.SetState(Domain.Andon.State.PASS);
                }
                else
                {
                    runner.tcc.Andon.SetState(Domain.Andon.State.FAIL);
                    hasFailTests = true;
                }
            }

            //Change log name and save it.
            runner.tcc.SetLogNameTo(hasFailTests ? "FAIL" : "PASS");
            TestCaseBase.SaveTestResultListToFile(runner.tcc.newLogFileLocation);

            //Execute LogResult
            if (Boolean.Parse(runner.tcc.GetValueConfiguration("SETTINGS", "LOG_RESULT_ENABLE").ToLower()))
            {
                runner.tcc.MQS.LogResult(hasFailTests ? "FAIL" : "PASS");
            }
        }