返回首页

{A}
在我以前的关于TFS的API的后,我表明了如何创建和获取测试计划,测试套件和测试用例对象。
作为质量中心TFS 2010迁移工具的一部分,我翻译成TFS 2010地区质量中心的层次。
,正如你可以看到从下面的图片,QC的层次结构(中间图片)看起来TFS的区(左图)相同,但它不会有同样的感觉吗??
感觉一样吗?当使用质量控制,您可以浏览使用树视图,深入的测试套件(文件夹)你想,以实现在TFS这些行动必须编写一个查询和每次改变查询的值,Ammm???它的不是一个好的解决方案??
但是,使用Microsoft测试管理,您可以创建具有相同的层次结构(右图)作为QC测试套件和要求。

为了迅速在TFS中创建这些层次,我只是建立了一个工具。此工具使用下面的文章来完成这个任务:{A5}
该工具很简单吗??连接到TFS 2010,创建或选择测试计划,选择区域(一个或多个),然后点击开始。
这一行动将采取两分钟,你到底在MTM的基础上,在您的项目和测试在每个区分配的案件区的结构完整的层次。
{A6}
结果将里面的测试计划,你拿起之前,所有的测试套件将在当前团队项目区路径。
在每个测试套件,你应该看到相关的测试用例。
{A7}
{A8}代码示例

/// <summary>

/// Get's a full path of Area, split it and for each part create 

/// Test Suite and apply the Test Cases beneath it.



/// </summary>

/// <param name="full_area">Area Path, for example - 

/// CMMI\First Area\Sub Area\Content Area</param>

void CreateTestSuite(string full_area)

{

    try

    {

        string[] areas = full_area.Split('\\');

        string full_path = string.Empty;

        IStaticTestSuite suite = null;

        string current_area = string.Empty;

 

        for (int i = 0; i < areas.Length; i++)

        {

            if (!string.IsNullOrEmpty(areas[i]))

            {

                string area = areas[i].RemoveBadChars();

                current_area += area;

 

                //The first item, find it and assigned to suite object.

                if (i == 1)

                {

                    ITestSuiteEntryCollection collection = _plan.RootSuite.Entries;

                    suite = TestHelper.FindSuite(collection, area);

                    if (suite.Id == 0)

                    {

                        suite.Title = area;

                        TestHelper.AddTests(suite, current_area);

                        _plan.RootSuite.Entries.Add(suite);

                    }

                }

                else

                {

                    ITestSuiteEntryCollection collection = suite.Entries;

                    //* collection - Perform search only under the suite.Entries  

                    //- Duplicate items allowed. 

                    IStaticTestSuite subSuite = TestHelper.FindSuite(collection, area);

 

                    if (subSuite.Id == 0)

                    {//Cannot find Test Suite

                        subSuite.Title = area;

                        suite.Entries.Add(subSuite);

                        //After creating the Test Suite 

                        //- Add the related TestCases based on the Area Path.

                        TestHelper.AddTests(subSuite, current_area);

                    }

 

                    suite = subSuite;

                }

                current_area += "\\";

                _plan.Save();

            }

        }

        _plan.Save();

    }

    catch (TestSuiteInvalidOperationException testex)

    {

        if (!testex.Message.Contains("Duplicate suite name detected"))

            throw new ArgumentNullException(testex.Message);

    }

}

TestSuiteHelper包含几个简单的动作,如AddTests - 执行查询,以查找特定的区域路径下的所有测试用例,还为每间套房(递归搜索下一个递归搜索FindSuite在TFS,因为套房不具有唯一的名称,这应该是每间套房的个人搜索)。{C}{A10}

回答

评论会员:光辉传奇 时间:2012/01/26
一个选择按钮,将有选择设置为选择的命令。现在,在GridView的SelectedIndexChanged事件,你可以参考作为Gridview1.SelectedRow选择GridView行返回一个类型的GridViewRow .
评论会员:游客 时间:2012/01/26
行希望这些链接将帮助您学习的GridView操作:尝试以下链接:{A11}{A12}]
拉朱melveetilpurayil
评论会员:游客 时间:2012/01/26
codeprelang="cs"spanclass="code-keyword"protected/spanspanclass="code-keyword"void/spanGridView1_SelectedIndexChanged(spanclass="code-keyword"object/spansender,EventArgse){spanclass="code-keyword"int/spanselectedRow=GridView1.SelectedIndex;spanclass="code-comment"///spanspanclass="code-comment"teakingthevalueoffirstcolumninselectedrow/spanspanclass="code-keyword"string/spanfirstColumn=GridView1.Rows[selectedRow].Cells[spanclass="code-digit"0/span].Text;spanclass="code-comment"///spanspanclass="code-comment"takingthevalueofsecondcolumninselectedrow/spanspanclass="code-keyword"string/spansecondColumn=GridView1.Rows[selectedRow].Cells[spanclass="code-digit"1/span].Text;}/pre/code
TeeLeong
评论会员:游客 时间:2012/01/26
喜Makhaai,我不使用C#软件。我ASPNET2008内使用VBNET2008关于您的建议下面列出:-----------------------------------------------------------{BR}我把它转换到VB脚本试图运行它,但它产生此错误消息:"细胞"是不是"整数"的成员。{五}这是ASP的VB版本codeprelang="vb"spanclass="code-keyword"Protected/spanspanclass="code-keyword"Sub/spanGridView1_SelectedIndexChanged(spanclass="code-keyword"ByVal/spansenderspanclass="code-keyword"As/spanspanclass="code-keyword"Object/span,spanclass="code-keyword"ByVal/spanEspanclass="code-keyword"As/spanSystem.EventArgs) spanclass="code-keyword"Dim/spanintSelectRowspanclass="code-keyword"As/spanspanclass="code-keyword"Integer/span=GridView1.SelectedIndexspanclass="code-keyword"Dim/spanGVRowspanclass="code-keyword"As/spanGridViewRowspanclass="code-keyword"Dim/spanstrCustIDspanclass="code-keyword"As/spanspanclass="code-keyword"String/span=GridView1.Rows(intSelectRow.cells(spanclass="code-digit"1/span).text) spanclass="code-keyword"End/spanspanclass="code-keyword"Sub/span/pre/code
koool.kabeer
评论会员:游客 时间:2012/01/26
你可以尝试用一个代码行简单codeprespanclass="code-keyword"protected/spanspanclass="code-keyword"void/spanGridView1_SelectedIndexChanged(spanclass="code-keyword"object/spansender,EventArgse){lbl_message.Text=GridView1.SelectedRow.Cells[spanclass="code-digit"0/span].Text;} /pre/code