As a part of code coverage testing, I need to test several services. The OpenCover github mentions the ability to do this (Issue #36), but doesn't tell you how. The wiki "Usage" page doesn't mention anything about this. opencover -?
brings up a mention of the -service
switch, without any description of what it does, exactly or how to use it. Can anyone tell me how this switch works and how I can hook into a service with it?
Asked
Active
Viewed 582 times
2

psamsonov
- 23
- 5
1 Answers
1
When you install OpenCover you will find that there is a document called Usage.rtf that describes how to use OpenCover against a service.
Basically you have to run OpenCover under an Administration account with pre-registered Profilers (use regsvr32). The service switch should supply the name of the service.
It is quite tricky to do which is why I recommend you create your service with a console mode of operation as then doing coverage under a normal user account has less restrictions and is much easier to setup.

Shaun Wilde
- 8,228
- 4
- 36
- 56
-
Thank you very much! One more question, when doing a coverage test for a service, how do I specify the PDBs? Using `-targetdir` doesn't work, even after moving the PDBs to a simple directory like "C:\". – psamsonov Feb 09 '12 at 19:59
-
You should be able to keep the PDBs in the same folder as the service - that is how it has worked for me. If it isn't working as expected, please raise the issue as a bug on GitHub; preferably with a sample that helps replicate the issue. – Shaun Wilde Feb 09 '12 at 22:29