示例#1
0
文件: TestSuite.cs 项目: kalyon/NBi
        public IEnumerable <TestCaseData> GetTestCases()
        {
            //Find configuration of NBi
            if (ConfigurationFinder != null)
            {
                var config = ConfigurationFinder.Find();
                ApplyConfig(config);
            }
            else
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceError, string.Format("No configuration-finder found."));
            }


            //Find connection strings referecned from an external file
            if (ConnectionStringsFinder != null)
            {
                TestSuiteManager.ConnectionStrings = ConnectionStringsFinder.Find();
            }

            //Build the Test suite
            var testSuiteFilename = TestSuiteFinder.Find();

            TestSuiteManager.Load(testSuiteFilename, SettingsFilename, AllowDtdProcessing);

            return(BuildTestCases());
        }
示例#2
0
文件: TestSuite.cs 项目: jansaris/NBi
 public TestSuite()
 {
     TestSuiteManager = new XmlManager();
     TestSuiteFinder = new TestSuiteFinder();
     ConnectionStringsFinder = new ConnectionStringsFinder();
     ConfigurationFinder = new ConfigurationFinder();
 }
示例#3
0
 public TestSuite()
 {
     TestSuiteManager        = new XmlManager();
     TestSuiteFinder         = new TestSuiteFinder();
     ConnectionStringsFinder = new ConnectionStringsFinder();
     ConfigurationFinder     = new ConfigurationFinder();
 }
示例#4
0
        public virtual void ExecuteTestCases(TestXml test)
        {
            if (ConfigurationFinder != null)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceError, string.Format("Loading configuration"));
                var config = ConfigurationFinder.Find();
                ApplyConfig(config);
            }
            else
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceError, $"No configuration-finder found.");
            }

            Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, $"Test loaded by {GetOwnFilename()}");
            Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"Test defined in {TestSuiteFinder.Find()}");
            Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"{Variables.Count()} variables defined, {Variables.Count(x => x.Value.IsEvaluated())} already evaluated.");

            //check if ignore is set to true
            if (test.IsNotImplemented)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"Test not-implemented, will be ignored. Reason is '{test.NotImplemented.Reason}'");
                Assert.Ignore(test.IgnoreReason);
            }
            else if (test.Ignore)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"Test ignored. Reason is '{test.IgnoreReason}'");
                Assert.Ignore(test.IgnoreReason);
            }
            else
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"Running test '{test.Name}' #{test.UniqueIdentifier}");
                ExecuteChecks(test.Condition);
                ExecuteSetup(test.Setup);
                foreach (var tc in test.Systems)
                {
                    foreach (var ctr in test.Constraints)
                    {
                        var factory  = new TestCaseFactory(Configuration, Variables);
                        var testCase = factory.Instantiate(tc, ctr);
                        try
                        {
                            AssertTestCase(testCase.SystemUnderTest, testCase.Constraint, test.Content);
                        }
                        catch
                        {
                            ExecuteCleanup(test.Cleanup);
                            throw;
                        }
                    }
                }
                ExecuteCleanup(test.Cleanup);
            }
        }
示例#5
0
文件: TestSuite.cs 项目: zyh329/nbi
        public IEnumerable <TestCaseData> GetTestCases()
        {
            //Find configuration of NBi
            if (ConfigurationFinder != null)
            {
                ApplyConfig(ConfigurationFinder.Find());
            }

            //Find connection strings referecned from an external file
            if (ConnectionStringsFinder != null)
            {
                TestSuiteManager.ConnectionStrings = ConnectionStringsFinder.Find();
            }

            //Build the Test suite
            var testSuiteFilename = TestSuiteFinder.Find();

            TestSuiteManager.Load(testSuiteFilename, SettingsFilename, AllowDtdProcessing);

            return(BuildTestCases());
        }
示例#6
0
        public IEnumerable <TestCaseData> GetTestCases()
        {
            Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceInfo, $"GetTestCases() has been called");
            //Find configuration of NBi
            if (ConfigurationFinder != null)
            {
                var config = ConfigurationFinder.Find();
                ApplyConfig(config);
            }
            else
            {
                Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceError, string.Format("No configuration-finder found."));
            }


            //Find connection strings referecned from an external file
            if (ConnectionStringsFinder != null)
            {
                TestSuiteManager.ConnectionStrings = ConnectionStringsFinder.Find();
            }

            //Service Locator
            if (serviceLocator == null)
            {
                Initialize();
            }

            //Build the Test suite
            var testSuiteFilename = TestSuiteFinder.Find();

            TestSuiteManager.Load(testSuiteFilename, SettingsFilename, AllowDtdProcessing);

            //Build the variables
            Variables = BuildVariables(TestSuiteManager.TestSuite.Variables);

            return(BuildTestCases());
        }
示例#7
0
文件: TestSuite.cs 项目: jansaris/NBi
 internal TestSuite(XmlManager testSuiteManager, TestSuiteFinder testSuiteFinder)
 {
     TestSuiteManager = testSuiteManager;
     TestSuiteFinder = testSuiteFinder;
 }
示例#8
0
 internal TestSuite(XmlManager testSuiteManager, TestSuiteFinder testSuiteFinder)
 {
     TestSuiteManager = testSuiteManager;
     TestSuiteFinder  = testSuiteFinder;
 }
示例#9
0
文件: TestSuite.cs 项目: kalyon/NBi
        public virtual void ExecuteTestCases(TestXml test)
        {
            if (ConfigurationFinder != null)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceError, string.Format("Loading configuration"));
                var config = ConfigurationFinder.Find();
                ApplyConfig(config);
            }
            else
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceError, string.Format("No configuration-finder found."));
            }

            Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, string.Format("Test loaded by {0}", GetOwnFilename()));
            Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, string.Format("Test defined in {0}", TestSuiteFinder.Find()));

            //check if ignore is set to true
            if (test.Ignore)
            {
                Assert.Ignore(test.IgnoreReason);
            }
            else
            {
                ExecuteChecks(test.Condition);
                ExecuteSetup(test.Setup);
                foreach (var tc in test.Systems)
                {
                    foreach (var ctr in test.Constraints)
                    {
                        var factory  = new TestCaseFactory(Configuration);
                        var testCase = factory.Instantiate(tc, ctr);
                        try
                        {
                            AssertTestCase(testCase.SystemUnderTest, testCase.Constraint, test.Content);
                        }
                        catch
                        {
                            ExecuteCleanup(test.Cleanup);
                            throw;
                        }
                    }
                }
                ExecuteCleanup(test.Cleanup);
            }
        }
示例#10
0
文件: TestSuite.cs 项目: zyh329/nbi
        public virtual void ExecuteTestCases(TestXml test)
        {
            Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, string.Format("Test loaded by {0}", GetOwnFilename()));
            Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, string.Format("Test defined in {0}", TestSuiteFinder.Find()));

            //check if ignore is set to true
            if (test.Ignore)
            {
                Assert.Ignore(test.IgnoreReason);
            }
            else
            {
                ExecuteChecks(test.Condition);
                ExecuteSetup(test.Setup);
                foreach (var tc in test.Systems)
                {
                    foreach (var ctr in test.Constraints)
                    {
                        var testCase = new TestCaseFactory().Instantiate(tc, ctr);
                        AssertTestCase(testCase.SystemUnderTest, testCase.Constraint, test.Content);
                    }
                }
                ExecuteCleanup(test.Cleanup);
            }
        }