ITestPlan.RootSuite集合成员的不直观行为 [英] Unintuitive behavior from ITestPlan.RootSuite collection members

查看:54
本文介绍了ITestPlan.RootSuite集合成员的不直观行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从ITestPlan实现实例获取套件,测试用例等集合,但是Entries,TestCases等集合和IStaticTestSuite.Refresh(bool)方法的行为却没有没什么道理.

I'm attempting to get the set of suites, test cases, etc. from an ITestPlan implementation instance, but the behavior of the Entries, TestCases, etc. collections and the IStaticTestSuite.Refresh(bool) methods don't make much sense.

1)有时,当我获得一个TestPlan的句柄并检查RootSuite上Entries集合的计数时,即使明显存在条目,该计数也会返回0.这种行为的一个特别明显的方面是,我可以查询一组 计划中的测试点数量,此集合将具有_positive_计数,而RootSuite.Entries.Count仍返回0.我认为没有相应的测试用例+配置的测试点应该是不可能的,但是我不确定('原因 我可以找到有关它的详细文档:-)).示例代码:

1) Sometimes when I get a handle to a TestPlan and check the count of the Entries collection on the RootSuite, the count returns 0 even though there are clearly entries present. One particularly telling aspect of this behavior is that I can query for a set of test points within the plan and this collection will have a _positive_ count while RootSuite.Entries.Count still returns 0. I don't think it should be possible to have test points without corresponding test cases + configurations, but I'm not sure ('cause I can find detailed documentation about it :-)). Sample code:

;

string tfsProjectName = "My Project";

int tfsTestPlanId = 537;

TfsTeamProjectCollection tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri);

ITestManagementService tms = tfsCollection.GetService<ITestManagementService>();

ITestManagementTeamProject project = tms.GetTeamProject(tfsProjectName);

ITestPlan templatePlan = project.TestPlans.Find(tfsTestPlanId);

// NOTE: UNCOMMENT THE NEXT LINE LATER:

// templatePlan.RootSuite.Refresh(true);

// Note that this may return "X Test Points, 0 RootSuite entries" where X > 0

System.Diagnostics.

System.Diagnostics.

templatePlan.QueryTestPoints(

templatePlan.QueryTestPoints(

templatePlan.RootSuite.Entries.Count);

templatePlan.RootSuite.Entries.Count);

// Forcibly refresh the RootSuite

templatePlan.RootSuite.Refresh(

templatePlan.RootSuite.Refresh(

);

ITestPointCollection tpc = templatePlan.QueryTestPoints("SELECT * FROM TestPoint");

ITestSuiteEntryCollection entries = templatePlan.RootSuite.Entries;

// Now this should typically return "X Test Point, Y RootSuite entries" where X and Y are both > 0

System.Diagnostics.

System.Diagnostics.

2)注意,上述代码通过调用ITestPlan.RootSuite.Refresh(true)来强制刷新测试计划并显示缺少的条目,从而解决了看似不一致的情况.如果预期的行为是 在第一次加载测试计划之后以及调用.Refresh(bool)之前,可能不会出现条目,但是如果我在加载之后简单地调用ITestPlan.RootSuite.Refresh(true),则条目STILL不会显示.使用与上述相同的代码,并简单地取消注释 即使存在ARE条目和强制刷新",第一个跟踪输出仍会显示0个根套件条目,第一个templatePlan.RootSuite.Refresh(true),第一个跟踪输出仍显示0个根套件条目.已经完成了. (这似乎表明.Refresh实际上没有执行任何操作).如果我查询 收集测试点,然后强制刷新,看来条目收集将是准确的,但这真的是使用的正确模式吗? (在.Refresh之前必须对其他与测试计划相关的内容执行查询似乎很不直观. 会真正起作用...)

2) NOTE that the above code works around the seeming inconsistency by calling ITestPlan.RootSuite.Refresh(true) to forcibly refresh the test plan and have the missing entries show up. This would be perfectly acceptable if the expected behavior is that the entries may not appear after first loading a test plan and before .Refresh(bool) has been called, but if I simply call ITestPlan.RootSuite.Refresh(true) after loading, the entries STILL do not show up. Using the same code as above and simply uncommenting the first templatePlan.RootSuite.Refresh(true), the first trace output STILL SHOWS 0 root suite entries even though there ARE entries and the "forcible refresh" has been done. (Which make it appear that the .Refresh is really doing NOTHING). If I query for the collection of test points and then force the refresh, it appears the entries collection will be accurate, but is this really the right pattern to use? (It seems really unintuitive to have to perform a query for other test plan related content before .Refresh will actually work...)

这里的预期行为是什么?如何才能可靠地获取RootSuite(或与此相关的任何其他ITestSuiteBase派生的类型)中的一组条目?据我所能找到的资料,目前还没有关于正确方法的文档, 并且所有简单的示例和博客文章都没有解决这个问题....或者这仅仅是我遇到的TFS错误?

What is the expected behavior here? How can I reliably get the set of entries within the RootSuite (or any other ITestSuiteBase-derived type for that matter)? As far as I have been able to find, there is no documentation around the right way to do this, and all the simple samples and blog posts do not address this issue.... or is this simply a TFS bug I'm bumping up against?

推荐答案

嗨艾伦,

谢谢您的提问.

我正在尝试让熟悉此主题的人进一步研究此问题.可能会有一些时间延迟.感谢您的耐心.

I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

感谢您的理解和支持.

最好的问候


这篇关于ITestPlan.RootSuite集合成员的不直观行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆