问题描述
您好
任何人都可以帮助我,我使用下面的代码来获取CodedUI中的总方法数
private int CountNumberOfTestMethods()
{
int countOfTestMethods = 0;
foreach(System.Reflection.Assembly.GetExecutingAssembly()中的类型ty。GetTypes())
{
foreach(ty.GetMethods()中的System.Reflection.MethodInfo方法)
{
的foreach(在method.CustomAttributes System.Reflection.CustomAttributeData CA)
            {
如果(ca.ToString()==" [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]")
       &NBSP ;        {
                    countOfTestMethods ++;
                }
}
}
}
return countOfTestMethods;
}
谢谢我已经成功,就像我现在创建的类库一样上面的代码,并在我的encodeui脚本中使用作为参考,我 能够获得totalmethods,但我们如何在codeduiscript中获得每个METHODE名称?为例如:在提前(enterusername)
由于
Hi
can any one help me i have used below code to get total metods in CodedUI
private int CountNumberOfTestMethods()
{
int countOfTestMethods = 0;
foreach (Type ty in System.Reflection.Assembly.GetExecutingAssembly().GetTypes())
{
foreach (System.Reflection.MethodInfo method in ty.GetMethods())
{
foreach (System.Reflection.CustomAttributeData ca in method.CustomAttributes)
{
if ( ca.ToString() == "[Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]" )
{
countOfTestMethods++;
}
}
}
}
return countOfTestMethods;
}
Thanks I have got successfully, the same like I have now created classlibrary for the above code and using as refrence in my codedui script, I able to get totalmethods ,but how can we get each METHODE Name in codeduiscript? for eg:(enterusername)
Thanks in Advance
这篇关于codedui中的方法名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!