Unit tests not displayed

I am using Visual Studio Express 2012 in the release of Windows 8 Release Preview, and I cannot make my unit tests appear in the test explorer.

I have a class 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 all I needed to do, but they still do not appear in the test explorer. Any advice would be helpful.

+7
source share
3 answers

Like Stephen Cleary , you need to do your async Task unit tests instead of async void so that they work correctly. "

This fixed the problem and tests appeared. It is strange that there were no errors when I used the void, but now I know. Thanks!

+5
source

I have Visual Studio 2012, and I could not see the tests in Test Explorer,

So, I installed the following: NUnit Test Adapter

This fixed the problem for me!

+2
source

Rebuild everything in the application, including any projects containing test classes and test methods. They will be available soon in Test Explorer .

+1
source

All Articles