Whenever I create a .NET unit test project and write [TestMethod]'s, I ran through TestExplorer in Visual Studio 2012 or through Continuous Integration.
The problem I have now is, I have to execute the all test methods from a TestProject Dll and capture the test outcome Pass/Fail and any exception.
I know I can run using mstest command line statement, but I have to execute the TestMethods from dll.
namespace SampleTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void ConnectionTest()
{
var webreq = (HttpWebRequest) WebRequest.Create("http://bing.com");
using(var res = (HttpWebResponse) webreq.GetResponse())
Assert.AreEqual(res.StatusCode,HttpStatusCode.OK,"HTTP 200 is not received");
}
}
}
so How can I load SampleTests.dll and run the test method to get the result