예제 #1
0
        public void Start(string environment, string[] tags, string suitePath)
        {
            var startInfo = new ProcessStartInfo
            {
                RedirectStandardOutput = true,
                RedirectStandardInput  = true,
                RedirectStandardError  = true,
                CreateNoWindow         = true,
                UseShellExecute        = false,
                FileName         = @"C:\ruby193\bin\cucumber.bat",
                Arguments        = string.Format("environment={0} --tags {1} --format json", environment, string.Join(",", tags)),
                WorkingDirectory = suitePath
            };

            var process = new Process {
                StartInfo = startInfo
            };

            var outputStream = new StringBuilder();
            var errorStream  = new StringBuilder();

            process.OutputDataReceived += (sender, args) => outputStream.Append(args.Data);
            process.ErrorDataReceived  += (sender, args) => errorStream.Append(args.Data);
            process.Start();
            process.BeginOutputReadLine();
            process.WaitForExit();

            Thread.Sleep(5000);
            var reader    = new RunResultsReader();
            var raven     = new RavenClient();
            var runResult = reader.Load(outputStream.ToString());

            raven.Store(runResult);
        }
예제 #2
0
        public void Import(string testSuiteId, string path)
        {
            var reader = new GherkinFeatureReader();
            var raven  = new RavenClient();

            raven.Store(new TestLibrary()
            {
                Id   = testSuiteId,
                Path = path
            });

            ProcessTestSuite(reader, raven, path, testSuiteId);
        }
예제 #3
0
        public ActionResult Create(TestSuiteViewModel model)
        {
            var raven = new RavenClient();

            raven.Store(new TestSuite
            {
                Id      = model.Id,
                Name    = model.Name,
                Tags    = model.Tags.Split(',').Select(m => m.Trim()).ToArray(),
                Library = model.Library
            });
            return(RedirectToAction("Index"));
        }
예제 #4
0
        private static void ProcessTestSuite(GherkinFeatureReader reader, RavenClient raven, string path, string testSuiteId)
        {
            foreach (var file in Directory.GetFiles(path, "*.feature"))
            {
                var source = File.ReadAllText(file);
                var model  = reader.Read(source);
                model.TestSuiteId = testSuiteId;
                raven.Store(model);
            }

            foreach (var folder in Directory.GetDirectories(path))
            {
                ProcessTestSuite(reader, raven, folder, testSuiteId);
            }
        }
예제 #5
0
        public ActionResult Create(CreateConfigurationViewModel model)
        {
            var client = new RavenClient();

            client.Store(new Configuration
            {
                Id = model.Id
            });

            ViewBag.SuccessMessage = "Create Configuration Successful";
            var repo      = new ViewModelStore();
            var viewModel = repo.GetConfigurations();

            return(View("Index", viewModel));
        }