Example #1
0
        /// <summary>
        /// Find the appropriate Parser for the test file
        /// </summary>
        /// <param name="resultsFile"></param>
        /// <returns></returns>
        public static IParser LoadParser(string resultsFile)
        {
            if (!File.Exists(resultsFile))
            {
                logger.Error("Input file does not exist " + resultsFile);
                return(null);
            }

            string fileExtension = Path.GetExtension(resultsFile);

            if (string.IsNullOrWhiteSpace(fileExtension))
            {
                logger.Error("Input file does not have a file extension: " + resultsFile);
                return(null);
            }

            IParser fileParser = null;

            switch (TestRunnerType(resultsFile))
            {
            case TestRunner.NUnit:
                logger.Info("The file " + resultsFile + " contains NUnit test results");
                fileParser = new NUnit().LoadFile(resultsFile);
                break;

            case TestRunner.Gallio:
                logger.Info("The file " + resultsFile + " contains Gallio test results");
                fileParser = new Gallio().LoadFile(resultsFile);
                break;

            case TestRunner.MSTest2010:
                logger.Info("The file " + resultsFile + " contains MSTest 2010 test results");
                fileParser = new MsTest2010().LoadFile(resultsFile);
                break;

            case TestRunner.XUnitV1:
                logger.Info("The file " + resultsFile + " contains xUnit v1 test results");
                fileParser = new XUnitV1().LoadFile(resultsFile);
                break;

            case TestRunner.XUnitV2:
                logger.Info("The file " + resultsFile + " contains xUnit v2 test results");
                fileParser = new XUnitV2().LoadFile(resultsFile);
                break;

            case TestRunner.TestNG:
                logger.Info("The file " + resultsFile + " contains TestNG test results");
                fileParser = new TestNG().LoadFile(resultsFile);
                break;

            default:
                logger.Info("Skipping " + resultsFile + ". It is not of a known test runner type.");
                break;
            }

            return(fileParser);
        }
Example #2
0
        /// <summary>
        /// Find the appropriate Parser for the test file
        /// </summary>
        /// <param name="resultsFile"></param>
        /// <returns></returns>
        public static IParser LoadParser(string resultsFile)
        {
            if (!File.Exists(resultsFile))
            {
                Console.WriteLine("[ERROR] Input file does not exist: " + resultsFile);
                return null;
            }

            string fileExtension = Path.GetExtension(resultsFile);

            if (string.IsNullOrWhiteSpace(fileExtension))
            {
                Console.WriteLine("[ERROR] Input file does not have a file extension: " + resultsFile);
                return null;
            }

            IParser fileParser = null;

            switch (TestRunnerType(resultsFile))
            {
                case TestRunner.NUnit:
                    Console.WriteLine("[INFO] The file " + resultsFile + " contains NUnit test results");
                    fileParser = new NUnit().LoadFile(resultsFile);
                    break;
                case TestRunner.Gallio:
                    Console.WriteLine("[INFO] The file " + resultsFile + " contains Gallio test results");
                    fileParser = new Gallio().LoadFile(resultsFile);
                    break;
                case TestRunner.MSTest2010:
                    Console.WriteLine("[INFO] The file " + resultsFile + " contains MSTest 2010 test results");
                    fileParser = new MsTest2010().LoadFile(resultsFile);
                    break;
                default:
                    Console.Write("[INFO] Skipping " + resultsFile + ". It is not of a known test runner type.");
                    break;
            }

            return fileParser;
        }