Пример #1
0
 public Options(
     string sourceFile,
     string clousotOptions,
     bool useContractReferenceAssemblies,
     bool useExe,
     string compilerOptions,
     string[] references,
     string[] libPaths,
     string compilerCode,
     TestRuns skipFor = TestRuns.None)
 {
     _outDirectory       = Environment.CurrentDirectory;
     this.SourceFile     = sourceFile;
     this.ClousotOptions = clousotOptions;
     this.UseContractReferenceAssemblies = useContractReferenceAssemblies;
     this.UseExe           = useExe;
     this._compilerOptions = compilerOptions;
     this.References       = new List <string> {
         "mscorlib.dll", "System.dll", "ClousotTestHarness.dll"
     };
     this.References.AddRange(references);
     this.LibPaths = new List <string> {
         MakeAbsolute(TestHarnessDirectory)
     };
     this.LibPaths.AddRange(libPaths);
     this._compilerCode = compilerCode;
     this.SkipFor       = skipFor;
 }
Пример #2
0
        private void FillTable()
        {
            Table1.Rows.Clear();
            TestRuns.SelectParameters["problem_id"].DefaultValue = _problemId;
            DataView  view         = (DataView)TestRuns.Select(new DataSourceSelectArguments());
            DataTable _groupsTable = view.ToTable();

            foreach (DataRow dataRow in _groupsTable.Rows)
            {
                ItemsRow itemRow = new ItemsRow(dataRow["input"].ToString(), dataRow["output"].ToString(), true);
                Table1.Rows.Add(itemRow.Row);
            }
        }
Пример #3
0
        public async Task <ProjectAggregate> GetAsync(long id, long testRunId)
        {
            var project = await GetAsync(id);

            //load data for test run to context memory
            var run = TestRuns.Include(testRun => testRun.TestCases)
                      .ThenInclude(testRunCase => testRunCase.Steps)
                      .ThenInclude(runStep => runStep.Step)
                      .Include(testRun => testRun.TestCases)
                      .ThenInclude(testRunCase => testRunCase.TestCase)
                      .Where(t => t.Id == testRunId)
                      .Single();

            return(project);
        }
Пример #4
0
        static void Main(string[] args)
        {
            // Dump the info to the console window.  Use a different LogTypes if
            // you need to dump to another logger, of create your own that complies
            // to the interface.
            UIVerifyLogger.SetLogger(LogTypes.ConsoleLogger);

            // Get the automation element you want to test
            AutomationElement element = StartApplication("NOTEPAD.EXE", null);

            // Call the UI Automation Verify tests
            TestRuns.RunAllTests(element, true, TestPriorities.Pri0, TestCaseType.Generic, false, true, null);

            // Clean up
            ((WindowPattern)element.GetCurrentPattern(WindowPattern.Pattern)).Close();

            // Dumps the summary of results
            UIVerifyLogger.ReportResults();
        }
Пример #5
0
        public TestRuns PostNewRun(QACDataModel.TestRuns run)
        {
            var client = new RestClient(conFIG.QACompleteEndPoint + "v2/projects/{projectID}/testruns");

            var request = new RestRequest(Method.POST);

            request.AddJsonBody(run);
            request.AddUrlSegment("projectID", Project);
            request.AddHeader("Authorization", Auth);
            request.AddHeader("Content-Type", "application/json");

            var    response = client.Execute(request);
            string L        = response.Content;

            TestRuns item = new TestRuns();

            item = JsonConvert.DeserializeObject <QACDataModel.TestRuns>(L);

            return(item);
        }
Пример #6
0
        public TestRuns GetTestRun(int runID)
        {
            TestRuns item = new TestRuns();

            var client = new RestClient(conFIG.QACompleteEndPoint + "v2/projects/{projectID}/testruns/{runID}");

            var request = new RestRequest(Method.GET);

            request.AddUrlSegment("projectID", Project);
            request.AddUrlSegment("runID", runID);
            request.AddQueryParameter("limit", "10");
            request.AddHeader("Authorization", Auth);

            var    response = client.Execute(request);
            string L        = response.Content;


            item = JsonConvert.DeserializeObject <QACDataModel.TestRuns>(L);

            return(item);
        }
Пример #7
0
 public Options(
     string sourceFile,
     string clousotOptions,
     bool useContractReferenceAssemblies,
     bool useExe,
     string compilerOptions,
     string[] references,
     string[] libPaths,
     string compilerCode,
     TestRuns skipFor = TestRuns.None)
 {
     _outDirectory = Environment.CurrentDirectory;
     this.SourceFile = sourceFile;
     this.ClousotOptions = clousotOptions;
     this.UseContractReferenceAssemblies = useContractReferenceAssemblies;
     this.UseExe = useExe;
     this._compilerOptions = compilerOptions;
     this.References = new List<string> { "mscorlib.dll", "System.dll", "ClousotTestHarness.dll" };
     this.References.AddRange(references);
     this.LibPaths = new List<string> { MakeAbsolute(TestHarnessDirectory) };
     this.LibPaths.AddRange(libPaths);
     this._compilerCode = compilerCode;
     this.SkipFor = skipFor;
 }
Пример #8
0
        public ActionResult StartTestRun(RunDetailsViewModel runDetails)
        {
            var regex = new Regex("^([1-9]|[1-4][0]|[1-3][0-9]|[-])$");

            if (!ModelState.IsValid)
            {
                return(View(runDetails));
            }
            if (runDetails.RunsNumber == null ||
                !regex.IsMatch(runDetails.RunsNumber))
            {
                ViewBag.ReRun = "Re-run number is invalid";
                return(View(runDetails));
            }

            if (runDetails.RunsNumber == "-")
            {
                runDetails.RunsNumber = "roc calculated";
            }

            using (var context = new Entities())
            {
                if (context.Algorithms.Where
                        (x => x.Name == runDetails.AlgorithmName).Count() == 0)
                {
                    ModelState.AddModelError("AlgorithmName",
                                             "Can't find this algorithm.");
                    return(View(runDetails));
                }
                var testSet = context.TestSets.Where
                                  (x => x.Name == runDetails.TestName);

                if (testSet.Count() == 0)
                {
                    ModelState.AddModelError("TestName",
                                             "Can't find this test set.");
                    return(View(runDetails));
                }
                else
                {
                    var date   = DateTime.Now;
                    var userId = context.Users.FirstOrDefault <Users>
                                     (x => x.UserName.ToLower() == User.Identity.Name.ToLower()).Id;
                    var testRun = new TestRuns()
                    {
                        DateOfRun   = date,
                        UserId      = userId,
                        AlgorithmId = context.Algorithms.FirstOrDefault
                                          (x => x.Name.ToLower() == runDetails.AlgorithmName).Id,
                        TestSetId = context.TestSets.FirstOrDefault
                                        (x => x.Name.ToLower() == runDetails.TestName).Id,
                        RocCurveCalc = runDetails.RocCurveRequired == "true" ? true : false,
                        Status       = "In progress",
                        RunsNumber   = runDetails.RunsNumber,
                        TrainRatio   = runDetails.Ratio.Split('/')[0]
                    };

                    context.TestRuns.Add(testRun);
                    context.SaveChanges();

                    var currentRun = context.TestRuns.Where(x => (x.UserId == userId)).OrderByDescending(x => x.Id).ToArray()[0];
                    if (currentRun != null)
                    {
                        runDetails.RunNumber = currentRun.Id;
                    }
                    else
                    {
                        return(RedirectToAction("ErrorPage", "Home"));
                    }
                }
            }

            return(RedirectToAction("UploadResultsFile", "Runs", new { runId = runDetails.RunNumber }));
        }
Пример #9
0
        /// <summary>
        /// this method performs automation test on automation element.
        /// </summary>
        public TestResults PerformTest(AutomationTest test, AutomationElement element)
        {
            try
            {
                bool result = false;
                switch (test.Type)
                {
                case TestTypes.AutomationElementTest:
                {
                    if (!this._testChildren)
                    {
                        result = TestRuns.RunAutomationElementTest(element, this._testEvents, GetTestName(test), false, null, true, GetFakeApplicationCommands());
                    }
                    else
                    {
                        result = TestRuns.RunAutomationElementTests(element, this._testEvents, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, this._testChildren, true, GetFakeApplicationCommands());
                    }
                    break;
                }

                case TestTypes.ControlTest:
                {
                    if (!this._testChildren)
                    {
                        result = TestRuns.RunControlTest(element, this._testEvents, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands());
                    }
                    else
                    {
                        result = TestRuns.RunControlTests(element, this._testEvents, this._testChildren, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands());
                    }
                    break;
                }

                case TestTypes.PatternTest:
                {
                    if (!this._testChildren)
                    {
                        result = TestRuns.RunPatternTest(element, this._testEvents, false, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands());
                    }
                    else
                    {
                        result = TestRuns.RunPatternTests(element, this._testEvents, this._testChildren, GetTestSuite(test), test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands());
                    }
                    break;
                }
                //case TestTypes.ScenarioTest:
                //    {
                //        if (!this._testChildren)
                //            result = TestRuns.RunScenarioTest(GetTestSuite(test), GetTestName(test), null, this._testEvents, GetFakeApplicationCommands());

                //        break;
                //    }
                default:
                    throw new ArgumentException("not supported test type! test.Type = " + test.Type.ToString());
                }
                return(result ? TestResults.Succeed : TestResults.Failed);
            }
            catch (Exception ex)
            {
                ApplicationLogger.LogException(ex);
                return(TestResults.UnexpectedError);
            }
        }