I'm using Visual Studio Express 2012 on the Windows 8 Release Preview and I can't seem to get my unit tests to appear in the test explorer.
I have a class called TestApp.Entity, and TestApp.EntityTest...
Here is my code:
namespace TestApp.Entity.Test
{
using System;
using System.Net.Http;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestApp.Domain;
[TestClass]
public class EntityTests
{
[TestMethod]
public async void TestObject1Deserialize()
{
Uri agencyUri = new Uri("*removed*");
HttpClient httpClient = new HttpClient();
HttpResponseMessage response = await httpClient.GetAsync(agencyUri);
string responseBodyAsText = await response.Content.ReadAsStringAsync();
List<Agency> agencyList = Deserializers.AgencyDeserialize(responseBodyAsText);
CollectionAssert.Contains(agencyList, new Agency() { Tag = "*removed*", Title = "*removed*", ShortTitle = "", RegionTitle = "*removed*" });
}
}
}
I assume that's all I needed to do, but they still don't appear in the test explorer. Any advice would be helpful.
Turn live unit testing from the Test menu by choosing Test > Live Unit Testing > Start.
A typical unit test contains 3 phases: First, it initializes a small piece of an application it wants to test (also known as the system under test, or SUT), then it applies some stimulus to the system under test (usually by calling a method on it), and finally, it observes the resulting behavior.
Adding a unit test in Xcode If you already have a project, you can add a Unit Testing Bundle to it as well. Go to File > New > Target. Select iOS Unit Testing Bundle and then click Next.
As per Stephen Cleary, "you need to make your unit tests async Task
instead of async void
for them to work correctly".
This fixed the problem and the tests appeared. It's odd that no errors appeared when I used void, but now I know. Thank you!
I have Visual Studio 2012 and i couldn't see the Tests in Test Explorer,
So I installed the following: NUnit Test Adapter
That fixed the issue for me !
Do a rebuild all on the application, including any projects that contain test classes and test methods. They should appear in Test Explorer soon after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With