Quantcast
Channel: invokemstest Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 6

Created Unassigned: Could not find any test containers [3]

$
0
0

I am using Visual Studio 2012 with .net 4.5 and I couldn't get the command to load my unit tests (they're written using the MS Test Framework).
It didn't matter whether I was invoking it on .sln or .csproj, the following error kept showing up:

> Error : MyUnitTestProj.csproj : Could not find any test containers.


##The problem

Was partially within my csproj but also within the invoke command

`Invoke-MsTest.psm1` is using the following xpath (simplified - full code at line 195 in `Invoke-MsTest.psm1`) to find the reference for **UnitTestFramework**:

```
//Project/ItemGroup/Reference
```
However, here's the section in my csproj where the framework is actually referenced:

```
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
```

So there was no way Invoke-MsTest would find the reference located at
```
//Project/Choose/Otheriwse/ItemGroup/Reference
```
using this xpath
```
//Project/ItemGroup/Reference
```

##Suggested Solution

I ended up changing the path at line 195 in Invoke-MsTest to this
```
//Project//ItemGroup/Reference
```
so that it looks for any *ItemGroup* descendant (hence the double slash **//** ) of *Project*, and worked just fine.

But you have to make sure this new xpath does not overlap with some incorrect node that would cause other issues.



Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images