public void TestCenter_TestAction_ShouldCreateHeadingForSharedSteps() { var testCaseWrapper = new TfsTestCase(_testCase); var testCaseDetail = new TfsTestCaseDetail(testCaseWrapper, true); Assert.AreEqual("3.0", testCaseDetail.PropertyValue("Actions[2].StepNumber", x => x)); }
public void TestCenter_TestCase_WorkItemFieldsShouldBeAccessible() { // arrange var testCases = _testManagement.TestCases.Query("SELECT * FROM WorkItems"); var microsoftTestCase = testCases.FirstOrDefault(testCase => testCase.Id == CommonConfiguration.TestCase_1_1_1_Id); var tfsTestCase = new TfsTestCase(microsoftTestCase); // act var tfsTestCaseDetail = new TfsTestCaseDetail(tfsTestCase); // assert // ReSharper disable once PossibleNullReferenceException Assert.AreEqual( microsoftTestCase.Id.ToString(), tfsTestCaseDetail.PropertyValue("WorkItem.Id", _testAdapter.ExpandEnumerable), "WorkItem.Id incorrect."); Assert.AreEqual( microsoftTestCase.Title, tfsTestCaseDetail.PropertyValue("WorkItem.Title", _testAdapter.ExpandEnumerable), "WorkItem.Title incorrect."); Assert.AreEqual( microsoftTestCase.Revision.ToString(), tfsTestCaseDetail.PropertyValue("WorkItem.Rev", _testAdapter.ExpandEnumerable), "WorkItem.Rev incorrect."); }
private static void InitializeTestPlanStructure() { var testPlan = testPlans.FirstOrDefault(x => x.Id == CommonConfiguration.TestPlan_1_Id); var testSuite_1_1 = testSuites.FirstOrDefault(x => x.Id == CommonConfiguration.TestSuite_1_1_TestSuiteId); var testSuite_1_2_1 = testSuites.FirstOrDefault(x => x.Id == CommonConfiguration.TestSuite_1_2_1TestSuiteId); var testCaseInAllTestSuitesAndPlans = testCases.FirstOrDefault(x => x.Id == CommonConfiguration.TestCase_InAllSuitesAndPlans_Id); var testCaseOnlyInSuite1_2_1 = testCases.FirstOrDefault(x => x.Id == CommonConfiguration.TestCase_1_2_1_Id); var testPlanWrapper = new TfsTestPlan((ITestPlan)testPlan); _testPlanDetail = new TfsTestPlanDetail(testPlanWrapper); var testSuite_1_1Wrapper = new TfsTestSuite((IStaticTestSuite)testSuite_1_1, testPlanWrapper); _testSuite_1_1Detail = new TfsTestSuiteDetail(testSuite_1_1Wrapper); var testSuite_1_2_1Wrapper = new TfsTestSuite((IStaticTestSuite)testSuite_1_2_1, testPlanWrapper); var testCaseWrapperAllSuitesAndPlans = new TfsTestCase((ITestCase)testCaseInAllTestSuitesAndPlans, testSuite_1_1Wrapper); _testCaseDetailAllSuitesAndPlans = new TfsTestCaseDetail(testCaseWrapperAllSuitesAndPlans); var testCaseWrapperForTestCaseInSuite1_2_1 = new TfsTestCase((ITestCase)testCaseOnlyInSuite1_2_1, testSuite_1_2_1Wrapper); _testCaseDetailForTestCaseInSuite1_2_1 = new TfsTestCaseDetail(testCaseWrapperForTestCaseInSuite1_2_1); }
public void TestCenter_TestAction_ShouldProvideStepNumberProperty() { var testCaseWrapper = new TfsTestCase(_testCase); var testCaseDetail = new TfsTestCaseDetail(testCaseWrapper); // numberings starts at "1" Assert.AreEqual("1", testCaseDetail.PropertyValue("Actions[0].StepNumber", x => x)); }
public void TestCenter_TestCase_CustomFieldsShouldBeAccessible() { // arrange var testCases = _testManagement.TestCases.Query("SELECT * FROM WorkItems"); var microsoftTestCase = testCases.FirstOrDefault(testCase => testCase.Id == CommonConfiguration.TestCase_1_1_1_Id); var tfsTestCase = new TfsTestCase(microsoftTestCase); // act var tfsTestCaseDetail = new TfsTestCaseDetail(tfsTestCase); // assert // ReSharper disable once PossibleNullReferenceException Assert.AreEqual( microsoftTestCase.CustomFields["Microsoft.VSTS.TCM.AutomationStatus"].Value.ToString(), tfsTestCaseDetail.PropertyValue("CustomFields[\"Microsoft.VSTS.TCM.AutomationStatus\"].Value", _testAdapter.ExpandEnumerable), "CustomFields[\"Microsoft.VSTS.TCM.AutomationStatus\"].Value incorrect."); }
/// <summary> /// Initializes a new instance of the <see cref="TfsTestCaseDetail"/> class. /// </summary> /// <param name="testCase">Associated <see cref="ITfsTestCase"/>.</param> /// <param name="expandSharedSteps"> When true, shared steps will be expanded otherwise only the shared steps itself is used (default behavior).</param> public TfsTestCaseDetail(TfsTestCase testCase, bool expandSharedSteps = false) { if (testCase == null) { throw new ArgumentNullException("testCase"); } ExpandSharedSteps = expandSharedSteps; TestCaseClass = testCase; Id = TestCase.Id; Title = TestCaseClass.OriginalTestCase.Title; if (TestCaseClass.OriginalTestCase.WorkItem != null) { IterationPath = TestCaseClass.OriginalTestCase.WorkItem.IterationPath; AreaPath = TestCaseClass.OriginalTestCase.WorkItem.AreaPath; WorkItemId = TestCaseClass.OriginalTestCase.WorkItem.Id; } }