Exemplo n.º 1
0
        public UnitTestResult EvaluateUnitTest(string UUID, string UnitTest)
        {
            this.authenticate_user();

            // Get the unit test id from the database.
            int utid = this.bmw_.get_unit_test_id(UnitTest);

            // Create a new evaluator for the unit test.
            UnitTestEvaluator evaluator = new UnitTestEvaluator(new MySqlClientFactory());

            evaluator.TempPath         = Server.MapPath("~/db");
            evaluator.ConnectionString = ConfigurationManager.AppSettings["MySQL"];
            evaluator.Open();

            try
            {
                string test_datafile = String.Format("{0}/{1}.cdb",
                                                     Server.MapPath("~/db/archive"),
                                                     UUID);

                return(evaluator.Reevaluate(test_datafile, utid, true));
            }
            finally
            {
                evaluator.Close();
            }
        }
Exemplo n.º 2
0
        protected void handle_chart_unit_test(object sender, CommandEventArgs e)
        {
            if (this.master_ == null)
            {
                this.master_ = (CUTS.Master) this.Page.Master;
            }

            // Get the unit test from the argument.
            UnitTest unittest = (UnitTest)e.CommandArgument;

            // Initialize a new evaluator.
            UnitTestEvaluator evaluator = new UnitTestEvaluator(this.database_.Provider);

            evaluator.ConnectionString = this.database_.ConnectionString;
            evaluator.TempPath         = Server.MapPath("~/db/sandbox/evaluations");

            // Get the active test.
            CUTS.UUID active_test = (CUTS.UUID) this.Session["activeTest"];

            // Construct the location of the test data.
            string pathname = String.Format("~/db/sandbox/{0}.cdb",
                                            CUTS.Data.UUID.ToString(active_test));

            pathname = this.Server.MapPath(pathname);

            try
            {
                // Get the data trend from the test result.
                evaluator.Open();
                UnitTestDataTrend trend = evaluator.GetDataTrend(pathname, unittest.UnitTestId);

                // Generate the chart for the test.
                this.generate_chart(unittest, trend);

                // Show the chart and hide the test suite.
                this.trend_view_.Visible  = true;
                this.scalar_view_.Visible = false;
            }
            catch (Exception ex)
            {
                this.master_.Console.Add(ex);
            }
            finally
            {
                if (evaluator.State == ConnectionState.Open)
                {
                    evaluator.Close();
                }
            }
        }
Exemplo n.º 3
0
        protected void handle_evaluate_unit_test(object sender, CommandEventArgs e)
        {
            if (this.master_ == null)
            {
                this.master_ = (CUTS.Master) this.Page.Master;
            }

            // Get the unit test from the argument.
            UnitTest unittest = (UnitTest)e.CommandArgument;

            // Initialize a new evaluator.
            UnitTestEvaluator evaluator = new UnitTestEvaluator(this.database_.Provider);

            evaluator.ConnectionString = this.database_.ConnectionString;
            evaluator.TempPath         = Server.MapPath("~/db/sandbox/evaluations");

            // Get the active test.
            CUTS.UUID active_test = (CUTS.UUID) this.Session["activeTest"];

            // Construct the location of the test data.
            string pathname = String.Format("~/db/sandbox/{0}.cdb",
                                            CUTS.Data.UUID.ToString(active_test));

            pathname = this.Server.MapPath(pathname);

            try
            {
                // Re-evalatue the unit test
                evaluator.Open();
                unittest.Result = evaluator.Reevaluate(pathname, unittest.UnitTestId, true);
            }
            catch (Exception ex)
            {
                this.master_.Console.Add(ex);
            }
            finally
            {
                if (evaluator.State == ConnectionState.Open)
                {
                    evaluator.Close();
                }
            }
        }