diff --git a/src/Websites/Websites.Test/ScenarioTests/AccessRestrictionTests.cs b/src/Websites/Websites.Test/ScenarioTests/AccessRestrictionTests.cs index 6b6897413117..f125268f5039 100644 --- a/src/Websites/Websites.Test/ScenarioTests/AccessRestrictionTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/AccessRestrictionTests.cs @@ -23,8 +23,8 @@ public class AccessRestrictionTests : WebsitesTestRunner { public AccessRestrictionTests(ITestOutputHelper output) : base(output) - { } - + { + } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] diff --git a/src/Websites/Websites.Test/ScenarioTests/AppServiceEnvironmentTests.cs b/src/Websites/Websites.Test/ScenarioTests/AppServiceEnvironmentTests.cs index b36f2207bb55..ced028c3e66b 100644 --- a/src/Websites/Websites.Test/ScenarioTests/AppServiceEnvironmentTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/AppServiceEnvironmentTests.cs @@ -33,7 +33,6 @@ public void TestGetAppServiceEnvironment() TestRunner.RunTestScript("Test-GetAppServiceEnvironment"); } - [Fact(Skip = "Need to be record")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveAppServiceEnvironment() @@ -41,7 +40,6 @@ public void TestRemoveAppServiceEnvironment() TestRunner.RunTestScript("Test-RemoveAppServiceEnvironment"); } - [Fact(Skip = "Need to be record")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestE2EAppServiceEnvironment() diff --git a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs index 25c596e4823c..d0b46fe18da4 100644 --- a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs @@ -13,71 +13,66 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class AppServicePlanTests : RMTestBase + public class AppServicePlanTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; - public AppServicePlanTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewAppServicePlan() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlan"); + TestRunner.RunTestScript("Test-CreateNewAppServicePlan"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewAppServicePlanHyperV() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanHyperV"); + TestRunner.RunTestScript("Test-CreateNewAppServicePlanHyperV"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewAppServicePlanLinux() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanLinux"); + TestRunner.RunTestScript("Test-CreateNewAppServicePlanLinux"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetAppServicePlan() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetAppServicePlan"); + TestRunner.RunTestScript("Test-SetAppServicePlan"); } [Fact(Skip = "Needs investigation. Fails running playback")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetAppServicePlan() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetAppServicePlan"); + TestRunner.RunTestScript("Test-GetAppServicePlan"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveAppServicePlan() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveAppServicePlan"); + TestRunner.RunTestScript("Test-RemoveAppServicePlan"); } [Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewAppServicePlanInAse() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanInAse"); + TestRunner.RunTestScript("Test-CreateNewAppServicePlanInAse"); } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/CertificatesTests.cs b/src/Websites/Websites.Test/ScenarioTests/CertificatesTests.cs index 8543cdf5e19a..71ac6e2743b4 100644 --- a/src/Websites/Websites.Test/ScenarioTests/CertificatesTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/CertificatesTests.cs @@ -12,52 +12,53 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; + using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class CertificatesTests : RMTestBase + public class CertificatesTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; public CertificatesTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestNewAzWebAppCertificate() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-NewAzWebAppCertificate"); + TestRunner.RunTestScript("Test-NewAzWebAppCertificate"); } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestNewAzWebAppCertificateWithSSLBinding() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-NewAzWebAppCertificateWithSSLBinding"); + TestRunner.RunTestScript("Test-NewAzWebAppCertificateWithSSLBinding"); } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestNewAzWebAppCertificateForSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-NewAzWebAppCertificateForSlot"); + TestRunner.RunTestScript("Test-NewAzWebAppCertificateForSlot"); } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveAzWebAppCertificate() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveAzWebAppCertificate"); + TestRunner.RunTestScript("Test-RemoveAzWebAppCertificate"); } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestImportAzWebAppKeyVaultCertificate() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-ImportAzWebAppKeyVaultCertificate"); + TestRunner.RunTestScript("Test-ImportAzWebAppKeyVaultCertificate"); } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/RoutingRuleTests.cs b/src/Websites/Websites.Test/ScenarioTests/RoutingRuleTests.cs index 5a5c543bb360..cb37892c6134 100644 --- a/src/Websites/Websites.Test/ScenarioTests/RoutingRuleTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/RoutingRuleTests.cs @@ -13,49 +13,45 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class RoutingRuleTests: RMTestBase + public class RoutingRuleTests: WebsitesTestRunner { - public XunitTracingInterceptor _logger; public RoutingRuleTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAddWebAppTrafficRoutingRule() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-AddWebAppTrafficRoutingRule"); + TestRunner.RunTestScript("Test-AddWebAppTrafficRoutingRule"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveWebAppTrafficRoutingRule() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveWebAppTrafficRoutingRule"); + TestRunner.RunTestScript("Test-RemoveWebAppTrafficRoutingRule"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppTrafficRoutingRule() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppTrafficRoutingRule"); + TestRunner.RunTestScript("Test-GetWebAppTrafficRoutingRule"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestUpdateWebAppTrafficRoutingRule() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-UpdateWebAppTrafficRoutingRule"); + TestRunner.RunTestScript("Test-UpdateWebAppTrafficRoutingRule"); } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/SSLBindingTests.cs b/src/Websites/Websites.Test/ScenarioTests/SSLBindingTests.cs index aa8276a3823a..a0951aaf542c 100644 --- a/src/Websites/Websites.Test/ScenarioTests/SSLBindingTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/SSLBindingTests.cs @@ -13,64 +13,59 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class SSLBindingTests : RMTestBase + public class SSLBindingTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; - public SSLBindingTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppSSLBinding() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppSSLBinding"); + TestRunner.RunTestScript("Test-CreateNewWebAppSSLBinding"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetNewWebAppSSLBinding() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetNewWebAppSSLBinding"); + TestRunner.RunTestScript("Test-GetNewWebAppSSLBinding"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveNewWebAppSSLBinding() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveNewWebAppSSLBinding"); + TestRunner.RunTestScript("Test-RemoveNewWebAppSSLBinding"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWebAppSSLBindingPipeSupport() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppSSLBindingPipeSupport"); + TestRunner.RunTestScript("Test-WebAppSSLBindingPipeSupport"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppCertificate() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppCertificate"); + TestRunner.RunTestScript("Test-GetWebAppCertificate"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TagsNotRemovedByCreateNewWebAppSSLBinding() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-TagsNotRemovedByCreateNewWebAppSSLBinding"); + TestRunner.RunTestScript("Test-TagsNotRemovedByCreateNewWebAppSSLBinding"); } } -} \ No newline at end of file +} diff --git a/src/Websites/Websites.Test/ScenarioTests/WebAppBackupRestoreTests.cs b/src/Websites/Websites.Test/ScenarioTests/WebAppBackupRestoreTests.cs index 0878367696bf..639e71b6dfb0 100644 --- a/src/Websites/Websites.Test/ScenarioTests/WebAppBackupRestoreTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/WebAppBackupRestoreTests.cs @@ -12,22 +12,18 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; + using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class WebAppBackupRestoreTests : RMTestBase + public class WebAppBackupRestoreTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; - public WebAppBackupRestoreTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } #if NETSTANDARD @@ -39,7 +35,7 @@ public WebAppBackupRestoreTests(ITestOutputHelper output) [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppBackup() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppBackup"); + TestRunner.RunTestScript("Test-CreateNewWebAppBackup"); } #if NETSTANDARD @@ -51,7 +47,7 @@ public void TestCreateNewWebAppBackup() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppBackupPiping() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppBackupPiping"); + TestRunner.RunTestScript("Test-CreateNewWebAppBackupPiping"); } #if NETSTANDARD @@ -63,7 +59,7 @@ public void TestCreateNewWebAppBackupPiping() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppBackup() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppBackup"); + TestRunner.RunTestScript("Test-GetWebAppBackup"); } #if NETSTANDARD @@ -75,7 +71,7 @@ public void TestGetWebAppBackup() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppBackupList() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppBackupList"); + TestRunner.RunTestScript("Test-GetWebAppBackupList"); } #if NETSTANDARD @@ -87,7 +83,7 @@ public void TestGetWebAppBackupList() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestEditAndGetWebAppBackupConfiguration() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-EditAndGetWebAppBackupConfiguration"); + TestRunner.RunTestScript("Test-EditAndGetWebAppBackupConfiguration"); } #if NETSTANDARD @@ -99,42 +95,42 @@ public void TestEditAndGetWebAppBackupConfiguration() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestEditAndGetWebAppBackupConfigurationPiping() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-EditAndGetWebAppBackupConfigurationPiping"); + TestRunner.RunTestScript("Test-EditAndGetWebAppBackupConfigurationPiping"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppSnapshot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppSnapshot"); + TestRunner.RunTestScript("Test-GetWebAppSnapshot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreWebAppSnapshot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RestoreWebAppSnapshot"); + TestRunner.RunTestScript("Test-RestoreWebAppSnapshot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetDeletedWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetDeletedWebApp"); + TestRunner.RunTestScript("Test-GetDeletedWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreDeletedWebAppToExisting() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RestoreDeletedWebAppToExisting"); + TestRunner.RunTestScript("Test-RestoreDeletedWebAppToExisting"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreDeletedWebAppToNew() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RestoreDeletedWebAppToNew"); + TestRunner.RunTestScript("Test-RestoreDeletedWebAppToNew"); } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.cs b/src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.cs index 7779cdef2ab4..f7a012e52c54 100644 --- a/src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.cs @@ -13,85 +13,80 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class WebAppSlotTests : RMTestBase + public class WebAppSlotTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; - public WebAppSlotTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppSlot"); + TestRunner.RunTestScript("Test-CreateNewWebAppSlot"); } [Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppSlotOnAse() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppSlotOnAse"); + TestRunner.RunTestScript("Test-CreateNewWebAppSlotOnAse"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebAppSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppSlot"); + TestRunner.RunTestScript("Test-GetWebAppSlot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWebAppSlotPublishingProfile() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppSlotPublishingProfile"); + TestRunner.RunTestScript("Test-WebAppSlotPublishingProfile"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCloneWebAppToSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CloneWebAppToSlot"); + TestRunner.RunTestScript("Test-CloneWebAppToSlot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCloneWebAppSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CloneWebAppSlot"); + TestRunner.RunTestScript("Test-CloneWebAppSlot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestStartStopRestartWebAppSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-StartStopRestartWebAppSlot"); + TestRunner.RunTestScript("Test-StartStopRestartWebAppSlot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetWebAppSlot() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetWebAppSlot"); + TestRunner.RunTestScript("Test-SetWebAppSlot"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestManageSlotSlotConfigName() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-ManageSlotSlotConfigName"); + TestRunner.RunTestScript("Test-ManageSlotSlotConfigName"); } [Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")] @@ -99,21 +94,21 @@ public void TestManageSlotSlotConfigName() [Trait("Re-record", "ClientRuntime changes")] public void TestWebAppRegularSlotSwap() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppRegularSlotSwap"); + TestRunner.RunTestScript("Test-WebAppRegularSlotSwap"); } [Fact(Skip = "iss#6044 The test needs to be re-written")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWebAppSwapWithPreviewResetSlotSwap() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppSwapWithPreviewResetSlotSwap"); + TestRunner.RunTestScript("Test-WebAppSwapWithPreviewResetSlotSwap"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWebAppSwapWithPreviewCompleteSlotSwap() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppSwapWithPreviewCompleteSlotSwap"); - } + TestRunner.RunTestScript("Test-WebAppSwapWithPreviewCompleteSlotSwap"); + } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/WebAppTests.cs b/src/Websites/Websites.Test/ScenarioTests/WebAppTests.cs index 155f13fabac8..637f067a30b3 100644 --- a/src/Websites/Websites.Test/ScenarioTests/WebAppTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/WebAppTests.cs @@ -13,113 +13,108 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests { - public class WebAppTests : RMTestBase + public class WebAppTests : WebsitesTestRunner { - public XunitTracingInterceptor _logger; - public WebAppTests(ITestOutputHelper output) + : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebApp"); + TestRunner.RunTestScript("Test-CreateNewWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppHyperV() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppHyperV"); + TestRunner.RunTestScript("Test-CreateNewWebAppHyperV"); } [Fact(Skip = "Needs investigation. Fails pulling container image from public registry.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetWebAppHyperVCredentials() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetWebAppHyperVCredentials"); + TestRunner.RunTestScript("Test-SetWebAppHyperVCredentials"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestEnableContainerContinuousDeploymentAndGetUrl() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-EnableContainerContinuousDeploymentAndGetUrl"); + TestRunner.RunTestScript("Test-EnableContainerContinuousDeploymentAndGetUrl"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetAzureStorageWebAppHyperV() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetAzureStorageWebAppHyperV"); + TestRunner.RunTestScript("Test-SetAzureStorageWebAppHyperV"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewAppOnAse() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppOnAse"); + TestRunner.RunTestScript("Test-CreateNewWebAppOnAse"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCreateNewWebAppSimple() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppSimple"); + TestRunner.RunTestScript("Test-CreateNewWebAppSimple"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestGetWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebApp"); + TestRunner.RunTestScript("Test-GetWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWebAppPublishingProfile() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppPublishingProfile"); + TestRunner.RunTestScript("Test-WebAppPublishingProfile"); } [Fact] [Trait(Category.RunType, Category.LiveOnly)] public void TestPublishWebAppFromZip() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-PublishAzureWebAppFromZip"); + TestRunner.RunTestScript("Test-PublishAzureWebAppFromZip"); } [Fact] [Trait(Category.RunType, Category.LiveOnly)] public void TestPublishWebAppFromWar() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-PublishAzureWebAppFromWar"); + TestRunner.RunTestScript("Test-PublishAzureWebAppFromWar"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCloneNewWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CloneNewWebApp"); + TestRunner.RunTestScript("Test-CloneNewWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCloneNewWebAppAndDeploymentSlots() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CloneNewWebAppAndDeploymentSlots"); + TestRunner.RunTestScript("Test-CloneNewWebAppAndDeploymentSlots"); } // This test is failing with an HTTP 500 due to a bug in the clone service. @@ -127,49 +122,49 @@ public void TestCloneNewWebAppAndDeploymentSlots() [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestCloneNewWebAppWithNewTrafficManager() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-CloneNewWebAppWithTrafficManager"); + TestRunner.RunTestScript("Test-CloneNewWebAppWithTrafficManager"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestStartStopRestartWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-StartStopRestartWebApp"); + TestRunner.RunTestScript("Test-StartStopRestartWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetWebApp"); + TestRunner.RunTestScript("Test-SetWebApp"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveWebApp"); + TestRunner.RunTestScript("Test-RemoveWebApp"); } [Fact(Skip = "Test is being skipped until issue with HttpMockserver unable to load error is resolved.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWindowsContainerWebAppCanIssuePSSession() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WindowsContainerCanIssueWebAppPSSession"); + TestRunner.RunTestScript("Test-WindowsContainerCanIssueWebAppPSSession"); } [Fact(Skip = "Expected to fail during playback because it validates that a PsSession into a real container web app can be established")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestWindowsContainerWebAppPSSessionOpened() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-WindowsContainerWebAppPSSessionOpened"); + TestRunner.RunTestScript("Test-WindowsContainerWebAppPSSessionOpened"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestTagsNotRemovedBySetWebApp() { - WebsitesController.NewInstance.RunPsTest(_logger, "Test-TagsNotRemovedBySetWebApp"); + TestRunner.RunTestScript("Test-TagsNotRemovedBySetWebApp"); } } } diff --git a/src/Websites/Websites.Test/ScenarioTests/WebsitesController.cs b/src/Websites/Websites.Test/ScenarioTests/WebsitesController.cs deleted file mode 100644 index bf7efce41b07..000000000000 --- a/src/Websites/Websites.Test/ScenarioTests/WebsitesController.cs +++ /dev/null @@ -1,164 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Common.Authentication; -using Microsoft.Azure.Commands.ScenarioTest; -using Microsoft.Azure.Management.Authorization.Version2015_07_01; -using Microsoft.Azure.Management.Storage.Version2017_10_01; -using Microsoft.Azure.Management.WebSites; -using Microsoft.Azure.ServiceManagement.Common.Models; -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using Microsoft.Azure.Management.Internal.Resources; -using Microsoft.Azure.Commands.Common.KeyVault.Version2016_10_1; - -namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests -{ - public class WebsitesController - { - private readonly EnvironmentSetupHelper _helper; - - public ResourceManagementClient NewResourceManagementClient { get; private set; } - - public WebSiteManagementClient WebsitesManagementClient { get; private set; } - - public AuthorizationManagementClient AuthorizationManagementClient { get; private set; } - - public KeyVaultManagementClient KeyVaultManagementClient { get; private set; } - - public string UserDomain { get; private set; } - - public static WebsitesController NewInstance => new WebsitesController(); - - public WebsitesController() - { - _helper = new EnvironmentSetupHelper(); - } - - public void RunPsTest(XunitTracingInterceptor logger, params string[] scripts) - { - TestExecutionHelpers.SetUpSessionAndProfile(); - var sf = new StackTrace().GetFrame(1); - var callingClassType = sf.GetMethod().ReflectedType?.ToString(); - var mockName = sf.GetMethod().Name; - _helper.TracingInterceptor = logger; - - logger.Information(string.Format("Test method entered: {0}.{1}", callingClassType, mockName)); - RunPsTestWorkflow( - () => scripts, - // no custom cleanup - null, - callingClassType, - mockName); - logger.Information(string.Format("Test method finished: {0}.{1}", callingClassType, mockName)); - } - - public void RunPsTestWorkflow( - Func scriptBuilder, - Action cleanup, - string callingClassType, - string mockName) - { - var d = new Dictionary - { - {"Microsoft.Resources", null}, - {"Microsoft.Features", null}, - {"Microsoft.Authorization", null} - }; - var providersToIgnore = new Dictionary - { - {"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"} - }; - HttpMockServer.Matcher = new PermissiveRecordMatcherWithApiExclusion(true, d, providersToIgnore); - - HttpMockServer.RecordsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SessionRecords"); - using (var context = MockContext.Start(callingClassType, mockName)) - { - SetupManagementClients(context); - _helper.SetupEnvironment(AzureModule.AzureResourceManager); - - var callingClassName = callingClassType - .Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries) - .Last(); - _helper.SetupModules(AzureModule.AzureResourceManager, - "ScenarioTests\\Common.ps1", - "ScenarioTests\\" + callingClassName + ".ps1", - _helper.RMProfileModule, - _helper.GetRMModulePath(@"AzureRM.Websites.psd1"), - "AzureRM.Storage.ps1", - "AzureRM.Resources.ps1"); - - try - { - var psScripts = scriptBuilder?.Invoke(); - if (psScripts != null) - { - _helper.RunPowerShellTest(psScripts); - } - } - finally - { - cleanup?.Invoke(); - } - } - } - - private void SetupManagementClients(MockContext context) - { - NewResourceManagementClient = GetResourceManagementClient(context); - WebsitesManagementClient = GetWebsitesManagementClient(context); - AuthorizationManagementClient = GetAuthorizationManagementClient(context); - KeyVaultManagementClient = GetKeyVaultManagementClient(context); - var armStorageManagementClient = GetArmStorageManagementClient(context); - _helper.SetupManagementClients( - NewResourceManagementClient, - WebsitesManagementClient, - AuthorizationManagementClient, - KeyVaultManagementClient, - armStorageManagementClient - ); - } - - private static StorageManagementClient GetArmStorageManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - private static AuthorizationManagementClient GetAuthorizationManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - private static ResourceManagementClient GetResourceManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - private static WebSiteManagementClient GetWebsitesManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - private static KeyVaultManagementClient GetKeyVaultManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - } -} diff --git a/src/Websites/Websites.Test/ScenarioTests/WebsitesTestRunner.cs b/src/Websites/Websites.Test/ScenarioTests/WebsitesTestRunner.cs index 97dd215ef2ae..57ad58871e1c 100644 --- a/src/Websites/Websites.Test/ScenarioTests/WebsitesTestRunner.cs +++ b/src/Websites/Websites.Test/ScenarioTests/WebsitesTestRunner.cs @@ -1,4 +1,18 @@ -using Microsoft.Azure.Commands.TestFx; +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.TestFx; using Microsoft.WindowsAzure.Commands.ScenarioTest; using System.Collections.Generic; using Xunit.Abstractions; @@ -11,7 +25,7 @@ public class WebsitesTestRunner protected WebsitesTestRunner(ITestOutputHelper output) { - TestRunner = TestFx.TestManager.CreateInstance(output) + TestRunner = TestManager.CreateInstance(output) .WithNewPsScriptFilename($"{GetType().Name}.ps1") .WithProjectSubfolderForTests("ScenarioTests") .WithCommonPsScripts(new[] @@ -21,23 +35,18 @@ protected WebsitesTestRunner(ITestOutputHelper output) @"../AzureRM.Storage.ps1" }) .WithNewRmModules(helper => new[] - { + { helper.RMProfileModule, - helper.GetRMModulePath("AzureRM.Websites.psd1"), - helper.GetRMModulePath("AzureRM.Network.psd1"), - helper.GetRMModulePath("AzureRM.KeyVault.psd1"), - + helper.GetRMModulePath("Az.Websites.psd1"), + helper.GetRMModulePath("Az.Network.psd1"), + helper.GetRMModulePath("Az.KeyVault.psd1") }) - .WithRecordMatcher( - (ignoreResourcesClient, resourceProviders, userAgentsToIgnore) => - new PermissiveRecordMatcherWithApiExclusion(ignoreResourcesClient, resourceProviders, userAgentsToIgnore) - ) .WithNewRecordMatcherArguments( userAgentsToIgnore: new Dictionary { {"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"}, {"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2017-05-10"}, - {"Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient", "2016-09-01"}, + {"Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient", "2016-09-01"} }, resourceProviders: new Dictionary { @@ -47,7 +56,7 @@ protected WebsitesTestRunner(ITestOutputHelper output) {"Microsoft.Websites", null}, {"Microsoft.Network", null}, {"Microsoft.KeyVault", null}, - {"Microsoft.Storage", null}, + {"Microsoft.Storage", null} } ) .Build();