Skip to content

Commit ac55fe6

Browse files
authored
Merge pull request #7015 from MicrosoftDocs/master637660479503171666
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 0e2c775 + 4dab0f2 commit ac55fe6

File tree

6 files changed

+134
-2
lines changed

6 files changed

+134
-2
lines changed
25.4 KB
Loading
23.2 KB
Loading
24.3 KB
Loading

docs/test/remote-testing.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: Remote Testing in Visual Studio
3+
description: Learn how to use remote testing in Visual Studio Test Explorer to run tests from remote environments including containers, WSL2, or over SSH connections. This topic covers how to configure remote testing with a testenvironments.json for either local containers, WSL2, or SSH connections.
4+
ms.date: 08/26/2021
5+
ms.topic: how-to
6+
author: mikejo5000
7+
ms.author: mikejo
8+
manager: jmartens
9+
ms.technology: vs-ide-test
10+
monikerRange: '>= vs-2022'
11+
ms.workload:
12+
- multiple
13+
---
14+
# Remote Testing (experimental preview)
15+
16+
Remote testing enables developers to connect Visual Studio 2022 to remote environments for running and debugging tests. This functionality is useful for cross-platform developers who deploy code to multiple different target environments such as different Windows or Linux operating systems. For example, normally a developer would have to push changes to a CI pipeline to get feedback from a test running on Linux. With this feature, you can run Linux tests right from Visual Studio by connecting the Test Explorer to a remote environment.
17+
18+
Requirements for using this experimental version of remote testing:
19+
* Visual Studio 2022 Update 17.0 Preview 3 or later
20+
* Only available for .NET tests.
21+
* If you're interested in remote testing support for other languages, please [file a suggestion](/visualstudio/ide/suggest-a-feature) or upvote an existing suggestion. [Supporting C++ remote testing](https://developercommunity.visualstudio.com/t/run-c-unit-tests-on-linux-with-visual-studio/1403357).
22+
* Currently, the bulk of the provisioning of the environment is left to the user’s specification. The user must install the necessary dependencies in your target environment. For example, if your tests target .NET 5.0, you need to make sure the container has .NET 5.0 installed via your Dockerfile. There may be a prompt to install .NET Core on the remote environment, which is needed to run and discover tests remotely.
23+
* Plan to monitor your connection status to the remote environment using the Output > Tests pane. For example, if the container was stopped a message will appear in Output > Tests pane. We may not detect all scenarios, so plan to check your output if it looks like the connection was lost. In particular, if the Output pane isn't set to "Test", you may not immediately see the message. If the connection is lost, you can use the environment drop-down in the Test Explorer to set the connection back to your local environment and then select the remote environment again to reinitiate the connection.
24+
25+
## Set up the remote testing environment
26+
27+
Environments are specified using `testenvironments.json` in the root of your solution. The json file structure follows the schema described here:
28+
```json
29+
{
30+
"version": "1", // value must be 1
31+
"environments": [
32+
{ "name": "<unique name>", ... },
33+
...
34+
]
35+
}
36+
```
37+
38+
### Local container connections
39+
40+
To connect to a container running locally, you must have [Docker Desktop](https://www.docker.com/products/docker-desktop) on your local machine. Optionally, [enable WSL2 integration](/windows/wsl/install-win10) for better performance.
41+
42+
For a Dockerfile, the environment can be specified in `testEnvironments.json` in the root of your solution. It uses the properties described here.
43+
```json
44+
{
45+
"name": "<name>",
46+
"localRoot": "<path to local environment>", // optional
47+
"type": "docker",
48+
"dockerImage": "<docker image tag>",
49+
}
50+
```
51+
52+
The following example shows `testenvironments.json` for a local container image named \<mcr.microsoft.com/dotnet/core/sdk\>.
53+
```json
54+
{
55+
"version": "1",
56+
"environments": [
57+
{
58+
"name": "linux dotnet-core-sdk-3.1",
59+
"type": "docker",
60+
"dockerImage": "mcr.microsoft.com/dotnet/core/sdk"
61+
}
62+
]
63+
}
64+
```
65+
66+
The following example shows a Dockerfile for running tests targeting .NET 5.0. The second line makes sure the debugger can connect and run in your container.
67+
```
68+
FROM mcr.microsoft.com/dotnet/core/sdk:5.0
69+
70+
RUN wget https://aka.ms/getvsdbgsh && \
71+
sh getvsdbgsh -v latest -l /vsdbg
72+
```
73+
74+
The container must have a built image on your local machine. You can build a container using the following command (including the "." at the end): `docker build -t <docker image name> -f <path to Dockerfile> .`
75+
76+
### Local WSL2 connections
77+
To remotely run tests on WSL2, you must [enable WSL2 integration](/windows/wsl/install-win10) on your local machine.
78+
79+
The environment can be specified in `testEnvironments.json` in the root of your solution using the following schema and replacing \<Ubuntu\> with whatever WSL2 Distribution you've installed.
80+
```json
81+
{
82+
"version": "1",
83+
"environments": [
84+
{
85+
"name": "WSL-Ubuntu",
86+
"type": "wsl",
87+
"wslDistribution": "Ubuntu"
88+
}
89+
]
90+
}
91+
```
92+
93+
### SSH connections
94+
You can add or remove SSH connections in **Tools > Options > Cross Platform > Connection Manager**. Selecting "Add" will allow you to enter the host name, port, and any credentials you need.
95+
96+
The environment can be specified in `testEnvironments.json` in the root of your solution using the following schema and replacing the `\<ssh://user@hostname:22\>` with your SSH remoteUri.
97+
```json
98+
{
99+
"version": "1",
100+
"environments": [
101+
{
102+
"name": "ssh-remote",
103+
"type": "ssh",
104+
"remoteUri": "ssh://user@hostname:22"
105+
}
106+
]
107+
}
108+
```
109+
110+
## Use the Test Explorer to run and debug remote tests
111+
* The active environment is selected via a drop-down in the Test Explorer tool bar. Currently, only one test environment can be active at a time.
112+
113+
![Remote testing environment drop down in Test Explorer](media/remote_test_drop_down.png)
114+
115+
* Once an environment is selected, tests are discovered and run in the new environment.
116+
117+
![Tests are discovered and executed in remote environments](media/remote_test_linux_discovery.png)
118+
119+
* You can now run your tests inside the remote and debug your tests in environments!
120+
121+
![View test results from remote environment in the test explorer](media/remote_test_linux_passing.png)
122+
123+
* Test Explorer may prompt you to install some missing environment prerequisites and attempt to install missing dependencies. However, the bulk of the provisioning of the remote environment is up to the user’s specification.
124+
125+
## See also
126+
127+
- [Debug unit tests with Test Explorer](../test/debug-unit-tests-with-test-explorer.md)
128+
- [Run a unit test as a 64-bit process](../test/run-a-unit-test-as-a-64-bit-process.md)
129+
- [Test Explorer FAQ](test-explorer-faq.md)

docs/test/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,5 @@
402402
href: lab-management/use-build-or-rm-instead-of-lab-management.md
403403
- name: Install test agents and test controllers
404404
href: lab-management/install-configure-test-agents.md
405+
- name: Remote testing in Visual Studio
406+
href: remote-testing.md

subscriptions/exporting-subscriptions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: Export subscription information in Visual Studio subscriptions| Microsoft Docs
33
author: evanwindom
4-
ms.author: v-evwin
4+
ms.author: cabuschl
55
manager: cabuschl
66
ms.assetid: 14e4cffb-a695-436c-b269-7820f7411f4e
7-
ms.date: 03/21/2021
7+
ms.date: 08/31/2021
88
ms.topic: conceptual
99
description: Learn how to export a list of subscribers and details of their subscription assignments.
1010
---
@@ -26,6 +26,7 @@ To perform the export:
2626
2. Select the **Export** tab. and the file will download to your local machine. The file will include the name of the agreement that contains your user subscriptions, as well as the date of the export.
2727
> [!div class="mx-imgBorder"]
2828
> ![Export subscribers](_img/exporting-subscriptions/exporting-subscriptions.png "Click Export to download a complete list of your assigned subscriptions.")
29+
3. The exported list will appear in the normal location for downloaded files on your computer in a .csv file format. The file name will include the agreement number and the date on which you exported the list.
2930

3031
## Resources
3132
- [Subscriptions Support](https://aka.ms/vsadminhelp)

0 commit comments

Comments
 (0)