Ejemplo n.º 1
0
        private IEnumerable <FeatureTestResult> ParseTestResults()
        {
            if (TestResultsFile == null)
            {
                Log.LogMessage("No testresults file has been provided, continuing without test results...");
                return(Enumerable.Empty <FeatureTestResult>());
            }

            ITestResultParser parser = GetTestResultParser(TestEngine);

            Log.LogMessage("Testresult has been configured to be {0}, available results will be published.", TestEngine);
            return(parser.Parse(TestResultsFile.ItemSpec));
        }
        public void TestSuccessScenariosWithBasicAssertions(string testCase, bool assertFailedCount = true, bool assertPassedCount = true, bool assertSkippedCount = true)
        {
            int indexOfTestRun     = 0;
            int lastTestRunId      = 0;
            var resultFileContents = File.ReadAllLines($"{testCase}Result.txt");

            TestRunManagerMock.Setup(x => x.PublishAsync(It.IsAny <TestRun>())).Callback <TestRun>(testRun =>
            {
                ValidateTestRun(testRun, resultFileContents, indexOfTestRun++, lastTestRunId, assertFailedCount, assertPassedCount, assertSkippedCount);
                lastTestRunId = testRun.TestRunId;
            });

            var inputLines = GetLines(testCase).ToList();

            foreach (var line in inputLines)
            {
                Parser.Parse(line);
            }

            TestRunManagerMock.Verify(x => x.PublishAsync(It.IsAny <TestRun>()), Times.Exactly(Math.Max(1, resultFileContents.Length / 5)), $"Expected {Math.Max(1, resultFileContents.Length / 5)} test runs.");

            ValidatePerf(inputLines.Count, IsPythonParser)
            ;
        }