using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
List<string> li = new List<string>();
Assembly assembly = Assembly.LoadFile(@"F:\Caligo-SourceRoot\1Mainline-win7\CaligoAutoWin7Main\bin\Debug\CaligoAutoWin7Main.dll");
Type type = assembly.GetType("CaligoAutoWin7Main.CaligoTest");
MethodInfo[] mi = type.GetMethods();
foreach (MethodInfo method in mi)
{
object attribute = method.GetCustomAttributes(typeof(TestMethodAttribute)).FirstOrDefault();
if (attribute != null)
{
li.Add(method.Name);
}
}
}
}
}
//Make sure the Microsoft.VisualStudio.QualityTools.UnitTestFramework reference is having the same version of both the Referenced(TestProject) and the referencing Project.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/18ccce46-8e18-42ef-8b1f-ba9a3155fc29/how-to-get-all-the-test-method-name-from-the-test-project?forum=vstest
No comments:
Post a Comment