如何在 Microsoft 测试管理器中运行 selenium 测试
我有一些用 nunit 和 selenium 编写的自动化测试。如何从 Microsoft 测试管理器调用要执行的 dll。因为我不知道如何从 MTM 运行自动化测试。是否可以。
I have some automated tests written in nunit and selenium. How can I call the dll to execute from Microsoft test Manager. as I couldnt figure out how to run automated tests from MTM. is it possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MTM 确实允许自动化测试。
我们可以在 Visual Studio 中浏览测试用例并将可执行文件附加到测试用例(在 MTM 中创建)。稍后我们还必须将构建链接到测试计划以及执行自动化测试。如果不这样做,测试代码应该开发为测试项目(CodedUI 或单元测试),这样测试管理器将无法检测到要测试的方法。
MTM does allow to automate the test.
We can browse a test case in Visual Studio and attach the executable to the test case (Created in MTM). Later we have to link the build to the test plan as well for the execution of the automated test. Test code should be developed as a test project (CodedUI or Unit test) if not done so the test manager will not detect the method to be tested.
为了让 MTM 使用 Selenium 运行自动化测试,您需要将测试与 MTM 中的测试用例关联起来。目前 MTM 仅支持 MS 测试,因此您需要为每个 Selenium 测试构建一个包装器。
解决方案#1:我将使用 T4 模板构建包装器,该模板生成调用我的 Selenium 测试所需的 MS 测试存根。
然后,您需要在 TFS 中拥有一个带有 MS 测试“自动化”的测试用例' 与之相关。
解决方案#2:您可以使用“tcm import”命令行工具来生成测试用例并使其与自动化保持同步。
现在您已经配置了所有位,您可以继续调用从 MTM 生成的测试,您遇到了 @richard 提到的问题。
解决方案#3:您可以在 MTM 中配置一个环境,您将在其中收集数据并自动触发测试运行。这可以作为构建的一部分来完成,或者更好地作为发布管理中的二进制管道的一部分(http://nakedalm.com/execute-tests-release-management-visual-studio-2013/)
虽然要完成所有设置有很多困难,但我我们发现这是一种相当可靠的执行自动化的方式。如果MTM支持其他测试框架的话会容易很多,但现在不是这样。
For MTM to run automated tests with Selenium you need to associate the test with a Test Case in MTM. Currently MTM only supports MS Tests so you would need to build a wrapper for each of your selenium tests.
Solution #1: I would build the wrapper with a T4 template that generated the required MS Test stubs that call my Selenium tests.
You would then need to have a Test Case in TFS with the MS Test 'automation' associated with it.
Solution #2: You can use the "tcm import" command line tool to generate and keep your Test Cases in sync with the automation.
Now that you have all of the bits configured you can go ahead and call the generated tests from MTM and you hit the issue that @richard mentioned.
Solution #3: You can configure an Environment in MTM where you are going to collect the data and automate the trigger of the test run. This can be done as part of the Build, or better as part of your binary Pipeline in Release Management (http://nakedalm.com/execute-tests-release-management-visual-studio-2013/)
While there are a lot of hoops to get all setup I have found this to be a fairly robust way to execute the automation. It would be a lot easier if MTM supported other test frameworks, but that is not the case just now.
MTM 不运行自动化测试。它是专为手动测试人员设计的工具。它提供的唯一自动化功能是记录/重放测试人员记录的操作。
如果您想自动运行 Selenium 测试,则将运行 NUnit 作为构建过程的一部分,只需确保构建代理作为交互式进程而不是服务运行,以便 Selenium 可以访问桌面并运行浏览器。
或者,您可以考虑使用无头浏览器,例如 XBrowser 或 HTMLUnit(尽管您需要使用Selenium2 远程驱动程序)
MTM doesn't run automated tests. It's a tool designed for manual testers. The only automation it offers is the record/replay of actions that a tester has recorded.
If you want to automatically run Selenium tests then look at running NUnit as part of the build process, just make sure the build agent is running as an interactive processes not a service so that Selenium can access the desktop and run a browser.
Alternatively you could look at using a headless browser such as XBrowser or HTMLUnit (though you'll need to use the Selenium2 remote driver)