public void ParseTestSuite() { TestSuite testSuite; using (Stream stream = File.OpenRead(@"..\..\..\Data\Samples\TestSuite.xml")) { using (XmlTestSuiteParser parser = new XmlTestSuiteParser(stream, businessActionsRepository)) { testSuite = parser.Parse(); } } Assert.AreEqual("Banking", testSuite.TestSuiteName); Assert.AreEqual("OnlineBanking", testSuite.TestRunnerName); Assert.AreEqual("OnlineBankingNamespace", testSuite.Namespace); Assert.AreEqual(true, testSuite.IsParallelizable); Assert.AreEqual(20, testSuite.DegreeOfParallelism); Assert.AreEqual(1, testSuite.TestCasesCount); TestCase testCase = testSuite.GetTestCase("MoneyTransfer"); Assert.IsNotNull(testCase); Assert.AreEqual("MoneyTransfer", testCase.TestCaseName); Assert.AreEqual(8, testCase.TestSteps.Count); TestCaseStep testCaseStep = testCase.GetTestAction("GoToPortal"); Assert.IsNotNull(testCaseStep); Assert.AreEqual("GoToPortal", testCaseStep.ActionName); Assert.IsFalse(testCaseStep.HasParameters, "Action should NOT have parameters!"); testCaseStep = testCase.GetTestAction("SignIn"); Assert.IsNotNull(testCaseStep); Assert.AreEqual("SignIn", testCaseStep.ActionName); Assert.AreEqual(2, testCaseStep.Parameters.Count); Assert.IsTrue(testCaseStep.HasParameters, "Action should have 2 parameters!"); Assert.IsNotNull(testCaseStep.GetParameterValue("username")); Assert.AreEqual("john", testCaseStep.GetParameterValue("username")); Assert.IsNotNull(testCaseStep.GetParameterValue("password")); Assert.AreEqual("doe", testCaseStep.GetParameterValue("password")); testCaseStep = testCase.GetTestAction("EnterDestinationAccountNumber"); Assert.IsNotNull(testCaseStep); Assert.AreEqual("EnterDestinationAccountNumber", testCaseStep.ActionName); Assert.AreEqual(1, testCaseStep.Parameters.Count); Assert.IsNotNull(testCaseStep.GetParameterValue("destAccountId")); Assert.AreEqual(23677, testCaseStep.GetParameterValue("destAccountId")); testCaseStep = testCase.GetTestAction("EnterTransferAmount"); Assert.IsNotNull(testCaseStep); Assert.AreEqual("EnterTransferAmount", testCaseStep.ActionName); Assert.AreEqual(1, testCaseStep.Parameters.Count); Assert.IsNotNull(testCaseStep.GetParameterValue("transferAmount")); Assert.AreEqual(644.33m, testCaseStep.GetParameterValue("transferAmount")); }
public void TestActionForTestCaseIsNullTest() { TestCase testCase = new TestCase("TestCase"); TestCaseStep testCaseStep = testCase.GetTestAction("TestAction"); Assert.IsNull(testCaseStep); }