Esempio n. 1
0
        public async Task<IEnumerable<TestCase>> Publish(TestBuild build)
        {
            var project = build.Project;
            string srcPath = project.SrcDir;
            //looking for test files, publish them to db
            var dir = new DirectoryInfo(srcPath);
            var files = dir.GetFiles("*.feature", SearchOption.AllDirectories);
            var tests = new List<TestCase>();
            foreach (var f in files)
            {
                string text = await f.OpenText().ReadToEndAsync();
                var matches = RxTagName.Matches(text);
                foreach (Match m in matches)
                {
                    int start = m.Index < 100 ? 0 : m.Index - 100;
                    int end = m.Index + 100 > text.Length - 1 ? m.Index + 100 : text.Length - 1;
                    var t = new TestCase
                    {
                        Name = m.Groups[1].Value,
                        Location = f.FullName.Remove(0, srcPath.Length + 1)
                    };
                    var km = RxTagKeyword.Match(text.Substring(start, end - start));
                    if (km.Success)
                    {
                        t.Keyword = km.Groups[1].Value;
                    }
                    tests.Add(t);
                }
            }

            return tests;
        }
Esempio n. 2
0
 public async Task<ActionResult> Create(int testprojectId, TestBuild model, int? testagent)
 {
     model.Project = await _projRepo.FindAsync(testprojectId);
     if (testagent.HasValue)
     {
         model.Agent = await _agentRepo.FindAsync(testagent);
     }
     if (ModelState.IsValid)
     {
         _buildRepo.Add(model);
         await _uow.CommitAsync();
         return RedirectToAction("Index", new { testprojectId });
     }
     SetNav(model);
     SetViewData();
     return View("new", model);
 }
Esempio n. 3
0
 private void SetNav(TestBuild build)
 {
     ViewBag.Nav = new TestBuildNav(build);
 }