34992

How to make an NUnit TestProject use its own config when run?

Question:

Is it possible to let Resharper (or NUnit?) know that I want each test to look for an App.config under it's own project, even when running all tests in a solution together?

<strong>Background:</strong>

I'm using NUnit and the test-runner that ships with Resharper, and I've got several test-projects in the same solution. Some of my tests depend on config-files located under their respective projects.

When I run a test-project by itself, it will use it's internal App.config, and everything works fine. When I try to run all the tests in the solution, or use the shortcut to run all tests in current test session however, no config-file will be selected, and any test depending on a config will fail by default.

For this reason, I typically end up running all tests in the solution once first, then right clicking the nodes in the test-runner for each of the config-dependent projects, and running them separately afterwards.

Answer1:

Solved:

Apparently assemblies containing NUnit-tests <a href="http://www.nunit.org/index.php?p=assemblyIsolation&r=2.5.5" rel="nofollow">can be run in separate processes or domains using command line options</a>.

For the testrunner under Resharper, this setting can be found under Resharper > Options > Unit Testing.

There is an option "<em>Use separate AppDomain for each assempbly with tests</em>". Checking that solved my problem.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/z4sjj.png" data-original="https://i.stack.imgur.com/z4sjj.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Recommend

  • How to override jQuery promise callback
  • How do you keep a running instance for Google App Engine
  • Regex for nested values
  • my tic-tac-toe program in matlab does not work [closed]
  • jQuery - resize an elements height to match window without refreshing, on window resize
  • VBA Excel, loop through variables
  • converter json to two dimensional array
  • Servlet stops working on Tomcat server after some hits or time
  • aapt.exe'' finished with non-zero exit value 1
  • Image map in Flex
  • Who propagate bugfixes across branches (corporate development)?
  • Best way to dynamically load an xml configuration file into a Flex4/Flash movie at runtime?
  • Android app gives error “BatteryStatsImpl: reading network stats”
  • Selenium to click on a javascript button corresponding to a text
  • Web.config system.webserver errors
  • MySQL Order by column = x, column asc?
  • jQuery ready not fired after rails link_to is clicked
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • Yii2: Config params vs. const/define
  • Algorithm for a smudge tool?
  • SignalR .NET Client Invoke throws an exception
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • Large data - storage and query
  • How can I estimate amount of memory left with calling System.gc()?
  • WOWZA + RTMP + HTML5 Playback?
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • C# - Getting references of reference
  • Hits per day in Google Big Query
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Busy indicator not showing up in wpf window [duplicate]
  • How to push additional view controllers onto NavigationController but keep the TabBar?