Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

DeploymentItem with Environment Variable not working
ronjacobs
#1 Posted : Thursday, June 28, 2012 9:36:13 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/28/2012(UTC)
Posts: 4
Location: Redmond

I've just tried using NCrunch for the first time. My project currently builds and passes all unit tests from Visual Studio.

However, when NCrunch runs the tests I get many test failures due to deployment items not being deployed.

It appears that MSTest DeploymentItem is supported. However I wonder if it could be because of the environment variable I use.

[DeploymentItem(@"%LABDIR%\Microsoft.Activities.Extensions\Microsoft.Activities.Extensions.Tests\ServiceExtensionTest.xamlx")]

I use the %LABDIR% variable because DeploymentItem uses either a full path or relative to the solution file path. But in my case, this test file is included in multiple solution files so I can't use a relative path. I use the %LABDIR% variable to make sure the deployment item is found regardless of the solution path.

Could that be the issue?
ronjacobs
#2 Posted : Friday, June 29, 2012 3:00:11 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/28/2012(UTC)
Posts: 4
Location: Redmond

As a quick test I replaced the environment variable with the actual path and the test is now passing.

Please make the DeploymentItem expand the environment variable
ronjacobs
#3 Posted : Saturday, June 30, 2012 2:23:49 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/28/2012(UTC)
Posts: 4
Location: Redmond

Here is my workaround

#if NCRUNCH
/// <summary>
/// The Lab directory
/// </summary>
/// <remarks>
/// NCrunch does not expand environment variables
/// </remarks>
internal const string Labdir = @"D:\wf.codeplex.com\src\wf\labs";
#else
/// <summary>
/// The test projects folder.
/// </summary>
internal const string Labdir = "%LABDIR%";
#endif
Remco
#4 Posted : Monday, July 2, 2012 3:57:34 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi, thanks for posting!

It's true that NCrunch currently doesn't parse environment variables specified in the DeploymentItem. Thanks for making me aware of this issue, I'll note it down for a fix in a future revision.


Cheers,

Remco
Remco
#5 Posted : Monday, August 13, 2012 4:08:59 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
For anyone interested, NCrunch 1.41b has just been released including a fix for the above issue. NCrunch should now automatically resolve and handle deployment items making use of environment variables.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download