问题描述
我觉得我在微软是如何丢失的链接某处期待TFS和自动化测试的共同努力。 TFS允许我们创建具有测试步骤测试用例。这些可以合并到各种测试计划。我有这个的所有设置和工作,我会期望手动测试。
I think I'm missing a link somewhere in how microsoft expect TFS and automated testing to work together. TFS allows us to create test cases that have test steps. These can be merged into a variety of test plans. I have this all setup and working as I would expect for manual testing.
我现在已经搬进了自动化的一些测试。我创建了一个新的Visual Studio项目,该项目涉及到我的测试计划。我已经创建了涉及测试用例和计划来创建测试类中的每个测试步骤的测试方法,使用ordertest以确保methids在顺序相同的测试步骤中执行的测试类
I've now moved into automating some of these tests. I have created a new visual studio project, which relates to my test plan. I have created a test class that relates to the test case and planned to create a test method for each test step within the test class, using the ordertest to ensure that the methids are executed in the same order as the test steps.
我希望我可以再联系这个自动化到测试用例,使得它可以作为测试计划的一部分来执行。
I'd hoped that I could then link this automation up to the test case so that it could be executed as part of the test plan.
这是当一切都错了,这是我的理解是,联想面板出现只勾一个测试用例到一个特定的测试方法,而不是一个测试步骤?
This is when it all goes wrong, It is my understanding that the association panel appears to only hook a test case up to a particular test method, not a test step?
我的理解是否正确?
有MS错过了一次机会在这里和做的事情豆蔻太复杂或有我错过了什么?如果我的东西钩高达整体测试用例的方法我失去了什么每次做granulaity。
Have MS missed a trick here and made things a litte too complicated or have I missed something? If I hook things upto a whole test case to a method I lose granulaity of what each is doing.
如果每个测试步骤被钩到测试方法将有可能为测试方法的断言注册一个通过或整体测试用例失败。
If each test step was hooked into a test method it would be possible for the assert of the test method to register a pass or fail of the overall test case.
任何帮助或方向,这样我可以提高我的理解是AP preciated。
Any help or direction so that I can improve my understanding would be appreciated.
推荐答案
的 您可以将只有一个方法来测试案例的。那一个方法应该覆盖所有写在其相关的测试案例,包括验证(断言)的步骤。
You can link only one method to a test case. That one method should cover all the steps written in its associated test case including verification(assertions).
如果它越来越不可能覆盖在一个测试方法中的所有步骤,或者如果你有太多的验证被测试的情况下,那么测试用例需要被分解成更小的测试用例,每个测试用例都会有一自动化的方法联想吧。
If it is getting impossible to cover all steps in one test method or if your have too many verifications is your test case, then the test case needs to be broken down to smaller test cases and each of the test cases will have one automated method associate with it.
自动化测试应该像这样工作。 (不是一个硬性的规则,但..)
Automation test should work like this. (Not a hard rule though..)
开始 - >做一些动作 - >验证(断言) - >完成
您可以写尽可能多的断言越好,但如果当时第一个断言失败,测试将不会进行进一步做其他的断言。这是怎么手动测试也适用,即测试失败,即使1级满分100失败。
You can write as many assertions as possible, but if first assert fails then test won't proceed further to do other assertions. This is how manual testing also works, ie Test fails even if 1 step out of 100 fails.
有关自动化测试可维护性的缘故,最好是添加最小在自动化测试和最容易的方式断言来实现,这是通过分割测试用例。微软或其他测试自动化供应商只能通过这种方式,我们不写为每一个步骤的测试方法。这将使事情非常复杂。
For the sake of automation test maintainability it is advisable to add minimum asserts in automation test and easiest way to achieve this is by splitting the test case. Microsoft or other test automation provider works this way only and we don't write test methods for each and every steps. This would make things very complicated.
但是,是的,你可以在每一个步骤,您的测试框架编写可重用的方法(而不是测试方法),并呼吁他们在您的测试方法。例如,你不必写code的测试用例一步说:应用程序登录一遍又一遍。你可以分开来写你的方法,并呼吁在链接到测试用例的测试方法。
But yes, you can write reusable methods(not test methods) in your test framework for each steps and call them in your test methods. For example you don't have to write code for a test case step say "Application Login" again and again. You can write your method separately and call that in your test method which is linked to the test case.
这篇关于TFS的自动化应用测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!