dotCover snapshot reusable and update only changed unit tests query
Answered
Hi,
We recently upgraded the license to Resharper Ultimate to use dotCover. But, I am facing difficulty to use it.
Currently I am facing two difficulties:
1. When unit tests executed locally it takes time, so I used to execute few unit tests at a time to get code coverage, but when some other code changes are pushed on repository then I need to calculate code coverage again. But, if VS hangs or restarted or rebuilt then all the calculations get lost and also even I saved the previous snap shot but could not find any way to bind the already calculated snap shot or as per site doc, only changed unit test recalculated does not work as all test cases are marked for recalculation.
2. On teamcity, we have configured dotCover, with the service running on self hosted window service. unit tests are written for REST apis hosted in service when called are not calculated in code coverage. Is there any convenient way to get it calculated.
Please sign in to leave a comment.
Hello Goyal!
1. Are you using Continuous Testing or regular Unit Testing? If the latter, you can bind snapshot to a unit testing session like this:
2. Could you please provide more details about this case?
How do you launch dotCover? What process it should profile? Does this process spawn any child processes? In which process located code that need to be covered?
Hi,
As in following options, we tried most of the possible ways, i.e. create new session do have nothing in it when opened and no way to attach unit tests as its empty, as shown in second screenshot. Also, when tried to open existing session it already have code coverage with empty results for REST project code and no way to attach the saved snapshot.
We are using CI.
We use dotCover with Unit Tests option as otherwise we could not find option to execute test cases and observe the coverage.
We expect dotCover should profile the services called by unit tests.
We use REST apis to call our service methods. All processes execute in same appdomain.
Also, please help me to know is there any special support for ultimate license, as with this way I feel its very slow as it took many days just to get one response.
Hi Jivan,
We are extremely sorry for the delayed responses!
You can load a previously saved snapshot to an empty Unit Test Session using "load" link on the "Coverage" tab (please see the screenshot).
Please notice that you should save a snapshot using "Save coverage snapshot as..." button, not "Export coverage report...".
Regarding services: in case of Unit Tests dotCover performs coverage analysis of the process in which tests are executing and of all its child processes. Therefore in order to get coverage results you should start and stop your service process from your tests process. Also it's important to stop your service gracefully - we can't get coverage results if a process has crashed or has been killed using TerminateProcess function.
Best regards.
Hi,
Thanks for response and trying to resolve issue. Yes, I have tried the option as above. I am able to load saved snapshot but in left pane unit tests are not loaded to run changed unit tests to observe new coverage results. So, can you guide how to manage:
- Load already saved snapshot with related test cases also loaded, having non changed and changed unit test status so that I only need to run changed unit tests to get latest code coverage report.
Hi,
I guess that Continuous Testing is what you need.
Please open Continuous Testing Session tool window (ReSharper >> Unit Testing >> Continuous Testing Session) and select "On 'Save' Build and Detect Dirty Tests" mode. In the left part of the window you will see all your tests in "Unknown" status. You should run all tests once in order to get initial results (please use "Run All Shown Tests" button).
After that every time you save changes in your source code dotCover will detect which tests you should rerun. In order to run all changed tests please use "Run All Dirty Tests" button.
Tests and coverage results will be automatically loaded every time you open the solution.
You can find more details on Continuous Testing feature here: https://www.jetbrains.com/dotcover/help/Continuous_Testing.html
Best regards.