Visual Studio Test Explorer not running [OneTimeSetUp] and [setup] methods

684 views
Skip to first unread message

Steven Whatmore

unread,
Mar 24, 2016, 11:08:06 AM3/24/16
to nunit-...@googlegroups.com
I am trying to run my nUnit 3.x tests in Test Explorer using the NUnit3 VS Adapter - but the OneTimeSetup and Setup methods are not getting called

Everything works fine when I run the command line nunit3-console so I know these things work 

Is there something else I need to do to get these integrate with the Test Explorer properly.

Thanks in advance.

Whatty

------------------------------------------------------------------------------------


PureFacts Financial Solutions | www.purefacts.com
372 Bay Street | Suite 1703 | Toronto | ON | M5H 2W9
416.598.1241 main | 888.596.9338 toll free


------------------------------------------------------------------------------------


Please consider the environment before printing this e-mail.

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Rob Prouse

unread,
Mar 24, 2016, 12:11:30 PM3/24/16
to NUnit-Discuss
Whatty,

I just tested and it works for me. To test, I put a breakpoint in OneTimeSetup and SetUp and did a debug selected tests

Inline images 1

Inline images 2

You shouldn't have to do anything special to get it working. Some things to try,

  1. Use the extension for the test adapter, not the nuget package. Some people have had problems with the nuget version.
  2. Ensure you are using the latest version of the adapter, CTP 8
  3. Are you using the latest release of NUnit, 3.2? 3.0.1 should work fine.
  4. Maybe your methods are running, but you don't think they are because the current working directory is different in Visual Studio? Try debugging.
  5. Other people have reported the same thing, but they were running the tests using older third party test extensions like TestDriven or Resharper that hadn't been updated to NUnit 3. You are running from the Test Explorer Window?
Hope this helps,

Rob

--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunit-discus...@googlegroups.com.
To post to this group, send email to nunit-...@googlegroups.com.
Visit this group at https://groups.google.com/group/nunit-discuss.
For more options, visit https://groups.google.com/d/optout.



--

Rob Prouse

 

I welcome VSRE emails. Learn more at http://vsre.info/

Steven Whatmore

unread,
Mar 24, 2016, 12:46:39 PM3/24/16
to nunit-...@googlegroups.com
  1. Use the extension for the test adapter, not the nuget package. Some people have had problems with the nuget version.
Yes
  1. Ensure you are using the latest version of the adapter, CTP 8
Yes
  1. Are you using the latest release of NUnit, 3.2? 3.0.1 should work fine.
3.2
I down-leveled to 3.01 with no luck
  1. Maybe your methods are running, but you don't think they are because the current working directory is different in Visual Studio? Try debugging.
Debugging yes with breakpoints to confirm if the OneTimeSetup is getting called
  1. Other people have reported the same thing, but they were running the tests using older third party test extensions like TestDriven or Resharper that hadn't been updated to NUnit 3. You are running from the Test Explorer Window?
Yes Visual Studio Test Explorer

------ Discover test started ------
NUnit 1.2.0.0 discovering tests is started
NUnit 1.2.0.0 discovering test is finished
NUnit Adapter 3.0.8.0 discovering tests is started
NUnit Adapter 3.0.8.0 discovering test is finished
========== Discover test finished: 28 found (0:00:00.3810381) ==========
------ Run test started ------
NUnit 1.2.0.0 executing tests is started
Loading tests from E:\Projects-VS-2013\PureWealth\PureWealth-TestSuite\bin\PureWealth-TestSuite.dll
Run started: E:\Projects-VS-2013\PureWealth\PureWealth-TestSuite\bin\PureWealth-TestSuite.dll
Spring.Objects.Factory.Support.DefaultListableObjectFactory: 2016-03-24 12:18:04,638 ERROR [TestRunnerThread] - GetObjectInternal: error obtaining object &springQuartzScheduler
Spring.Objects.Factory.Support.DefaultListableObjectFactory: 2016-03-24 12:18:38,059 ERROR [TestRunnerThread] - GetObjectInternal: error obtaining object &springQuartzScheduler
Spring.Objects.Factory.Support.DefaultListableObjectFactory: 2016-03-24 12:19:20,157 ERROR [TestRunnerThread] - GetObjectInternal: error obtaining object &springQuartzScheduler
dummyTest

I am assuming that this version is okay

How do I put nUnit into debug if using the Test Explorer - I am pretty sure that you guys have included DEBUG logs 

Again these work fine if running the nunit3-console

Steve Whatmore

Software Development Manager / Architect

416.598.1241 x245 office 416.577.0057 cell

Charlie Poole

unread,
Mar 24, 2016, 1:08:53 PM3/24/16
to NUnit-Discuss

You appear to have both the NUnit Adapter and the NUnit 3 Adapter installed. That's OK if you need both but it looks like the original adapter is the one trying to execute your tests. Version 1.2 is quite old so it may be getting confused.

If you no longer use NUnit V2. Remove the old adapter. If you still need it, at least upgrade to the latest version.

Rob Prouse

unread,
Mar 24, 2016, 4:58:51 PM3/24/16
to NUnit-Discuss
To expand on Charlie's suggestion, the current version of the NUnit 2 adapter will not attempt to run NUnit 3 tests. The version you are running was released before those changes, so tries to run anything NUnit, but obviously fails with the new NUnit 3 features and probably a lot of other things.

Steven Whatmore

unread,
Mar 25, 2016, 12:54:21 PM3/25/16
to nunit-...@googlegroups.com
I have removed the older versions and got it to work with 3.2 

Took some finagling of course since the context that the Test Explorer runs the test in is slightly different than that of the nUnit command line (current working directory for one) but wasn't to difficult.

Thanks for the assistance

Whatty
Reply all
Reply to author
Forward
0 new messages