Skip to content

Commit 635e5c3

Browse files
Add SecurityInsightsTestRunner and replace TestController (#18228)
1 parent 13fe2cf commit 635e5c3

File tree

9 files changed

+107
-235
lines changed

9 files changed

+107
-235
lines changed

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/ActionsTests.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,50 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class ActionsTests
20+
public class ActionsTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public ActionsTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public ActionsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void ListByAlertRule()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRuleAction-ListByAlertRule");
30+
TestRunner.RunTestScript("Get-AzSentinelAlertRuleAction-ListByAlertRule");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void GetAction()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRuleAction-GetAction");
37+
TestRunner.RunTestScript("Get-AzSentinelAlertRuleAction-GetAction");
4538
}
4639

4740
[Fact]
4841
[Trait(Category.AcceptanceType, Category.CheckIn)]
4942
public void CreateAction()
5043
{
51-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRuleAction-Create");
44+
TestRunner.RunTestScript("New-AzSentinelAlertRuleAction-Create");
5245
}
5346

5447
[Fact]
5548
[Trait(Category.AcceptanceType, Category.CheckIn)]
5649
public void UpdateAction()
5750
{
58-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelAlertRuleAction-Update");
51+
TestRunner.RunTestScript("Update-AzSentinelAlertRuleAction-Update");
5952
}
6053

6154
[Fact]
6255
[Trait(Category.AcceptanceType, Category.CheckIn)]
6356
public void RemoveAction()
6457
{
65-
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelAlertRuleAction-Delete");
58+
TestRunner.RunTestScript("Remove-AzSentinelAlertRuleAction-Delete");
6659
}
6760
}
6861
}

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/AlertRuleTemplatesTests.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,29 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class AlertRuleTemplatesTests
20+
public class AlertRuleTemplatesTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public AlertRuleTemplatesTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public AlertRuleTemplatesTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void List()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRuleTemplate-List");
30+
TestRunner.RunTestScript("Get-AzSentinelAlertRuleTemplate-List");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void Get()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRuleTemplate-Get");
37+
TestRunner.RunTestScript("Get-AzSentinelAlertRuleTemplate-Get");
4538
}
4639
}
4740
}

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/AlertRulesTests.cs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,78 +12,71 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class AlertRulesTests
20+
public class AlertRulesTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public AlertRulesTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public AlertRulesTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void ListAlertRules()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRule-List");
30+
TestRunner.RunTestScript("Get-AzSentinelAlertRule-List");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void GetAction()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRule-Get");
37+
TestRunner.RunTestScript("Get-AzSentinelAlertRule-Get");
4538
}
4639

4740
[Fact]
4841
[Trait(Category.AcceptanceType, Category.CheckIn)]
4942
public void CreateAlertRuleFusion()
5043
{
51-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateFusion");
44+
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateFusion");
5245
}
5346

5447
[Fact]
5548
[Trait(Category.AcceptanceType, Category.CheckIn)]
5649
public void CreateAlertRuleMSIC()
5750
{
58-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateMSIC");
51+
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateMSIC");
5952
}
6053

6154
[Fact]
6255
[Trait(Category.AcceptanceType, Category.CheckIn)]
6356
public void CreateAlertRuleScheduled()
6457
{
65-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateScheduled");
58+
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateScheduled");
6659
}
6760

6861
[Fact]
6962
[Trait(Category.AcceptanceType, Category.CheckIn)]
7063
public void UpdateAlertRule()
7164
{
72-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelAlertRule-Update");
65+
TestRunner.RunTestScript("Update-AzSentinelAlertRule-Update");
7366
}
7467

7568
[Fact]
7669
[Trait(Category.AcceptanceType, Category.CheckIn)]
7770
public void InputObject()
7871
{
79-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelAlertRule-InputObject");
72+
TestRunner.RunTestScript("Update-AzSentinelAlertRule-InputObject");
8073
}
8174

8275
[Fact]
8376
[Trait(Category.AcceptanceType, Category.CheckIn)]
8477
public void RemoveAlertRule()
8578
{
86-
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelAlertRule-Delete");
79+
TestRunner.RunTestScript("Remove-AzSentinelAlertRule-Delete");
8780
}
8881
}
8982
}

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/BookmarksTests.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,64 +12,57 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class BookmarksTests
20+
public class BookmarksTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public BookmarksTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public BookmarksTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void List()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelBookmark-List");
30+
TestRunner.RunTestScript("Get-AzSentinelBookmark-List");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void Get()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelBookmark-Get");
37+
TestRunner.RunTestScript("Get-AzSentinelBookmark-Get");
4538
}
4639

4740
[Fact]
4841
[Trait(Category.AcceptanceType, Category.CheckIn)]
4942
public void Create()
5043
{
51-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelBookmark-Create");
44+
TestRunner.RunTestScript("New-AzSentinelBookmark-Create");
5245
}
5346

5447
[Fact]
5548
[Trait(Category.AcceptanceType, Category.CheckIn)]
5649
public void Update()
5750
{
58-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelBookmark-Update");
51+
TestRunner.RunTestScript("Update-AzSentinelBookmark-Update");
5952
}
6053

6154
[Fact]
6255
[Trait(Category.AcceptanceType, Category.CheckIn)]
6356
public void InputObject()
6457
{
65-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelBookmark-InputObject");
58+
TestRunner.RunTestScript("Update-AzSentinelBookmark-InputObject");
6659
}
6760

6861
[Fact]
6962
[Trait(Category.AcceptanceType, Category.CheckIn)]
7063
public void Remove()
7164
{
72-
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelBookmark-Remove");
65+
TestRunner.RunTestScript("Remove-AzSentinelBookmark-Remove");
7366
}
7467
}
7568
}

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/DataConnectorsTests.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,64 +12,57 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class DataConnectorsTests
20+
public class DataConnectorsTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public DataConnectorsTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public DataConnectorsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void List()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelDataConnector-List");
30+
TestRunner.RunTestScript("Get-AzSentinelDataConnector-List");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void Get()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelDataConnector-Get");
37+
TestRunner.RunTestScript("Get-AzSentinelDataConnector-Get");
4538
}
4639

4740
[Fact]
4841
[Trait(Category.AcceptanceType, Category.CheckIn)]
4942
public void Create()
5043
{
51-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelDataConnector-Create");
44+
TestRunner.RunTestScript("New-AzSentinelDataConnector-Create");
5245
}
5346

5447
[Fact]
5548
[Trait(Category.AcceptanceType, Category.CheckIn)]
5649
public void Update()
5750
{
58-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelDataConnector-Update");
51+
TestRunner.RunTestScript("Update-AzSentinelDataConnector-Update");
5952
}
6053

6154
[Fact]
6255
[Trait(Category.AcceptanceType, Category.CheckIn)]
6356
public void InputObject()
6457
{
65-
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzSentinelDataConnector-InputObject");
58+
TestRunner.RunTestScript("Update-AzSentinelDataConnector-InputObject");
6659
}
6760

6861
[Fact]
6962
[Trait(Category.AcceptanceType, Category.CheckIn)]
7063
public void Delete()
7164
{
72-
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelDataConnector-Delete");
65+
TestRunner.RunTestScript("Remove-AzSentinelDataConnector-Delete");
7366
}
7467
}
7568
}

src/SecurityInsights/SecurityInsights.Test/ScenarioTests/IncidentCommentsTests.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,36 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ScenarioTest;
16-
using Microsoft.Azure.ServiceManagement.Common.Models;
1715
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1816
using Xunit;
1917

2018
namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
2119
{
22-
public class IncidentCommentsTests
20+
public class IncidentCommentsTests : SecurityInsightsTestRunner
2321
{
24-
private readonly XunitTracingInterceptor _logger;
25-
26-
public IncidentCommentsTests(Xunit.Abstractions.ITestOutputHelper output)
22+
public IncidentCommentsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
2723
{
28-
_logger = new XunitTracingInterceptor(output);
29-
XunitTracingInterceptor.AddToContext(_logger);
30-
TestExecutionHelpers.SetUpSessionAndProfile();
3124
}
3225

3326
[Fact]
3427
[Trait(Category.AcceptanceType, Category.CheckIn)]
3528
public void List()
3629
{
37-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelIncidentComment-ListByIncident");
30+
TestRunner.RunTestScript("Get-AzSentinelIncidentComment-ListByIncident");
3831
}
3932

4033
[Fact]
4134
[Trait(Category.AcceptanceType, Category.CheckIn)]
4235
public void Get()
4336
{
44-
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelIncidentComment-Get");
37+
TestRunner.RunTestScript("Get-AzSentinelIncidentComment-Get");
4538
}
4639

4740
[Fact]
4841
[Trait(Category.AcceptanceType, Category.CheckIn)]
4942
public void Create()
5043
{
51-
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelIncidentComment-Create");
44+
TestRunner.RunTestScript("New-AzSentinelIncidentComment-Create");
5245
}
5346
}
5447
}

0 commit comments

Comments
 (0)