在测试管理器中排序编码的 UI 测试和结果
我有一系列 CodedUI 测试方法组成一个测试用例。测试方法需要按顺序运行(IE testmethoda 先运行 testmethodb,然后运行 testmethodc),我希望结果显示在 Microsoft 测试管理器中,看起来像 testmethoda 通过、testmethodb 通过、testmethodc 失败。有没有办法在能够运行整个测试用例的多次迭代的同时做到这一点?
我尝试过将测试方法放入单个测试方法中并调用它。这为我提供了所需的测试顺序以及进行多次测试运行的能力,但测试管理器在整个测试用例上显示了一次通过/失败。
我还尝试将数据源附加到各个测试方法,并在测试管理器中对它们进行排序,这在测试管理器中为我提供了所需的测试结果,但有副作用,如果我想运行多个数据行,则顺序会混乱。例如 3 行数据将运行:
testmethod
测试方法
测试方法
testmethodb
测试方法
测试方法
数据库测试方法
测试方法
testmethodc
我希望它们运行:
测试方法
测试方法
testmeothdc
测试方法
测试方法
testmethodc 等。
我也考虑过使用有序测试,但这仍然在 MTM 中显示为单个测试,并且我不知道有一种方法可以数据驱动它,所以它会有自己的问题。
我在 VS 或 MTM 中是否缺少某个功能来获得这些结果?也许有一种方法可以让我在结果文件中定义测试运行?写入/编辑 trx 文件会将我的结果输入到 MTM 中吗?我有一种感觉,我还必须对 TFS 数据库进行更改,但这不是一个选项。
I have a series of CodedUI test methods that make up a single test case. The test methods need to run in order (IE testmethoda runs then testmethodb and then testmethodc) and I want the results to show up in Microsoft Test Manager to look like testmethoda passed, testmethodb passed, testmethodc failed. Is there a way to do this while being able to run multiple iterations of the overall test case?
I have tried are putting the test methods into a single test method and calling that. This gives me the desired test order and the ability to make multiple test runs, but test manager shows a single pass/fail on the entire test case.
I have also tried attaching a datasource to the individual test methods and ordering them in test manager which gives me the desired test results in test manager but has the side effect that if i want to run more than one data row the order gets messed up. For example 3 data rows would run:
testmethoda
testmethoda
testmethoda
testmethodb
testmethodb
testmethodb
testmethodc
testmethodc
testmethodc
I want them to run:
testmethoda
testmethodb
testmeothdc
testmethoda
testmethodb
testmethodc etc..
I have thought about using an ordered test as well but that still shows up as a single test in MTM and there isn't a method I am aware of to data drive it anyways so it would have it's own problems.
Is there a feature that I am missing in VS or MTM to get these results? Maybe a method that would allow me to define a test run in the results file? Would writing/editing the trx file get my results into MTM? I have a feeling I would also have to make changes to the TFS database which isn't an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为没有办法通过 VS 或 MTM 来做到这一点。将所有测试方法添加到单个测试方法上的选项听起来不错,但是当其中一个测试方法失败时,“父”测试方法将停止并抛出内部测试之一引发的“AssertFailedException”。
但是,如果您的测试方法(a、b、c ...)完全不受另一个的影响(这意味着如果 testMethodA 失败,其他测试可以毫无问题地运行),我会尝试捕获所有内部异常,并在最后打印哪些方法通过了,哪些方法没有通过。
您还可以创建一个不同的类来管理所有这些行为,以避免所有这些“try-catch”。
I don't think there is a way to do this through VS or MTM. The option to add all your test methods on a single one sounds good but when one of them fails then the 'parent' test method stops and throws the 'AssertFailedException' that one of the inner tests had thrown.
However, if your test methods (a, b, c...) are completely unaffected one by the other (this means that if the testMethodA fails the other tests can run without problems), I would try to catch all the internal exceptions and at the end print which methods passed and which not.
You could also create a different class that will manage all this behaviour to avoid all these 'try-catch'.