2016-02-03 25 views
1

因此,我爲我的組織創建了一個類似於CodePlex上的TestCaseExtractor的工具。除了使用較新版本的ALM外,我還想導出與參數相對應的共享步驟和迭代。 (我沒有試圖導出結果,只是計劃數據。)我希望微軟在API文檔方面做得更好。他們曾經做過很棒的對象模型圖。所以,如果你知道這個東西的對象模型圖,那麼你更是我的英雄。所以這裏是我的方法:TFS/MTM按套件導出測試用例 - 共享步驟和參數

private void WriteCases(ITestSuiteBase suite, Exporter exporter) 
    { 
     foreach (var testCase in suite.TestCases) 
     { 
      exporter.WriteTestCaseTitle(testCase.Id.ToString(), testCase.TestCase.Title); 
      exporter.WriteTestCaseDescription(testCase.TestCase.Description); 
      exporter.objWriter.WriteLine("<table border='1' width='100%>'"); 
      exporter.objWriter.WriteLine("<tr><th width='50%'>Step</th><th widht='50%'>Expected Result</th></tr>"); 
      foreach (var action in testCase.TestCase.Actions) 
      { 
       string strStep = ""; 
       string strExpectedResult = ""; 
       if (action is ITestStep) 
       { 
        ITestStep step = action as ITestStep; 
        strStep = step.Title; 
        strExpectedResult = step.ExpectedResult; 
       } 

       // TODO: Come back to this. Need shared steps fer sure. 
       //else if (action is ISharedStepReference) 
       //{ 
       // ISharedStepReference sharedStep = action as ISharedStepReference; 
       // ISharedStep oldShareStep = sharedStep.FindSharedStep(); 
       // foreach (var testAction in oldShareStep.Actions) 
       // { 

       // } 
       //} 
       exporter.objWriter.WriteLine("<tr><td>" + strStep + "</td><td>" + strExpectedResult + "</td></tr>"); 
      } 

你可以看到評論代碼,我認爲我有一個共享步驟的開始。但是我看不到任何屬性或任何獲取步驟和實際結果的內容。所以我錯過了一些東西。

我不知道如何獲得測試用例中參數的迭代。任何幫助表示讚賞。謝謝!

回答

相關問題