diff --git a/Local.testsettings b/Local.testsettings new file mode 100644 index 000000000..4e1e6ab7f --- /dev/null +++ b/Local.testsettings @@ -0,0 +1,13 @@ + + + These are default test settings for a local test run. + + + + + + + + + + \ No newline at end of file diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 0a36c0c57..adc49e687 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -1,12 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3AF739CD-81D8-428D-A08A-0A58372DEBF6}" ProjectSection(SolutionItems) = preProject + Local.testsettings = Local.testsettings NuGet.config = NuGet.config EndProjectSection EndProject @@ -96,6 +97,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Marketing", "Marketing", "{ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marketing.API", "src\Services\Marketing\Marketing.API\Marketing.API.csproj", "{DF395F85-B010-465D-857A-7EBCC512C0C2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTest", "test\Services\LoadTest\LoadTest.csproj", "{969E793C-C413-490E-9C9D-B2B46DA5AF32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -1262,6 +1265,54 @@ Global {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x64.Build.0 = Release|Any CPU {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.ActiveCfg = Release|Any CPU {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|ARM.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|ARM.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhone.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x64.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x64.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x86.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x86.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1308,5 +1359,6 @@ Global {23A33F9B-7672-426D-ACF9-FF8436ADC81A} = {88B22DBB-AA8F-4290-A454-2C109352C345} {A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE} + {969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870} EndGlobalSection EndGlobal diff --git a/test/Services/IntegrationTests/Services/Catalog/CatalogScenarioBase.cs b/test/Services/IntegrationTests/Services/Catalog/CatalogScenarioBase.cs index e70e4f8cf..ba6c225bf 100644 --- a/test/Services/IntegrationTests/Services/Catalog/CatalogScenarioBase.cs +++ b/test/Services/IntegrationTests/Services/Catalog/CatalogScenarioBase.cs @@ -1,6 +1,4 @@ - - -namespace IntegrationTests.Services.Catalog +namespace IntegrationTests.Services.Catalog { using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; @@ -20,20 +18,42 @@ namespace IntegrationTests.Services.Catalog public static class Get { - public static string Items = "api/v1/catalog/items"; + private const int PageIndex = 0; + private const int PageCount = 4; + + public static string Items(bool paginated = false) + { + return paginated + ? "api/v1/catalog/items" + Paginated(PageIndex, PageCount) + : "api/v1/catalog/items"; + } + + public static string ItemById(int id) + { + return $"api/v1/catalog/items/{id}"; + } + + public static string ItemByName(string name, bool paginated = false) + { + return paginated + ? $"api/v1/catalog/items/withname/{name}" + Paginated(PageIndex, PageCount) + : $"api/v1/catalog/items/withname/{name}"; + } public static string Types = "api/v1/catalog/catalogtypes"; public static string Brands = "api/v1/catalog/catalogbrands"; - public static string Paginated(int pageIndex, int pageCount) + public static string Filtered(int catalogTypeId, int catalogBrandId, bool paginated = false) { - return $"api/v1/catalog/items?pageIndex={pageIndex}&pageSize={pageCount}"; + return paginated + ? $"api/v1/catalog/items/type/{catalogTypeId}/brand/{catalogBrandId}" + Paginated(PageIndex, PageCount) + : $"api/v1/catalog/items/type/{catalogTypeId}/brand/{catalogBrandId}"; } - public static string Filtered(int catalogTypeId, int catalogBrandId) + private static string Paginated(int pageIndex, int pageCount) { - return $"api/v1/catalog/items/type/{catalogTypeId}/brand/{catalogBrandId}"; + return $"?pageIndex={pageIndex}&pageSize={pageCount}"; } } } diff --git a/test/Services/IntegrationTests/Services/Catalog/CatalogScenarios.cs b/test/Services/IntegrationTests/Services/Catalog/CatalogScenarios.cs index 28a2931f2..4f55933b3 100644 --- a/test/Services/IntegrationTests/Services/Catalog/CatalogScenarios.cs +++ b/test/Services/IntegrationTests/Services/Catalog/CatalogScenarios.cs @@ -1,4 +1,6 @@ -namespace IntegrationTests.Services.Catalog +using System; + +namespace IntegrationTests.Services.Catalog { using System.Threading.Tasks; using Xunit; @@ -12,7 +14,68 @@ using (var server = CreateServer()) { var response = await server.CreateClient() - .GetAsync(Get.Items); + .GetAsync(Get.Items()); + + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task Get_get_catalogitem_by_id_and_response_ok_status_code() + { + using (var server = CreateServer()) + { + var response = await server.CreateClient() + .GetAsync(Get.ItemById(1)); + + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task Get_get_catalogitem_by_id_and_response_bad_request_status_code() + { + using (var server = CreateServer()) + { + var response = await server.CreateClient() + .GetAsync(Get.ItemById(int.MinValue)); + + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task Get_get_catalogitem_by_id_and_response_not_found_status_code() + { + using (var server = CreateServer()) + { + var response = await server.CreateClient() + .GetAsync(Get.ItemById(int.MaxValue)); + + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task Get_get_catalogitem_by_name_and_response_ok_status_code() + { + using (var server = CreateServer()) + { + var response = await server.CreateClient() + .GetAsync(Get.ItemByName(".NET")); + + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task Get_get_paginated_catalogitem_by_name_and_response_ok_status_code() + { + using (var server = CreateServer()) + { + const bool paginated = true; + var response = await server.CreateClient() + .GetAsync(Get.ItemByName(".NET", paginated)); response.EnsureSuccessStatusCode(); } @@ -23,8 +86,9 @@ { using (var server = CreateServer()) { + const bool paginated = true; var response = await server.CreateClient() - .GetAsync(Get.Paginated(0, 4)); + .GetAsync(Get.Items(paginated)); response.EnsureSuccessStatusCode(); } @@ -42,6 +106,19 @@ } } + [Fact] + public async Task Get_get_paginated_filtered_catalog_items_and_response_ok_status_code() + { + using (var server = CreateServer()) + { + const bool paginated = true; + var response = await server.CreateClient() + .GetAsync(Get.Filtered(1, 1, paginated)); + + response.EnsureSuccessStatusCode(); + } + } + [Fact] public async Task Get_catalog_types_response_ok_status_code() { diff --git a/test/Services/IntegrationTests/Services/Ordering/OrderingScenarios.cs b/test/Services/IntegrationTests/Services/Ordering/OrderingScenarios.cs index d1381a92f..1e61da289 100644 --- a/test/Services/IntegrationTests/Services/Ordering/OrderingScenarios.cs +++ b/test/Services/IntegrationTests/Services/Ordering/OrderingScenarios.cs @@ -33,7 +33,7 @@ var response = await server.CreateIdempotentClient() .PutAsync(Put.CancelOrder, content); - Assert.Equal(response.StatusCode, HttpStatusCode.InternalServerError); + Assert.Equal(response.StatusCode, HttpStatusCode.BadRequest); } } diff --git a/test/Services/LoadTest/LoadTest.csproj b/test/Services/LoadTest/LoadTest.csproj new file mode 100644 index 000000000..65ba7779a --- /dev/null +++ b/test/Services/LoadTest/LoadTest.csproj @@ -0,0 +1,114 @@ + + + Debug + AnyCPU + + + 2.0 + {969E793C-C413-490E-9C9D-B2B46DA5AF32} + Library + Properties + LoadTest + LoadTest + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WebTest + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + + + + + + + + + False + + + + + + + + + Always + + + PreserveNewest + + + PreserveNewest + + + Always + + + Always + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/Properties/AssemblyInfo.cs b/test/Services/LoadTest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..91e6827da --- /dev/null +++ b/test/Services/LoadTest/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LoadTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LoadTest")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("969e793c-c413-490e-9c9d-b2b46da5af32")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Services/LoadTest/WebMVC/AddProducts.webtest b/test/Services/LoadTest/WebMVC/AddProducts.webtest new file mode 100644 index 000000000..9984ed55e --- /dev/null +++ b/test/Services/LoadTest/WebMVC/AddProducts.webtest @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest b/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest new file mode 100644 index 000000000..1f60026a7 --- /dev/null +++ b/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest @@ -0,0 +1,174 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/CatalogFilter.webtest b/test/Services/LoadTest/WebMVC/CatalogFilter.webtest new file mode 100644 index 000000000..2cbbfbda8 --- /dev/null +++ b/test/Services/LoadTest/WebMVC/CatalogFilter.webtest @@ -0,0 +1,248 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest b/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest new file mode 100644 index 000000000..e14a30f62 --- /dev/null +++ b/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest @@ -0,0 +1,353 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/Login.webtest b/test/Services/LoadTest/WebMVC/Login.webtest new file mode 100644 index 000000000..17e02a408 --- /dev/null +++ b/test/Services/LoadTest/WebMVC/Login.webtest @@ -0,0 +1,103 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest b/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest new file mode 100644 index 000000000..ffb94543d --- /dev/null +++ b/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest @@ -0,0 +1,123 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/WebMVC/Logout.webtest b/test/Services/LoadTest/WebMVC/Logout.webtest new file mode 100644 index 000000000..b8ca3e0a7 --- /dev/null +++ b/test/Services/LoadTest/WebMVC/Logout.webtest @@ -0,0 +1,28 @@ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/test/Services/LoadTest/app.config b/test/Services/LoadTest/app.config new file mode 100644 index 000000000..99ddf3e08 --- /dev/null +++ b/test/Services/LoadTest/app.config @@ -0,0 +1,3 @@ + + + \ No newline at end of file