Пример #1
0
        private static RunStepResult DiscoverUnitTests(IRunExecutorHost host, RunStartParams rsp, RunStepInfo rsi)
        {
            if (!host.CanContinue())
            {
                throw new OperationCanceledException();
            }

            var output = RunTestHost("discover", rsp);

            RunStepStatus rss = RunStepStatus.Succeeded;

            if (output.Item1 != 0)
            {
                rss = RunStepStatus.Failed;
            }

            var testsPerAssembly = PerDocumentLocationDTestCases.Deserialize(FilePath.NewFilePath(rsp.DataFiles.DiscoveredUnitDTestsStore.Item));

            var totalTests = testsPerAssembly.Values.Aggregate(0, (acc, e) => acc + e.Count);

            TelemetryClient.TrackEvent(rsi.name.Item, new Dictionary <string, string>(), new Dictionary <string, double> {
                { "TestCount", totalTests }
            });

            return(rss.ToRSR(RunData.NewTestCases(testsPerAssembly), "Unit Tests Discovered - which ones - TBD"));
        }
Пример #2
0
        private static RunStepResult RunTests(IRunExecutorHost host, RunStartParams rsp, RunStepInfo rsi)
        {
            if (!host.CanContinue())
            {
                throw new OperationCanceledException();
            }

            var output = RunTestHost("execute", rsp);

            RunStepStatus rss = RunStepStatus.Succeeded;

            if (output.Item1 != 0)
            {
                rss = RunStepStatus.Failed;
            }

            var testResults     = PerTestIdDResults.Deserialize(FilePath.NewFilePath(rsp.DataFiles.TestResultsStore.Item));
            var coverageSession = PerSequencePointIdTestRunId.Deserialize(FilePath.NewFilePath(rsp.DataFiles.CoverageSessionStore.Item));
            var testFailureInfo = PerDocumentLocationTestFailureInfo.Deserialize(FilePath.NewFilePath(rsp.DataFiles.TestFailureInfoStore.Item));

            return(rss.ToRSR(RunData.NewTestRunOutput(testResults, testFailureInfo, coverageSession), output.Item2));
        }
Пример #3
0
        private static RunStepResult BuildSolutionSnapshot(IRunExecutorHost host, RunStartParams rsp, RunStepInfo rsi)
        {
            var output = ExecuteProcess(
                Path.Combine(
                    Environment.GetEnvironmentVariable("ProgramFiles(x86)"),
                    string.Format(@"MSBuild\{0}\Bin\msbuild.exe", host.HostVersion)),
                string.Format(
                    @"/m /v:minimal /p:DebugSymbols=true /p:DebugType=full /p:Optimize=false /p:Configuration=Debug /p:CreateVsixContainer=false /p:DeployExtension=false /p:CopyVsixExtensionFiles=false /p:RunCodeAnalysis=false {0} /p:OutDir=""{1}\\"" ""{2}""",
                    string.Join(" ", (rsp.Config.AdditionalMSBuildProperties ?? new string[0]).Select(it => string.Format("/p:{0}", it))),
                    rsp.Solution.BuildRoot.Item,
                    rsp.Solution.SnapshotPath.Item)
                );

            RunStepStatus rss = RunStepStatus.Succeeded;

            if (output.Item1 != 0)
            {
                rss = RunStepStatus.Failed;
            }

            return(rss.ToRSR(RunData.NoData, output.Item2));
        }