Skip to content

Commit 6a51345

Browse files
committed
Created Tests/UnitTestsParallelizable.
Moved all obviously parallelizable tests. Updated yml.
1 parent f8b2428 commit 6a51345

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+8227
-5
lines changed

.github/workflows/unit-tests.yml

+53-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '**.md'
1212

1313
jobs:
14-
build_and_test_debug:
14+
build_and_test_debug_non_parallel:
1515

1616
runs-on: ${{ matrix.os }}
1717
strategy:
@@ -23,8 +23,6 @@ jobs:
2323
timeout-minutes: 10
2424
steps:
2525

26-
# Build (Debug)
27-
2826
- name: Checkout code
2927
uses: actions/checkout@v4
3028

@@ -65,6 +63,58 @@ jobs:
6563
logs/
6664
TestResults/UnitTests/
6765
66+
build_and_test_debug_parallel:
67+
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
# Turn off fail-fast to let all runners run even if there are errors
71+
fail-fast: true
72+
matrix:
73+
os: [ ubuntu-latest, windows-latest, macos-latest ]
74+
75+
timeout-minutes: 10
76+
steps:
77+
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
81+
- name: Setup .NET Core
82+
uses: actions/setup-dotnet@v4
83+
with:
84+
dotnet-version: 8.x
85+
dotnet-quality: 'ga'
86+
87+
- name: Install dependencies
88+
run: |
89+
dotnet restore
90+
91+
- name: Build Solution Debug
92+
run: dotnet build --configuration Debug --no-restore
93+
94+
# Test
95+
# Note: The --blame and VSTEST_DUMP_PATH stuff is needed to diagnose the test runner crashing on ubuntu/mac
96+
# See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
97+
# Without it, the test runner crashes on ubuntu (but not Windows or mac)
98+
99+
- name: Set VSTEST_DUMP_PATH
100+
shell: bash
101+
run: echo "{VSTEST_DUMP_PATH}={logs/${{ runner.os }}/}" >> $GITHUB_ENV
102+
103+
- name: Run UnitTests
104+
run: |
105+
dotnet test Tests/UnitTestsParallelizable --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings Tests/UnitTestsParallelizable/coverlet.runsettings --diag:logs/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always -- xunit.stopOnFail=true
106+
107+
# mv -v Tests/UnitTests/TestResults/*/*.* TestResults/UnitTests/
108+
109+
- name: Upload Test Logs
110+
if: always()
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: test-logs-${{ runner.os }}
114+
path: |
115+
logs/
116+
TestResults/UnitTestsParallelizable/
117+
68118

69119
build_release:
70120
# Ensure that RELEASE builds are not broken

NoSamples.slnf

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"Terminal.Gui\\Terminal.Gui.csproj",
66
"UICatalog\\UICatalog.csproj",
77
"Tests\\UnitTests\\UnitTests.csproj",
8+
"Tests\\UnitTestsParallelizable\\UnitTests.Parallelizable.csproj",
89
"Tests\\IntegrationTests\\IntegrationTests.csproj",
9-
"Tests\\StressTests\\StressTests.csproj" ]
10+
"Tests\\StressTests\\StressTests.csproj"
11+
]
1012
}
1113
}

Release.slnf

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"Terminal.Gui\\Terminal.Gui.csproj",
66
"UICatalog\\UICatalog.csproj",
77
"Tests\\UnitTests\\UnitTests.csproj",
8+
"Tests\\UnitTestsParallelizable\\UnitTests.Parallelizable.csproj",
89
"Tests\\IntegrationTests\\IntegrationTests.csproj",
910
"Tests\\StressTests\\StressTests.csproj"
1011
]

Terminal.Gui/Terminal.Gui.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
<!-- =================================================================== -->
8383
<ItemGroup>
8484
<InternalsVisibleTo Include="UnitTests" />
85+
<InternalsVisibleTo Include="UnitTests.Parallelizable" />
8586
<InternalsVisibleTo Include="StressTests" />
8687
<InternalsVisibleTo Include="IntegrationTests" />
8788
<InternalsVisibleTo Include="TerminalGuiDesigner" />

Terminal.sln

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Settings", "Settings", "{B8
2020
.filenesting.json = .filenesting.json
2121
.gitignore = .gitignore
2222
Directory.Build.props = Directory.Build.props
23-
GitVersion.yml = GitVersion.yml
2423
Directory.Packages.props = Directory.Packages.props
24+
GitVersion.yml = GitVersion.yml
2525
global.json = global.json
2626
nuget.config = nuget.config
2727
Terminal.sln.DotSettings = Terminal.sln.DotSettings
@@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "Tests\I
5858
EndProject
5959
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StressTests", "Tests\StressTests\StressTests.csproj", "{96ACE8BA-2E07-7537-FBF2-E8176CCB8080}"
6060
EndProject
61+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Parallelizable", "Tests\UnitTestsParallelizable\UnitTests.Parallelizable.csproj", "{DE780834-190A-8277-51FD-750CC666E82D}"
62+
EndProject
6163
Global
6264
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6365
Debug|Any CPU = Debug|Any CPU
@@ -108,6 +110,10 @@ Global
108110
{96ACE8BA-2E07-7537-FBF2-E8176CCB8080}.Debug|Any CPU.Build.0 = Debug|Any CPU
109111
{96ACE8BA-2E07-7537-FBF2-E8176CCB8080}.Release|Any CPU.ActiveCfg = Release|Any CPU
110112
{96ACE8BA-2E07-7537-FBF2-E8176CCB8080}.Release|Any CPU.Build.0 = Release|Any CPU
113+
{DE780834-190A-8277-51FD-750CC666E82D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114+
{DE780834-190A-8277-51FD-750CC666E82D}.Debug|Any CPU.Build.0 = Debug|Any CPU
115+
{DE780834-190A-8277-51FD-750CC666E82D}.Release|Any CPU.ActiveCfg = Release|Any CPU
116+
{DE780834-190A-8277-51FD-750CC666E82D}.Release|Any CPU.Build.0 = Release|Any CPU
111117
EndGlobalSection
112118
GlobalSection(SolutionProperties) = preSolution
113119
HideSolutionNode = FALSE

Tests/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Terminal.Gui Tests
2+
3+
This folder contains the tests for Terminal.Gui.
4+
5+
## ./UnitTests
6+
7+
This folder contains the unit tests for Terminal.Gui that can not be run in parallel. This is because they
8+
depend on `Application` or other class that use static state or `ConfigurationManager`.
9+
10+
We should be striving to move as many tests as possible to the `./UnitTestsParallelizable` folder.
11+
12+
## ./UnitTestsParallelizable
13+
14+
This folder contains the unit tests for Terminal.Gui that can be run in parallel.
15+
16+
## ./IntegrationTests
17+
18+
This folder contains the integration tests for Terminal.Gui.
19+
20+
## ./StressTests
21+
22+
This folder contains the stress tests for Terminal.Gui.
23+
24+
## ./PerformanceTests
25+
26+
This folder WILL contain the performance tests for Terminal.Gui.
27+
28+
29+
See the [Testing wiki](https://github.com/gui-cs/Terminal.Gui/wiki/Testing) for details on how to add more tests.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global using CM = Terminal.Gui.ConfigurationManager;

0 commit comments

Comments
 (0)