NCover Collector Merge and Sync Control

NCover Collector and Code Central provide a robust framework for collecting code coverage in testing and quality assurance environments.  These tools make it easier to collect coverage unattended with and provide collection configuration.  Using Code Central as the administrative hub, projects for code collection are defined and pushed to all active NCover Collectors.  Each change to these projects is kept in sync with the authenticated collectors, and as the collectors do their work the coverage is sent to Code Central for reporting purposes.

In default operation, Code Central will constantly receive coverage uploads from Collector machines whenever a covered process execution completes.  In some scenarios it is desirable to interrupt that continuous operation and upload coverage in batches.  Such scenarios may include offline testing, regression testing, or even offshore QA.  Default operation in an offline environment continually gathers coverage, storing the data for the next available connection to Code Central server.  Rather than leave the data synchronization gateway at the control of network connections NCover does provide manual controls to pause and resume data synchronization to Code Central. With the release of v4.1.2115.1049 that feature has been extended to the command line.

Two commands have been added to the command line which gives the user control over data synchronization to Code Central.  Those commands are “sync-enable” and “sync-disable.”  The arguments provided to these commands are the familiar –project option and the –all.  Specifying a single project will enable or disable the data transfers for that project.  Using the –all will have the same effect on all Code Central projects on the local Collector or Desktop machine.  In the case of NCover Desktop, these commands have no effect on projects which were not defined on Code Central.

> ncover sync-enable

Usage: NCover Sync-enable [project name] [--all] 
          project name -- NCover coverage project name

> ncover sync-disable

Usage: NCover Sync-disable [project name] [--all] 
          project name -- NCover coverage project name
 A typical use case for these commands would be to exercise more control over the data synchronized to Code Central in the scripting of a build or testing environment.  If the intent is to create a build, run a set of tests, merge that data to a single execution, and then sync the merged execution to Code Central the sequence of events would resemble the following:
> ncover sync-disable "my_project"
> SET NCOVER_BUILD_ID="My_Build_1"
> {build steps}
> {testing steps}
> ncover merge --project="my_project" --build-id="My_Build_1" 
> ncover sync-enable "my_project"

At the end of the build and testing script, the sync-enable command will return the local project to active synchronization with Code Central.  In addition to changing the setting the command also triggers and immediate sync process.  In this way it is possible to control the merge content through client scripting before the data is sent to Code Central.