Beispiel #1
0
 public PowerShellTestExecutorTests()
 {
     discoverer = new PowerShellTestDiscoverer(logger.Object);
     executor   = new PowerShellTestExecutor(logger.Object, () => new StopwatchTimer(), new SynchronousTaskScheduler())
     {
         OutputDirectory = new DirectoryInfo(Directory.GetCurrentDirectory())
     };
 }
 public void Init()
 {
     _executorMock    = new Mock <PowerShellTestExecutorBase>();
     _runContext      = new Mock <IRunContext>();
     _frameworkHandle = new Mock <IFrameworkHandle>();
     _test            = new PowerShellTestExecutor(new List <PowerShellTestExecutorBase> {
         _executorMock.Object
     });
 }
        public void Init()
        {
            _executor = new PowerShellTestExecutor();

            _runContext = new Mock <IRunContext>();

            _runspace = RunspaceFactory.CreateRunspace(new TestAdapterHost());
            _runspace.Open();
            _powerShell          = PowerShell.Create();
            _powerShell.Runspace = _runspace;

            _runContext.Setup(m => m.TestRunDirectory).Returns(TestContext.TestDeploymentDir);
            _runContext.Setup(m => m.SolutionDirectory).Returns(GetModuleDir(TargetPesterVersion));
        }
Beispiel #4
0
        private void DoRunCommandAsync(TestModel node)
        {
            try
            {
                if (Running)
                {
                    return;
                }
                Running = true;

                RunContext content = new RunContext(UpdateRunningTest, _codeCoverage.SelectedCoveredScripts, GetScriptFileNames());
                _executor = new PowerShellTestExecutor();

                switch (node)
                {
                case null:
                    _executor.RunTestSolution(Model, content);
                    break;

                case TestSolution testSolution:
                    _executor.RunTestSolution(testSolution, content);
                    break;

                case TestProject testProject:
                    _executor.RunTestProject(testProject, content);
                    break;

                case TestFolder testFolder:
                    _executor.RunTestFolder(testFolder, content);
                    break;

                case TestFile testFile:
                    _executor.RunTestFile(testFile, content);
                    break;

                case TestDescribe testDescribe:
                    _executor.RunTestDescribe(testDescribe, content);
                    break;

                case TestContext testContext:
                    _executor.RunTestDescribe(testContext.Parent, content);
                    break;

                case TestIt testIt:
                    _executor.RunTestDescribe(testIt.Parent.Parent, content);
                    break;

                case TestFeature testFeature:
                    _executor.RunTestFeature(testFeature, content);
                    break;

                case TestScenario testScenario:
                    _executor.RunTestScenario(testScenario, content);
                    break;
                }

                Model.CalculateOutcome();

                _codeCoverage.Merge(content.Reports, ClearCodeCoverage);

                OnModelChanged();
            }
            finally
            {
                Running     = false;
                RunningTest = "";
            }
        }