You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds `Aspire.Workload.Tests` which are meant to exercise the `aspire` workload. The individual tests create projects from templates just like a user would, and then run, and validate them.
It uses the existing infrastructure from `Aspire.EndToEnd.Tests` to install sdk+workload for testing.
- Enables tests on Linux, and Windows
- Because we don't have docker support on helix/Windows yet, the docker dependent tests are skipped on windows
## Tests
Two kinds of tests are being added here:
1. Tests that create+build a `aspire-starter` template project, and then some tests interact with that running app to validate it
2. Individual tests exercise the various templates, for example to create `aspire-starter` with [xunit,nunit,mstest] options
- The tests also connect to the dashboard and validate that the expected services show up as expected using `Playwright`.
- Some tests also connect to the webapp in `aspire-starter` template to validate some parts of it.
Fixesdotnet#47 .
Follow up work is tracked in dotnet#4222
Co-authored-by: Eric Erhardt <[email protected]>
Co-authored-by: Jose Perez Rodriguez <[email protected]>
1.[Install the sdk+workload](../Aspire.Workload.Tests/README.md#install-the-sdkworkload)
8
+
9
+
### Using it from VS
10
+
11
+
- For switching to `outside-of-repo` add `<TestsRunningOutsideOfRepo>true</TestsRunningOutsideOfRepo>` to `tests/Aspire.EndToEnd.Tests/Directory.Build.props`*before* any imports.
12
+
- tests cannot be run at this point as they will fail complaining about `artifacts/bin/dotnet-latest` being missing
13
+
- Install the sdk+workload following the steps above
14
+
- Run/debug the tests normally now, and they will be using the sdk
15
+
- Also note that in this case the testproject is run from the bindir for `Aspire.EndToEnd.Tests`, so a path like `artifacts/bin/Aspire.EndToEnd.Tests/Debug/net8.0/testassets/testproject/`
16
+
17
+
### Using it from command line
18
+
19
+
- When running the tests you can either:
20
+
- set `<TestsRunningOutsideOfRepo>true</TestsRunningOutsideOfRepo>` to `tests/Aspire.EndToEnd.Tests/Directory.props` before any imports
21
+
- or set the environment variable `TestsRunningOutsideOfRepo=true`
22
+
23
+
## (details) What is the goal here?
24
+
25
+
1. We want to run some EndToEnd tests on CI, which can `dotnet run` an aspire project,
26
+
and allow individual tests to interact with the services.
27
+
This requires:
28
+
29
+
- Ability to build, and run an aspire project - IOW, a sdk with the `aspire` workload installed.
30
+
- `docker`
31
+
32
+
2. Also, allow using `TestProject.*` in `tests/testproject`, in two modes:
33
+
-`in-repo` test run which directly reference aspire projects, and repo targets
34
+
-`outside-of-repo` test runs which uses a SDK+workload based on local build output
- This can switch between the two test run modes using the msbuild property `$(TestsRunningOutsideOfRepo)`
45
+
- when running `in-repo` the test project directly references hosting targets, and aspire projects via `ProjectReference`
46
+
- when running `outside-of-repo` the `ProjectReferences` and imports are replaced with `PackageReferences` to the Aspire nugets
47
+
- Default is to run `in-repo`
48
+
49
+
### Helix
50
+
51
+
- The tests are built on the build machine
52
+
- The testproject, and the sdk+workload is sent to helix
53
+
- where the tests run using `dotnet` from the sdk+workload path
54
+
- Since `docker` is needed to helix, this is enabled only for `Linux` in this PR. Blocked on https://github.com/dotnet/dnceng/issues/2067 for windows support.
0 commit comments