public void DoNotShowFailureReportByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.ShowFailureReport;

            result.Should().BeFalse();
        }
        public void AdditionalTestPathsIsEmptyByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.AdditionalTestPaths;

            result.Should().BeEmpty();
        }
        public void DoNotEnableCoverageCollectionByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.EnableCoverageCollection;

            result.Should().BeFalse();
        }
        public void MaxParallelismIsNullByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.MaxParallelism;

            result.HasValue.Should().BeFalse();
        }
        public void OutputRunningTestCountByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.OutputRunningTestCount;

            result.Should().BeTrue();
        }
        public void DoNotTraceByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.Trace;

            result.Should().BeFalse();
        }
        public void DoNotLaunchInBrowserByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.LaunchInBrowser;

            result.Should().Be(ChutzpahBrowser.None);
        }
        public void DoNotFailOnErrorByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.FailOnError;

            result.Should().BeFalse();
        }
        public void DoNotPrintDebugInfoByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.PrintDebugInfo;

            result.Should().BeFalse();
        }
        public void DoNotForceTeamCityModeByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.ForceTeamCityMode;

            result.Should().BeFalse();
        }
        public void NoLogoIsFalseByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.NoLogo;

            result.Should().BeFalse();
        }
        public void CoverageHtmlOutputFileIsNullByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.CoverageHtmlOutputFile;

            result.Should().BeNull();
        }
        public void NUnit2ResultsFileIsNullByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.NUnit2XmlResultsFile;

            result.Should().BeNull();
        }
        public void VisualStudioTrxResultsFileIsNullByDefault()
        {
            var sut    = new ChutzpahSettings();
            var result = sut.VisualStudioTrxResultsFile;

            result.Should().BeNull();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString()));
            base.Initialize();

            dte = (DTE2)GetService(typeof(DTE));
            if (dte == null)
            {
                //if dte is null then we throw a excpetion
                //this is a fatal error
                throw new ArgumentNullException("dte");
            }

            testRunner = TestRunner.Create();

            processHelper = new ProcessHelper();
            Logger        = new Logger(this);
            Settings      = GetDialogPage(typeof(ChutzpahSettings)) as ChutzpahSettings;

            statusBar      = GetService(typeof(SVsStatusbar)) as IVsStatusbar;
            runnerCallback = new ParallelRunnerCallbackAdapter(new VisualStudioRunnerCallback(dte, statusBar));


            // Add our command handlers for menu (commands must exist in the .vsct file)
            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Command - Run JS Tests
                var runJsTestsCmd    = new CommandID(GuidList.guidChutzpahCmdSet, (int)PkgCmdIDList.cmdidRunJSTests);
                var runJsTestMenuCmd = new OleMenuCommand(RunJSTestCmdCallback, runJsTestsCmd);
                runJsTestMenuCmd.BeforeQueryStatus += RunJSTestsCmdQueryStatus;
                mcs.AddCommand(runJsTestMenuCmd);

                // Command - Run JS tests in browser
                var runJsTestsInBrowserCmd    = new CommandID(GuidList.guidChutzpahCmdSet, (int)PkgCmdIDList.cmdidRunInBrowser);
                var runJsTestInBrowserMenuCmd = new OleMenuCommand(RunJSTestInBrowserCmdCallback, runJsTestsInBrowserCmd);
                runJsTestInBrowserMenuCmd.BeforeQueryStatus += RunJSTestsInBrowserCmdQueryStatus;
                mcs.AddCommand(runJsTestInBrowserMenuCmd);

                // Command - Run Code Coverage
                var runJsTestCodeCoverageCmd     = new CommandID(GuidList.guidChutzpahCmdSet, (int)PkgCmdIDList.cmdidRunCodeCoverage);
                var runJsTestCodeCoverageMenuCmd = new OleMenuCommand(RunCodeCoverageCmdCallback, runJsTestCodeCoverageCmd);
                runJsTestCodeCoverageMenuCmd.BeforeQueryStatus += RunCodeCoverageCmdQueryStatus;
                mcs.AddCommand(runJsTestCodeCoverageMenuCmd);


                var runJsTestDebuggerCmd     = new CommandID(GuidList.guidChutzpahCmdSet, (int)PkgCmdIDList.cmdidDebugTests);
                var runJsTestDebuggerMenuCmd = new OleMenuCommand(RunDebuggerCmdCallback, runJsTestDebuggerCmd);
                runJsTestDebuggerMenuCmd.BeforeQueryStatus += RunDebuggerCmdQueryStatus;
                mcs.AddCommand(runJsTestDebuggerMenuCmd);
            }


            this.solutionListener = new SolutionEventsListener(this);
            this.solutionListener.SolutionUnloaded       += OnSolutionUnloaded;
            this.solutionListener.SolutionProjectChanged += OnSolutionProjectChanged;
            this.solutionListener.StartListeningForChanges();
        }
Exemplo n.º 16
0
            public void ShouldUseEmptyCommandByDefault([Frozen] IProcess process,
                                                       [Frozen] IProcessRunner processRunner,
                                                       [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any <FilePath>()).Returns(true);

                var settings = new ChutzpahSettings();

                sut.Run(settings: settings);

                processRunner.Received(1)
                .Start(Arg.Any <FilePath>(),
                       Arg.Is <ProcessSettings>(p => p.Arguments.Render() == string.Empty));
            }
Exemplo n.º 17
0
            public void ShouldOpenInNonDefaultBrowser([Frozen] IProcess process,
                                                      [Frozen] IProcessRunner processRunner,
                                                      [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any <FilePath>()).Returns(true);

                var settings = new ChutzpahSettings
                {
                    LaunchInBrowser = ChutzpahBrowser.Chrome
                };

                sut.Run(settings: settings);

                processRunner.Received(1)
                .Start(Arg.Any <FilePath>(),
                       Arg.Is <ProcessSettings>(
                           p => p.Arguments.Render() == "/openInBrowser Chrome"));
            }
Exemplo n.º 18
0
            public void ShouldUseProvidedSettings([Frozen] IProcess process,
                                                  [Frozen] IProcessRunner processRunner,
                                                  [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any <FilePath>()).Returns(true);

                var settings = new ChutzpahSettings
                {
                    NoLogo = true,
                    EnableCoverageCollection = true,
                    FailOnError                = true,
                    ForceTeamCityMode          = true,
                    CoverageHtmlOutputFile     = @"c:\temp\Code Coverage\coverage.html",
                    LaunchInBrowser            = ChutzpahBrowser.DefaultBrowser,
                    JUnitXmlResultsFile        = "junitResults.xml",
                    LcovResultsFile            = "lcov.dat",
                    VisualStudioTrxResultsFile = "testResults.trx",
                    NUnit2XmlResultsFile       = "nunit.xml",
                    MaxParallelism             = 1,
                    OutputRunningTestCount     = false,
                    PrintDebugInfo             = true,
                    Trace               = true,
                    ShowFailureReport   = true,
                    AdditionalTestPaths = { (FilePath)"testfile.js", (DirectoryPath)"tests" }
                };

                sut.Run(settings: settings);

                processRunner.Received(1)
                .Start(Arg.Any <FilePath>(),
                       Arg.Is <ProcessSettings>(
                           p =>
                           p.Arguments.Render() ==
                           "/nologo /coverage /failOnError /teamcity /coveragehtml " +
                           "\"c:/temp/Code Coverage/coverage.html\" /openInBrowser " +
                           "/junit \"junitResults.xml\" /lcov \"lcov.dat\" /trx \"testResults.trx\" " +
                           "/nunit2 \"nunit.xml\" /parallelism 1 /silent /debug /trace " +
                           "/showFailureReport /path \"testfile.js\" /path \"tests\""));
            }
Exemplo n.º 19
0
 public void AdditionalTestPathsIsEmptyByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.AdditionalTestPaths;
     result.Should().BeEmpty();
 }
Exemplo n.º 20
0
 public void MaxParallelismIsNullByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.MaxParallelism;
     result.HasValue.Should().BeFalse();
 }
Exemplo n.º 21
0
 public void DoNotLaunchInBrowserByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.LaunchInBrowser;
     result.Should().Be(ChutzpahBrowser.None);
 }
Exemplo n.º 22
0
 public void DoNotTraceByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.Trace;
     result.Should().BeFalse();
 }
Exemplo n.º 23
0
 public void DoNotPrintDebugInfoByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.PrintDebugInfo;
     result.Should().BeFalse();
 }
Exemplo n.º 24
0
            public void ShouldUseProvidedSettings([Frozen] IProcess process,
                [Frozen] IProcessRunner processRunner,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any<FilePath>()).Returns(true);

                var settings = new ChutzpahSettings
                {
                    NoLogo = true,
                    EnableCoverageCollection = true,
                    FailOnError = true,
                    ForceTeamCityMode = true,
                    CoverageHtmlOutputFile = @"c:\temp\Code Coverage\coverage.html",
                    LaunchInBrowser = ChutzpahBrowser.DefaultBrowser,
                    JUnitXmlResultsFile = "junitResults.xml",
                    LcovResultsFile = "lcov.dat",
                    VisualStudioTrxResultsFile = "testResults.trx",
                    NUnit2XmlResultsFile = "nunit.xml",
                    MaxParallelism = 1,
                    OutputRunningTestCount = false,
                    PrintDebugInfo = true,
                    Trace = true,
                    ShowFailureReport = true,
                    AdditionalTestPaths = { (FilePath)"testfile.js", (DirectoryPath)"tests" }

                };

                sut.Run(settings: settings);

                processRunner.Received(1)
                    .Start(Arg.Any<FilePath>(),
                        Arg.Is<ProcessSettings>(
                            p =>
                                p.Arguments.Render() ==
                                "/nologo /coverage /failOnError /teamcity /coveragehtml " +
                                "\"c:/temp/Code Coverage/coverage.html\" /openInBrowser " +
                                "/junit \"junitResults.xml\" /lcov \"lcov.dat\" /trx \"testResults.trx\" " +
                                "/nunit2 \"nunit.xml\" /parallelism 1 /silent /debug /trace " +
                                "/showFailureReport /path \"testfile.js\" /path \"tests\""));
            }
Exemplo n.º 25
0
 public void DoNotShowFailureReportByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.ShowFailureReport;
     result.Should().BeFalse();
 }
Exemplo n.º 26
0
 public void NoLogoIsFalseByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.NoLogo;
     result.Should().BeFalse();
 }
Exemplo n.º 27
0
 public void CoverageHtmlOutputFileIsNullByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.CoverageHtmlOutputFile;
     result.Should().BeNull();
 }
Exemplo n.º 28
0
 public void VisualStudioTrxResultsFileIsNullByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.VisualStudioTrxResultsFile;
     result.Should().BeNull();
 }
Exemplo n.º 29
0
            public void ShouldUseEmptyCommandByDefault([Frozen] IProcess process,
                [Frozen] IProcessRunner processRunner,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any<FilePath>()).Returns(true);

                var settings = new ChutzpahSettings();

                sut.Run(settings: settings);

                processRunner.Received(1)
                    .Start(Arg.Any<FilePath>(),
                        Arg.Is<ProcessSettings>(p => p.Arguments.Render() == string.Empty));
            }
Exemplo n.º 30
0
 public void OutputRunningTestCountByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.OutputRunningTestCount;
     result.Should().BeTrue();
 }
Exemplo n.º 31
0
 public void DoNotForceTeamCityModeByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.ForceTeamCityMode;
     result.Should().BeFalse();
 }
Exemplo n.º 32
0
 public void DoNotEnableCoverageCollectionByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.EnableCoverageCollection;
     result.Should().BeFalse();
 }
Exemplo n.º 33
0
 public void DoNotFailOnErrorByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.FailOnError;
     result.Should().BeFalse();
 }
Exemplo n.º 34
0
 public void JUnitXmlResultsFileIsNullByDefault()
 {
     var sut = new ChutzpahSettings();
     var result = sut.JUnitXmlResultsFile;
     result.Should().BeNull();
 }
Exemplo n.º 35
0
            public void ShouldOpenInNonDefaultBrowser([Frozen] IProcess process,
                [Frozen] IProcessRunner processRunner,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                process.GetExitCode().Returns(0);
                fileSystem.Exist(Arg.Any<FilePath>()).Returns(true);

                var settings = new ChutzpahSettings
                {
                    LaunchInBrowser = ChutzpahBrowser.Chrome
                };

                sut.Run(settings: settings);

                processRunner.Received(1)
                    .Start(Arg.Any<FilePath>(),
                        Arg.Is<ProcessSettings>(
                            p => p.Arguments.Render() == "/openInBrowser Chrome"));
            }