diff --git a/.gitignore b/.gitignore index f4c51bb..d06a803 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,4 @@ start-docs.sh watch.sh LICENSE to_delete.md -/.vs +/.vs \ No newline at end of file diff --git a/integration/code-coverage/codecoverage-tools.md b/integration/code-coverage/codecoverage-tools.md index b263394..972b823 100644 --- a/integration/code-coverage/codecoverage-tools.md +++ b/integration/code-coverage/codecoverage-tools.md @@ -48,5 +48,3 @@ Reinstalling or repairing the installation of a 3rd party profiler tool, as well * [NCover]({%slug justmock/integration/ncover%}) - * [OpenCover]({%slug justmock/integration/opencover%}) - diff --git a/integration/code-coverage/ncover.md b/integration/code-coverage/ncover.md index 3b6a9a9..a1565f5 100644 --- a/integration/code-coverage/ncover.md +++ b/integration/code-coverage/ncover.md @@ -84,5 +84,3 @@ Having the profilers linked must be enough for using both JustMock and NCover in * [Code Coverage Tools]({%slug justmock/integration/codecoverage-tools%}) - * [OpenCover]({%slug justmock/integration/opencover%}) - diff --git a/integration/code-coverage/opencover.md b/integration/code-coverage/opencover.md deleted file mode 100644 index fbbe917..0000000 --- a/integration/code-coverage/opencover.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: OpenCover -page_title: OpenCover | JustMock Documentation -description: Integrate Telerik JustMock with OpenCover -slug: justmock/integration/opencover -tags: opencover -published: True -position: 12 -previous_url: integration-opencover.html, integration-opencover, integration-partcover, integration-partcover.html ---- - -# OpenCover - -__OpenCover__ is an open source code coverage tool for .NET 2 and above. __OpenCover__ is most commonly used to gather coverage data of code that is being exercised by unit testing (i.e. nunit, mstest etc.). - -This article explains how to integrate Telerik® JustMock with __OpenCover__. - -1. Start by registering the OpenCover profiler. Run cmd.exe as Administrator and execute the following lines: - `regsvr32 "c:\Program Files (x86)\OpenCover\x64\OpenCover.Profiler.dll"` - - `regsvr32 "c:\Program Files (x86)\OpenCover\x86\OpenCover.Profiler.dll"` - - >You may need to change the paths in the commands above if OpenCover is deployed somewhere else on your machine. - -1. Once the OpenCover.Profiler.dll is registered, link it with the JustMock profiler. How to link them is better described [here]({%slug justmock/integration/codecoverage-tools%}). - - ![Open Cover Link Profilers](images/OpenCoverLinkProfilers.png) - -1. Set the __JUSTMOCK_INSTANCE__ environment variable to __"1"__. Do this by inserting the following line in the previously opened command prompt: - - `SET JUSTMOCK_INSTANCE=1` - -1. Collect the coverage data of your assemblies: - - For example: - - `"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -mergebyhash –target:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" -output:"coverage.xml" -targetargs:"/testcontainer:justmockTestproject1.dll"` - -1. Continue by generating a coverage report (for example, using the ReportGenerator), and checking the test results. If everything is set up as described, your elevated JustMock tests must pass: - - ![Open Cover Test Results](images/OpenCoverTestResults.png) - -## See Also - - * [CodeCoverage Tools]({%slug justmock/integration/codecoverage-tools%}) - - * [NCover]({%slug justmock/integration/ncover%}) diff --git a/integration/justmock-console/general.md b/integration/justmock-console/general.md index 6d7e0df..1864be9 100644 --- a/integration/justmock-console/general.md +++ b/integration/justmock-console/general.md @@ -57,7 +57,7 @@ Run the tests with the JustMock profier existing in the specified path using .NE justmock-console runadvanced -p "\full\path\to\default\Telerik.CodeWeaver.Profiler.dll" -c "dotnet" -a "test --no-build \"\path\to\JustMock.Tests\"" ``` -Run the tests with the JustMock profier existing in the specified path and OpenCover integration using Command Line Tool for Windows:: +Run the tests with the JustMock profier existing in the specified path and [OpenCover]({%slug justmock/integration/profiler-integration%}) integration using Command Line Tool for Windows:: ```bat OpenCover.Console -target:"Telerik.JustMock.Console" -targetargs:"runadvanced -p \"\full\path\to\default\Telerik.CodeWeaver.Profiler.dll\" -c vstest.console -a vstest \"\full\path\to\JustMock.Tests.dll\" -l" -output:opencovertests.xml diff --git a/integration/justmock-console/profiler-integrations.md b/integration/justmock-console/profiler-integrations.md new file mode 100644 index 0000000..73d0b78 --- /dev/null +++ b/integration/justmock-console/profiler-integrations.md @@ -0,0 +1,37 @@ +--- +title: Third-party Profilers Integration +page_title: Third-party Profilers Integration | JustMock Documentation +description: Integrate Telerik JustMock with third-party profilers +slug: justmock/integration/profiler-integration +tags: profiler +published: True +position: 4 +previous_url: /integration-justmock-console-profiler-integration, /integration-justmock-console-profiler-integration.html +--- + +# Third-party Profilers Integration + +This article explains how to integrate third-party profilers with the profiler used by JustMock. In most cases, integration is handled automatically through the [JustMock Configuration Tool]({%slug justmock/integration/codecoverage-tools%}), which allows users to enable supported profilers with a simple checkbox. However, when a profiler is not listed or auto-detection fails, JustMock provides a manual method for linking external profilers using the `--link-existing-profiler` (`-l`) option in the JustMock Console. + +## Generic Command Structure + +To link JustMock with an external profiler, users should invoke the external profiler’s console application and set the `-target` to Telerik.JustMock.Console.exe. +The `-targetargs` parameter must include the JustMock execution command, starting with `runadvanced`, followed by `-c` to specify the test runner (e.g., vstest.console.exe), and `-a` to provide the full path to the test assembly (e.g., MyTests.dll). +The profiler paths for 32-bit and 64-bit architectures must be provided using `--profiler-path-32` and `--profiler-path-64`, followed by `-l` to enable linking. + +```bat +"full\path\to\ProfilerTool.Console.exe" -target:"%JUSTMOCK_BINARY_PATH%\Telerik.JustMock.Console.exe" -targetargs:"runadvanced -c \"full\path\to\vstest.console.exe\" -a \"full\path\to\MyTests.dll\" --profiler-path-32 \"%JUSTMOCK_PACKAGE_PATH%\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll\" --profiler-path-64 \"%JUSTMOCK_PACKAGE_PATH%\CodeWeaver\64\Telerik.CodeWeaver.Profiler.dll\" -l" +``` + +**Note:** Before executing the command, ensure that: + - The profiling tool is downloaded and extracted. + - JustMock is installed. + - Your solution and test project are ready. + +## OpenCover Example + +For a clearer understanding of how to structure this integration, the following example demonstrates how JustMock can be linked with `OpenCover` using a fully composed command. + +```bat +"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -target:"%JUSTMOCK_BINARY_PATH%\Telerik.JustMock.Console.exe" -targetargs:"runadvanced -c \"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\vstest.console.exe\" -a \"C:\Users\Administrator\source\repos\MyTests\MyTests\bin\Debug\net8.0\MyTests.dll\" --profiler-path-32 \"%JUSTMOCK_PACKAGE_PATH%\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll\" --profiler-path-64 \"%JUSTMOCK_PACKAGE_PATH%\CodeWeaver\64\Telerik.CodeWeaver.Profiler.dll\" -l" +```