Example #1
0
        private void OnBtnLoad(object sender, EventArgs e)
        {
            session?.Dispose();
            if (txtPath.Text == "")
            {
                if (OD.ShowDialog() == DialogResult.OK)
                {
                    Properties.Settings.Default["assembly_path"] = txtPath.Text = OD.FileName;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    return;
                }
            }

            try
            {
                Properties.Settings.Default["assembly_path"] = txtPath.Text;
                Properties.Settings.Default.Save();
                session = new TestSession();
                session.Load(txtPath.Text, cbEnableRegVM.Checked);
                _isLoadAssembly = true;
                LoadTest();
                UpdateBtnState();
            }
            catch (Exception ex)
            {
                MessageBox.Show("[Error:]" + ex);
            }
        }
Example #2
0
        static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Usage: ILRuntimeTestCLI path useRegister[true|false]");
                return(-1);
            }

            string      path        = args[0];
            bool        useRegister = args[1].ToLower() == "true";
            TestSession session     = new TestSession();

            session.Load(path, useRegister);
            int ignoreCnt = 0;
            int todoCnt   = 0;
            List <TestResultInfo> failedTests = new List <TestResultInfo>();

            foreach (var i in session.TestList)
            {
                i.Run(true);
                var res = i.CheckResult();
                if (res.Result == ILRuntimeTest.Test.TestResults.Failed)
                {
                    if (res.HasTodo)
                    {
                        todoCnt++;
                    }
                    else
                    {
                        failedTests.Add(res);
                    }
                }
                else if (res.Result == ILRuntimeTest.Test.TestResults.Ignored)
                {
                    ignoreCnt++;
                }

                Console.WriteLine(res.Message);
                Console.WriteLine("===============================");
            }
            Console.WriteLine("===============================");
            Console.WriteLine($"{failedTests.Count} tests failed");
            foreach (var i in failedTests)
            {
                Console.WriteLine($"Test name:{i.TestName}, Message:{i.Message}");
                Console.WriteLine("===============================");
            }
            Console.WriteLine($"Ran {session.TestList.Count} tests, {failedTests.Count} failded, {ignoreCnt} ignored, {todoCnt} todos");
            session.Dispose();
            return(failedTests.Count <= 0 ? 0 : -1);
        }