示例#1
0
        public TestCase GetCachedTestCase(string id)
        {
            if (_vsTestCaseMap.ContainsKey(id))
            {
                return(_vsTestCaseMap[id]);
            }

            _logger.Warning("Test " + id + " not found in cache");
            return(null);
        }
示例#2
0
        public T GetService <T>()
            where T : class
        {
            var service = TestEngine.Services.GetService <T>();

            if (service == null)
            {
                logger.Warning($"Engine GetService can't create service {typeof(T)}.");
            }
            return(service);
        }
        private void MapTestCategory(string vsTestCategoryType)
        {
            if (vsTestCategoryType == null)
            {
                return;
            }
            var ok = TryParse.EnumTryParse(vsTestCategoryType, out VsTestCategoryType result);

            if (ok)
            {
                VsTestCategoryType = result;
            }
            else
            {
                _logger.Warning($"Invalid value ({vsTestCategoryType}) for VsTestCategoryType, should be either NUnit or MsTest");
            }
        }
        public GTestRunOutputParser(ITestSuite testSuite, ITestLogger logger)
        {
            _expectedTests = new Dictionary<string, ITest>();
            foreach (var testCase in testSuite.TestCases)
            {
                foreach (var test in testCase.Tests)
                {
                    var runName = GTestNameFormatter.GetRunName(test);
                    if (!_expectedTests.ContainsKey(runName))
                    {
                        _expectedTests.Add(GTestNameFormatter.GetRunName(test), test);
                    }
                    else
                    {
                        logger.Warning(string.Format("Seem to have multiple test cases with the same name... Skipping {0}", runName));
                    }
                }
            }

            _currentTestRun = new StringBuilder();
            _logger = logger;
        }