有没有一种方法可以从MTM获取测试配置参数以用于编码Ui测试? [英] There is a way to get test configuration parameters from MTM to use into Coded Ui tests?

查看:65
本文介绍了有没有一种方法可以从MTM获取测试配置参数以用于编码Ui测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我一直在一个项目中工作,那里有很多环境和配置.

I've been working in a project there was many environments and configurations.

因此,我需要获取在MTM的测试配置"中创建的变量,并在我的编码Ui测试中使用这些参数.

For this reason I need to get the variables that I created in Test Configurations of MTM and use those paramenters in my Coded Ui Tests.

示例:我需要获取下图所示的变量

Example: I need get the variables as it's shown on the image below

有一种方法可以从MTM获取测试配置参数以用于编码Ui测试?

There is a way to get test configuration parameters from MTM to use into Coded Ui tests?

我已经看过这个了:

http://fluentbytes.com/switching-browser-in-codedui-or-selenium-tests-based-on-mtm-configuration-part-2/

http://fluentbytes.com/switching-browser-in-codedui-or-selenium-tests-based-on-mtm-configuration-part-2/

http://blogs.msdn.com/b/aseemb/archive/2012/08/07/code-snippets-on-test-management-apis.aspx

http://blogs.msdn.com/b/aseemb/archive/2012/08/07/code-snippets-on-test-management-apis.aspx

但是代码不能完全正常工作,也不是真正需要的代码.

But the code is not fully working and also isn't what a really need.

我将非常感谢您的帮助.

I will be very grateful for any help.

推荐答案

您好,路易斯,

如果您想在测试配置"中获取多个/完整变量,则可以根据此博客中的代码逻辑从测试用例结果中获取预期的测试配置"的ID: http://fluentbytes.com/switching-browser-in-codedui-or-selenium-tests-based-on-mtm-configuration-part-2/,查询TFS 基于测试配置ID的数据库以获取特定的测试配置,然后可以通过值"属性(

If you want to get multiple/complete variables in Test Configuration, you can get the ID of the expected TestConfiguration from the test case result based on the code logic in this blog: http://fluentbytes.com/switching-browser-in-codedui-or-selenium-tests-based-on-mtm-configuration-part-2/, query TFS database based on the test configuration id to get the specific test configuration and then you can get the specific variable’s value through Values property(http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.testmanagement.client.itestconfiguration.values.aspx ) .

参考:

var id = testCaseResult.TestConfigurationId;

var currentConfiguration = project.TestConfigurations.Query(从TestConfiguration中选择*,其中id =" + id).First(); 

var currentConfiguration=project.TestConfigurations.Query("select * from TestConfiguration where id="+id).First(); 

字符串v = currentConfiguration.Values ["Browser"]

如果没有帮助,则没有其他方法可以在测试配置"中获取完整的信息.

如果您只想在配置变量"中获取诸如浏览器"之类的变量之一,一种解决方法是将测试配置"的名称定义为浏览器"的名称,例如Chrome,IE .然后您可以使用获取浏览器名称 __ Tfs_TestConfigurationName 在基于代码示例的测试初始化​​方法中在此博客中提供: http://blogs.infosupport.com/switching-browser-在基于mtm配置的代码对或硒测试中/

If you only want to get one of those variables such as Browser in Configuration Variables, an workaround is that you define the name of the Test Configuration as the name of Browser such as Chrome, IE. Then you can get the browser name using __Tfs_TestConfigurationName in Test Initialized method based on the code sample provided in this blog: http://blogs.infosupport.com/switching-browser-in-codedui-or-selenium-tests-based-on-mtm-configuration/

如果要获取操作系统,则可以使用Windows定义测试配置的名称否则为7.

If you want to get the Operation System, you can define the name of the test configuration with Windows 7 or else.

最好的问候,

Best regards,


这篇关于有没有一种方法可以从MTM获取测试配置参数以用于编码Ui测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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