-
Notifications
You must be signed in to change notification settings - Fork 60
Code layout
This section provides information about the source code and internal organization of AxoCover. It is recommended to start here if you want to contribute to the project.
AxoCover is a Visual Studio extension, which integrates OpenCover to the IDE. It has two main components:
- A runner which is responsible for test discovery and execution.
- A plug-in which runs in the Visual Studio process, this exposes the functionality of the runner to the user, provides coverage visualization and other services.
These two components communicate over a TCP connection (default) or memory pipe, depending on settings.
Below is a short summary of the AxoCover.sln projects.
- AxoCover: the main component of AxoCover, it contains the UI, the control logic and coverage processing.
- AxoCover.Common: contains code which is shared between the runner and the UI plug-in.
- AxoCover.Dependencies: it is used to collect and embed external dependencies in VSIX. External dependencies include OpenCover, ReportGenerator and wrappers for various test frameworks.
- AxoCover.Host-x64 / AxoCover.Host-x86: these are the loaders for x64 / x86 tests respectively, they call AxoCover.Runner and have no other testing specific code inside them.
- AxoCover.Native: this project contains the native code for the test runner, mostly used for Windows API hooking to ensure the proper versions of test frameworks are loaded.
- AxoCover.Native.Build: used to build the above project in both x86 / x64 platforms.
- AxoCover.ReleaseTrigger: this project is used to tag AxoCover builds on GitHub, its output is not part of the AxoCover package.
- AxoCover.Runner: contains the test runner, used for discovery and execution.
- AxoCover.Tests: the unit tests of AxoCover.
Here is a short list of the main classes of AxoCover, which should provide a good starting point for AxoCover development:
- TestExplorerViewModel: this class contains the main control logic for the plug-in. Particular points of interest are RunTestItem (used to run / cover / debug tests), and LoadSolution (used to perform test discovery and display results).
- LineCoverageAdornment: this class contains the code for displaying code coverage.
- EditorContext: a wrapper for Visual Studio functionality such as build, locating code files etc.
- TestProvider: used for invoking test discovery.
- AxoTestRunner: used for invoking test execution.
- ResultProvider: provides test results such as test outcome, exceptions etc. Used by the tests tab and editor adornments.
- CoverageProvider: provides coverage results. Used by the report tab and editor adornments.
To work with multiple test frameworks AxoCover reuses the code of their Visual Studio plug-ins, with some customization. As of now xUnit and NUnit3 uses custom extensions to provide some additional AxoCover functionality, while NUnit2 and MSTest uses the adapters as is. You can find the forks under by name on GitHub.
Unfortunately in most cases different versions of the test adapter and framework DLLs cannot be mixed, to overcome this AxoCover ships the appropriate version of test framework DLLs as well. To ensure that the proper DLLs are loaded, AxoCover redirects the DLLs at runtime.