Dll problem
-
I have a C# application that tests a product my company developes. At the moment this application can be run on a ordinary laptop. I have now started to develope new tests that requires specific hardware and dll:s. These new tests can only be run on a computer that has this hardware installed. What is the best solution if I still want to be able to use the same application on an ordinary laptop to run the other tests that don't requires the new hardware? The "ordinary laptop" is missing the dll:s that my application is using to communicatio with the hardware.
-
I have a C# application that tests a product my company developes. At the moment this application can be run on a ordinary laptop. I have now started to develope new tests that requires specific hardware and dll:s. These new tests can only be run on a computer that has this hardware installed. What is the best solution if I still want to be able to use the same application on an ordinary laptop to run the other tests that don't requires the new hardware? The "ordinary laptop" is missing the dll:s that my application is using to communicatio with the hardware.
I can think of 3 ways you could do this: 1) Enable remote debugging in Visual Studio and run all the tests on a computer with the hardware installed. So your laptop can run the tests and the hardware also. 2) Add a few conditional compile options around the calls you have into the hardware specific DLLs - this makes them not execute at all. 3) Stub out the hardware DLLs on your dev laptop by creating special versions of them that run without the hardware attached. So basically, they can return to you known data when called, and do nothing when no return data is required.
-
I have a C# application that tests a product my company developes. At the moment this application can be run on a ordinary laptop. I have now started to develope new tests that requires specific hardware and dll:s. These new tests can only be run on a computer that has this hardware installed. What is the best solution if I still want to be able to use the same application on an ordinary laptop to run the other tests that don't requires the new hardware? The "ordinary laptop" is missing the dll:s that my application is using to communicatio with the hardware.
Load the DLL dynamically depending on the Hardware (take a look at Assembly.LoadFrom).
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
I can think of 3 ways you could do this: 1) Enable remote debugging in Visual Studio and run all the tests on a computer with the hardware installed. So your laptop can run the tests and the hardware also. 2) Add a few conditional compile options around the calls you have into the hardware specific DLLs - this makes them not execute at all. 3) Stub out the hardware DLLs on your dev laptop by creating special versions of them that run without the hardware attached. So basically, they can return to you known data when called, and do nothing when no return data is required.
I think the most widely used point for these situation is what you have proposed as 3rd option. Simply Mock your hardware specific assemblies (I don't know how hard that is), this way on a laptop you can test only your code and in the mocks implement whatever functionality you need assuming that "the hardware" works ok. When running the tests on the actual device you can simply remove the mock assemblies and you can also run your tests.