Exemplo n.º 1
0
        public int Execute(ref int testsRun, ITestLogger logger, bool isEnterprise)
        {
            int    exitStatus = 0;
            string dbPath     = CommonUtility.GetDbPath(this.DumpFile);
            string dbName     = CommonUtility.GetPath(dbPath);

            if (File.Exists(dbName))
            {
                var db = new SqliteDb();
                db.Open(dbName);

                var vm = new SqliteVm(db, true);

                int status = vm.Execute("Select TestName, TestType from TestCase where TestType=\"{0}\" order by ExecuteSequence", this.ApiType);

                //NOTE: We can't share the SqliteVm instance among our executor objects as this messes up query results
                //we must be able to re-create a new SqliteVm for each executor, so we pass down the db path
                SetupExecutors(dbName);

                while (status == Sqlite.Row)
                {
                    string testName = vm.GetString("TestName");
                    string testType = vm.GetString("TestType");

                    Console.WriteLine("Executing {0} test: {1}", testType, testName);
                    using (var run = new TestExecutionRun(dbPath, this))
                    {
                        try
                        {
                            exitStatus += run.RunTests(testName, logger, ref testsRun);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            exitStatus += 1;
                        }
                    }
                    status = vm.NextRow();
                }
                vm.SqlFinalize();
                vm = null;
                db = null;
            }
            return(exitStatus);
        }
Exemplo n.º 2
0
        public int Execute(ref int testsRun, ITestLogger logger, bool isEnterprise)
        {
            int exitStatus = 0;
            string dbPath = CommonUtility.GetDbPath(this.DumpFile);
            string dbName = CommonUtility.GetPath(dbPath);

            if (File.Exists(dbName))
            {
                var db = new SqliteDb();
                db.Open(dbName);

                var vm = new SqliteVm(db, true);

                int status = vm.Execute("Select TestName, TestType from TestCase where TestType=\"{0}\" order by ExecuteSequence", this.ApiType);

                //NOTE: We can't share the SqliteVm instance among our executor objects as this messes up query results
                //we must be able to re-create a new SqliteVm for each executor, so we pass down the db path
                SetupExecutors(dbName);

                while (status == Sqlite.Row)
                {
                    string testName = vm.GetString("TestName");
                    string testType = vm.GetString("TestType");

                    Console.WriteLine("Executing {0} test: {1}", testType, testName);
                    using (var run = new TestExecutionRun(dbPath, this))
                    {
                        try
                        {
                            exitStatus += run.RunTests(testName, logger, ref testsRun);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            exitStatus += 1;
                        }
                    }
                    status = vm.NextRow();
                }
                vm.SqlFinalize();
                vm = null;
                db = null;
            }
            return exitStatus;
        }