NUnit Gui: Project Config Change from Menu Does Not Change AssemblyWatcher
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit V2 |
Fix Released
|
High
|
Cvetomir Todorov |
Bug Description
- NUnit 2.5.5.10112
- nunit-x86.exe
- Windows 7 64 Bit.
Create an nunit project with two configurations: Debug and Release. Set each config to load one assembly but from different paths, for example:
win32\debug\
win32\release\
Save the project, when config is set to debug. Close and re-start nunit-x86.exe, load the project. Then modify your debug dll and observe how it gets reloaded by nunit. Then change the config to release in nunit and modify your release dll so that it should get reloaded by nunit. It does not. Then change the debug dll version again and observe how nunit reloads the assembly even though the config is still release.
I had a look into the sources (2.5.5.10112) and I think the bug is in NUnit.UtilTestL
I think ReloadTest and LoadTest methods need refactoring as the code is almost the same.
If someone can advise me how and where to add a unit test for this case, then I could try to do the fix and refactoring myself and post the result.
Related branches
- Charlie Poole: Approve
-
Diff: 1342 lines (+727/-461)10 files modifiedsrc/ClientUtilities/tests/FileWatcherTest.cs (+3/-2)
src/ClientUtilities/tests/MockAssemblyWatcher.cs (+0/-3)
src/ClientUtilities/tests/TestLoaderWatcherTests.cs (+139/-0)
src/ClientUtilities/tests/nunit.util.tests.build (+1/-0)
src/ClientUtilities/tests/nunit.util.tests.csproj (+213/-213)
src/ClientUtilities/util/AssemblyWatcher.cs (+104/-43)
src/ClientUtilities/util/IAssemblyWatcher.cs (+54/-0)
src/ClientUtilities/util/TestLoader.cs (+31/-20)
src/ClientUtilities/util/nunit.util.build (+1/-0)
src/ClientUtilities/util/nunit.util.dll.csproj (+181/-180)
Changed in nunitv2: | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Petteri Salo (petteri-salo) |
tags: | added: gui |
Changed in nunitv2: | |
status: | Triaged → Confirmed |
status: | Confirmed → In Progress |
status: | In Progress → Fix Committed |
Changed in nunitv2: | |
milestone: | none → 2.5.8 |
Changed in nunitv2: | |
status: | Fix Committed → Fix Released |
Hi Petteri,
Congratulations! You now own the bug. :-)
Tests are in TestLoaderAssem blyTests. cs and are embarassingly scarce. They are rather hign level and provide no verification that the FileWatcher is set up - which probably explains why it doesn't work correctly.
Two ways to go here - at your option:
1) Introduce some proper testing that the watcher is set up.
2) Just fix it, since we plan on rewriting this whole part of the app for 3.0.
Ideas/Suggestio ns...
A proper test would call for either injecting the watcher so it can be mocked
or changing it into a Service. This may be more effort than you want to put
in for a change that won't live beyond 2.x. (See why below)
I would see no problem with just giving TestLoader a Watcher property
with a getter only in order to test that the watcher changes on reload.
There are no tests _at_all_for reload, so I suggest adding them before
you refactor.
Future Implications...
This whole area around TestLoader needs a lot of restructuring, particularly
as we move to distributed testing.
File watching will probably be removed from this level and placed in what
is now called the core so we can work across machines. Alternatively,
it may go into a small stub - similar to the existing nunit-agent - that
controls execution on each machine. In any case, it will be separated
more cleanly from TestLoader.
Thanks for your help! I'd like to add you to the dev team. See /launchpad. net/~nunit- dev
https/
Charlie
Alternatively, it may be