Ejemplo n.º 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"));
        }
Ejemplo n.º 2
0
        private static PerDocumentLocationXTestCases GetTestToDebug(string discoveredUnitTestsStore, string discoveredUnitDTestsStore)
        {
            var discoveredUnitTests  = PerDocumentLocationXTestCases.Deserialize(FilePath.NewFilePath(discoveredUnitTestsStore));
            var discoveredUnitDTests = PerDocumentLocationDTestCases.Deserialize(FilePath.NewFilePath(discoveredUnitDTestsStore));

            var dtc = discoveredUnitDTests.Values.First().First();
            var dl  = new DocumentLocation(dtc.CodeFilePath, dtc.LineNumber);

            var testToDebug = new PerDocumentLocationXTestCases();

            testToDebug.TryAdd(dl, discoveredUnitTests[dl]);

            return(testToDebug);
        }