| || |
I have searched the forums and not found any answer to my troubles. I am also uncertain if this post perhaps belongs better to the .NET topic. I am sorry for the somewhat lengthy post, the reason is I am trying to state the problem as clearly as possible =)
I am trying to figure out how to organize a visual studio vb.net solution to make it possible to execute automated unit tests. I encounter problems when creating stubs.
When testing an existing system, for which I am not allowed to change the structure (projects, namespaces and so on) or the implementation (only correcting faults is allowed), I have the following situation:
-- Project "Handlers"
--- Class "Rodscanner"
-- Project "PRSFasader"
--- Class "LoggFasad"
-- Project "HandlersTest"
--- Linked Class "Rodscanner"
--- Class "RodscannerTest"
--- Class "LoggFasad" (stub)
I want to test the class Rodscanner in namespace WE.PRS.HANDLERS located in the project Handlers.
The rodscanner class uses the class LoggFasad in namespace WE.PRS.FASADER located in the project PRSFasader (in the same solution). The Rodscanner class contains an "imports WE.PRS.FASADER" statement.
I create another project called HandlersTest. In the HandlersTest project I link to the file Rodscanner.vb (the class to be tested). I also create a class called RodscannerTest in the HandlerTest project, where test cases for the Rodscanner class will be implemented.
Now I need to make a stub for the LoggFasad class to make it possible to observe and control the LoggFasad class (i cannot use mock objects, as no interfaces are used). Is it possible to force the linked Rodscanner class in the HandlersTest project to use a stub located in the HandlersTest project instead of the real LoggFasad in the PRSFasader project?
I do not want to make a copy of the Rodscanner class in the HandlersTest project, because then I would have to make changes in two files if I had to correct a fault.
Again, the question is: Is it possible to make the linked Rodscanner class in the HandlersTest project use the stub LoggFasad so that test
can be automatically run, but make the Rodscanner class in the Handlers project use the real LoggFasad class?
If it is not possible in the situation described above, is there another way of organizing a solution so that it is not necessary to change between a stub class and the class containing the real implementation manually?
Re: Organizing stubs
I have a very similar problem whith Namespaces and Projects.
I can offer you a solution in .NET, java etc but I have not found a solution in TestPartner.
Have you found the answer yet?