This is a migrated thread and some comments may be shown as answers.

First attempt with a unit-test: Core.TestContext error?

5 Answers 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 2
James asked on 11 Aug 2011, 11:06 PM
Hello, after using NUnit with the Jetbrains test-runner, I decided to give this Testing Framework a try. Following the guide within the Test Studio documentation, the last section titled "Telerik Testing Framework", within the section describing getting started using NUnit - I created a new unit-test class using the Telerik template, for NUnit-Wpf.  I added the NUnit references to the project.

But there is a compile error that I don't see addressed within the guide. Within the region WebAii Initialization..

Initialize(new TestContextWriteLine(Core.TestContext.Out.WriteLine));

The TestContext member is not found, resulting in a compilation error. I can comment this out of course -- but I'm wondering if this indicates a problem with the configuratioin, or what?  (see first attached screenshot)

Incidentally, also within the guide - there is a link to download the NUnit web extensions source. But the link takes you to a Telerik product page and I am not seeing any path from that page to get you to the NUnit web extensions source. Is this a typo? (see second screenshot)

If I am creating a unit-test for my desktop WPF app, why is a "NUnit-Wpf" project template including WebAii initialization anyway? This is not a web application.

I appreciate your advice and help, thanks.

James W. Hurst

5 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 15 Aug 2011, 01:13 PM
Hi James,
   you're right - the link for the Nunit Extension is incorrect. I've logged this and it will be rectified. However, you don't need that link in order to add a reference to Nunit.Core. I assume you already have the following using statement in your test:
using Core = NUnit.Core;
It's part of the default Nunit test template.

Now you have to add Nunit.Core to your project references. If you have Nunit installed (which you should if you want to run Nunit tests) then this DLL is located in the installation folder for Nunit. On my machine I found it in the following location:
c:\Program Files(x86)\NUnit 202.5.10\bin\net-2.0\lib\nunit.core.dll

Just add it to your project references from this location.

Kind regards,
Stoich
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Lionel
Top achievements
Rank 1
answered on 18 Aug 2011, 03:11 PM
Even if you add the reference to nunit.core you have the problem.

TestContext class is not there. 
Nunit version is 2.5.5.10112
0
Cody
Telerik team
answered on 18 Aug 2011, 11:14 PM
Hello Lionel,

Yes, NUnit moved the function on us in their API. Try this instead:

Initialize(false, new TestContextWriteLine(Core.TestExecutionContext.CurrentContext.LogWriter.WriteLine));

Best wishes,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Daniel Corbett
Top achievements
Rank 1
answered on 23 Sep 2011, 07:28 PM
Unfortunately, your fix isn't complete...

At least with NUnit. 2.5.10,  In this latest version of NUnit,  Nunit.Framework.TestContext.Out doesn't exist.

Seems like the feature is gone from NUnit.  I can't find a compatible fix, except to comment it out.

Suggestions?

   - Daniel
0
Cody
Telerik team
answered on 23 Sep 2011, 10:21 PM
Hi Daniel Corbett,

I just installed NUnit-2.5.10.11092 and find that the same code works as expected. Can you double check the file path to your NUnit.core.dll file (see attached screen shot)?

All the best,
Cody
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
James
Top achievements
Rank 2
Answers by
Stoich
Telerik team
Lionel
Top achievements
Rank 1
Cody
Telerik team
Daniel Corbett
Top achievements
Rank 1
Share this question
or