diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 11:40:45 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 12:35:15 -0500 |
commit | 031991f32f059b64374e6d257cbe573304dd577f (patch) | |
tree | 9d11ebb5d8595bf45c507f38d637b14915af7630 /src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs | |
parent | ad6d2636f60b04ee68656f99fb3bd56a86ba5983 (diff) | |
download | wix-031991f32f059b64374e6d257cbe573304dd577f.tar.gz wix-031991f32f059b64374e6d257cbe573304dd577f.tar.bz2 wix-031991f32f059b64374e6d257cbe573304dd577f.zip |
Add ability to skip tests at runtime, and skip long running cache tests
6665
Diffstat (limited to 'src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs')
-rw-r--r-- | src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs b/src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs new file mode 100644 index 00000000..1da10df8 --- /dev/null +++ b/src/test/burn/WixTestTools/LongRuntimeFactAttribute.cs | |||
@@ -0,0 +1,27 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixTestTools | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | public class LongRuntimeFactAttribute : RuntimeFactAttribute | ||
8 | { | ||
9 | const string RequiredEnvironmentVariableName = "LongRuntimeTestsEnabled"; | ||
10 | |||
11 | public static bool LongRuntimeTestsEnabled { get; } | ||
12 | |||
13 | static LongRuntimeFactAttribute() | ||
14 | { | ||
15 | var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); | ||
16 | LongRuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled; | ||
17 | } | ||
18 | |||
19 | public LongRuntimeFactAttribute() | ||
20 | { | ||
21 | if (!LongRuntimeTestsEnabled) | ||
22 | { | ||
23 | this.Skip = $"These tests take a long time to run, so the {RequiredEnvironmentVariableName} environment variable must be set to true."; | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | } | ||