NUnit Tests & DbMetal

12 views
Skip to first unread message

Jonathan Pryor

unread,
Feb 27, 2009, 12:50:33 PM2/27/09
to dblinq
Perhaps I'm an idiot.  Perhaps I'm really unlucky.  I'll let fate sort that out...

I'm trying to rework the unit test infrastructure in the tests-without-db branch.  Since I only have Visual Studio Express, part of that is getting the tests to work on Visual Studio Express (impressive, I know).

Consequently, I'm not able to run the existing unit tests, as I get a billion warnings[0] when loading the normal .sln file within Express.  Thus, I don't know what "normal" is. :-(

What I do know is this: tests/DbLinqTest/DbLinqTest.csproj has a project reference to DbMetal, because it tests some DbMetal internals.  Fine.

My problem is that when I create a NUnit test containing these DbMetal tests, most of them fail, because the DbMetal assembly can't be loaded.

More research reveals the problem [1]: The .NET assembly loader, when used within NUnit, doesn't find .exe files, only .dll files.

Thus, the question: Does the DbLinqTest project actually work and run without error?  If so, how does it find the DbMetal.exe reference (i.e. what do I need to do to mimic correct behavior)?  (Alternatively, did whoever is running the test previously copy DbMetal.exe to DbMetal.dll, which is sufficient to fix this error?)

Inquiring minds want to know. :-)

- Jon

[0] uncounted

[1] Fusion Log from trying to load DbMetal.exe within NUnit:
LOG: Using application configuration file: Z:\Home\Development\mono-HEAD\dblinq2007.tests\build.dbg\DbMetal.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///Z:/Home/Development/mono-HEAD/dblinq2007.tests/build.dbg/DbMetal.DLL.
LOG: Attempting download of new URL file:///Z:/Home/Development/mono-HEAD/dblinq2007.tests/build.dbg/DbMetal/DbMetal.DLL.
ERR: A fatal error occurred when retrieving next codebase for download (hr = 0x8007007b).

Justin Collum

unread,
Feb 27, 2009, 12:56:42 PM2/27/09
to dbl...@googlegroups.com
Have you tried to load the unit test project from within Nunit? Let's figure out if this is the project or VSE that's causing the issue.

Andrus

unread,
Feb 27, 2009, 1:02:28 PM2/27/09
to dbl...@googlegroups.com
Loading DbLinq_StudioExpress.sln in VCSE gives only one warning.
 
Andrus.

Pascal Craponne

unread,
Feb 27, 2009, 1:05:17 PM2/27/09
to dbl...@googlegroups.com
Yes, the DbLinqTest project works fine, and all tests succeed.
If you want to temporary use the full solution, you can download the trial for Visual Studio 2008, this would help you. Then you could switch back to the Express edition.

Regarding tests, I use them from two applications:
- NUnit
- ReSharper (which supports NUnit tests and integrates into Visual Studio).

Pascal.

jabber/gtalk: pas...@jabber.fr
msn: pas...@craponne.org

Justin Collum

unread,
Feb 27, 2009, 1:08:39 PM2/27/09
to dbl...@googlegroups.com
Also, consider BizSpark if you're looking for a copy of Visual Studio 2008. The requirements for qualifying are soooo small and you get a ton of software for $100. One microsoft guy who shall remain nameless told me that they really don't check into anything, they just take your word for it (that you're in a business that meets the requirements).

Jonathan Pryor

unread,
Feb 27, 2009, 2:26:36 PM2/27/09
to dbl...@googlegroups.com
On Fri, 2009-02-27 at 20:02 +0200, Andrus wrote:
Loading DbLinq_StudioExpress.sln in VCSE gives only one warning.

The problem isn't from loading DbLinq_StudioExpress.sln, nor from building DbLinq_StudioExpress.sln.  (In fact, DbLinq_StudioExpress.sln doesn't contain the DbLinqTest project.)  This particular problem isn't from building via DbLinq.sln either.

The problem comes from running the generated unit tests within NUnit.

There are two problems.

Problem 1: If I load DbLinq.sln within Visual Studio Express, I get 7 warning messages about unusable projects.  DbLinqTest.csproj is one of them.  Thus, DbLinqTest is unusable to VSE users.

Solution 1: DbLinqTest.sln fails to load because of the following element within the DbLinqTest.csproj file:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Any idea what that does?

If I apply the attached DbLinqTest.csproj.diff patch to DbLinqTest.csproj, the project is usable from within VSE.

So now I can build DbLinqTest from within the normal DbLinq.sln file.  Yay.

Problem 2: I get errors when running the DbLinqTest unit tests within NUnit 2.4.8.

Perhaps this is where I'm going wrong.

After I build the DbLinq, DbMetal, and DbLinqTest projects within the solution, I navigate to the build folder within Explorer, right-click DbLinqTest.dll, and select Run Tests.  This loads DbLinqTest.dll within NUnit 2.4.8.

Next I click the Run button within NUnit.

Result: 21 of 38 tests fail.

They fail because of the aforementioned assembly binding problem: the DbMetal assembly cannot be found when running the unit tests within NUnit 2.4.8.

Solution 2: If I simply copy DbMetal.exe to DbMetal.dll within the directory containing DbLinqTest.dll, then the tests pass within NUnit.

Thus, to paraphrase  the original question: How do you actually execute your unit tests?

If you need any more detail about the above steps, please ask and I'll try to be more descriptive.  At present, I'm unable to run the unit tests without a manual step (copying DbMetal.exe to DbMetal.dll), and it seems that this step shouldn't be necessary.

Thanks,
- Jon

DbLinqTest.csproj.diff

Pascal Craponne

unread,
Mar 3, 2009, 7:30:22 AM3/3/09
to dbl...@googlegroups.com
Hi Jon,

this project contains VS unit tests, so I presume they're not supported by VS Expression. It is possible to remove just this line, since all tests in there have double attributes, one set for MS and the other for NUnit.

Pascal.

jabber/gtalk: pas...@jabber.fr
msn: pas...@craponne.org



Reply all
Reply to author
Forward
0 new messages