Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ static code coverage examples #134

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/VisualStudio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
3. [**Scenario 03** Merge coverage reports](scenarios/scenario03/README.md)
4. [**Scenario 04** Coverage report views](scenarios/scenario04/README.md)
5. [**Scenario 05** Search](scenarios/scenario05/README.md)
6. [**Scenario 06** C++ code coverage in Visual Studio](scenarios/scenario06/README.md)
7. [**Scenario 07** C++ code coverage in Visual Studio ARM64](scenarios/scenario07/README.md)
30 changes: 30 additions & 0 deletions samples/VisualStudio/scenarios/scenario06/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Scenario Description

Static C++ code coverage for [google test adapter](https://github.com/microsoft/TestAdapterForGoogleTest) samples tests in Visual Studio.

## Collect C++ code coverage

1. Clone [google test adapter](https://github.com/microsoft/TestAdapterForGoogleTest) repository

```shell
git clone https://github.com/microsoft/TestAdapterForGoogleTest.git
```

2. Open solution in Visual Studio Enterprise

```shell
cd TestAdapterForGoogleTest/SampleTests
start SampleTests.sln
```

3. Enable **Profile** (Configuration Properties->Linker->Advanced) flag for all projects in solution

![alt text](profile_flag.png "Profile linker flag.")

4. Collect code coverage using **Analyze Code Coverage for All Tests** in the **Test** menu

![alt text](analyze.png "Test menu with Analyze Code Coverage for All Tests command.")

5. View code coverage results

![alt text](results.png "Code coverage results.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions samples/VisualStudio/scenarios/scenario07/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Scenario Description

Static C++ code coverage for new Native Unit Test project in Visual Studio ARM64.

## Collect C++ code coverage on ARM64 system

1. Open Visual Studio Enterprise

2. Create new Native Unit Test project.

![alt text](create.png "Create Native Unit Test Project.")

3. Enable **Profile** (Configuration Properties->Linker->Advanced) flag for all projects in solution

![alt text](profile-flag.png "Profile linker flag.")

4. Collect code coverage using **Analyze Code Coverage for All Tests** in the **Test** menu

![alt text](analyze.png "Test menu with Analyze Code Coverage for All Tests command.")

5. View code coverage results

![alt text](results.png "Code coverage results.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.