1212using System . Text . RegularExpressions ;
1313using System . Linq ;
1414using Install_Scripts . Test . Utils ;
15+ using Xunit . Abstractions ;
1516
1617namespace Microsoft . DotNet . InstallationScript . Tests
1718{
1819 public class GivenThatIWantToInstallDotnetFromAScript : IDisposable
1920 {
21+
2022 /// <summary>
2123 /// All the channels that will be tested.
2224 /// </summary>
@@ -142,12 +144,16 @@ public static IEnumerable<object?[]> InstallRuntimeFromChannelTestCases
142144 /// </summary>
143145 private readonly string _sdkInstallationDirectory ;
144146
147+ private readonly ITestOutputHelper outputHelper ;
148+
145149 /// <summary>
146150 /// Instantiates a GivenThatIWantToInstallTheSdkFromAScript instance.
147151 /// </summary>
148152 /// <remarks>This constructor is called once for each of the tests to run.</remarks>
149- public GivenThatIWantToInstallDotnetFromAScript ( )
153+ public GivenThatIWantToInstallDotnetFromAScript ( ITestOutputHelper testOutputHelper )
150154 {
155+ outputHelper = testOutputHelper ;
156+
151157 _sdkInstallationDirectory = Path . Combine (
152158 Path . GetTempPath ( ) ,
153159 "InstallScript-Tests" ,
@@ -184,6 +190,7 @@ public void Dispose()
184190 }
185191
186192 [ Theory ]
193+ [ Trait ( "MonitoringTest" , "true" ) ]
187194 [ MemberData ( nameof ( InstallSdkFromChannelTestCases ) ) ]
188195 public void WhenInstallingTheSdk ( string channel , string ? quality , string versionRegex )
189196 {
@@ -210,9 +217,12 @@ public void WhenInstallingTheSdk(string channel, string? quality, string version
210217 string regex = Regex . Escape ( " " ) + versionRegex + Regex . Escape ( " " ) + installPathRegex ;
211218 dotnetCommandResult . Should ( ) . HaveStdOutMatching ( regex ) ;
212219 commandResult . Should ( ) . NotHaveStdErr ( ) ;
220+
221+ TestOutputHelper . PopulateTestLoggerOutput ( outputHelper , commandResult ) ;
213222 }
214223
215224 [ Theory ]
225+ [ Trait ( "MonitoringTest" , "true" ) ]
216226 [ MemberData ( nameof ( InstallRuntimeFromChannelTestCases ) ) ]
217227 public void WhenInstallingDotnetRuntime ( string channel , string ? quality , string versionRegex )
218228 {
@@ -239,9 +249,12 @@ public void WhenInstallingDotnetRuntime(string channel, string? quality, string
239249 string regex = lineStartRegex + versionRegex + lineEndRegex ;
240250 dotnetCommandResult . Should ( ) . HaveStdOutMatching ( regex ) ;
241251 commandResult . Should ( ) . NotHaveStdErr ( ) ;
252+
253+ TestOutputHelper . PopulateTestLoggerOutput ( outputHelper , commandResult ) ;
242254 }
243255
244256 [ Theory ]
257+ [ Trait ( "MonitoringTest" , "true" ) ]
245258 [ MemberData ( nameof ( InstallRuntimeFromChannelTestCases ) ) ]
246259 public void WhenInstallingAspNetCoreRuntime ( string channel , string ? quality , string versionRegex )
247260 {
@@ -275,9 +288,12 @@ public void WhenInstallingAspNetCoreRuntime(string channel, string? quality, str
275288 string regex = lineStartRegex + versionRegex + lineEndRegex ;
276289 dotnetCommandResult . Should ( ) . HaveStdOutMatching ( regex ) ;
277290 commandResult . Should ( ) . NotHaveStdErr ( ) ;
291+
292+ TestOutputHelper . PopulateTestLoggerOutput ( outputHelper , commandResult ) ;
278293 }
279294
280295 [ Theory ]
296+ [ Trait ( "MonitoringTest" , "true" ) ]
281297 [ MemberData ( nameof ( InstallRuntimeFromChannelTestCases ) ) ]
282298 public void WhenInstallingWindowsdesktopRuntime ( string channel , string ? quality , string versionRegex )
283299 {
@@ -313,6 +329,8 @@ public void WhenInstallingWindowsdesktopRuntime(string channel, string? quality,
313329 commandResult . Should ( ) . NotHaveStdErr ( ) ;
314330 commandResult . Should ( ) . HaveStdOutContaining ( "Installation finished" ) ;
315331
332+ TestOutputHelper . PopulateTestLoggerOutput ( outputHelper , commandResult ) ;
333+
316334 // Dotnet CLI is not included in the windowsdesktop runtime. Therefore, version validation cannot be tested.
317335 // Add the validation once the becomes available in the artifacts.
318336 }
0 commit comments