Skip to content

Commit

Permalink
test(e2e): add health check and functional tests (#110)
Browse files Browse the repository at this point in the history
add following e2e health check and functional tests:
Interface Partner Health Check (BPDM, ClearingHouse, SdFactory, Wallet),
System Health Check (DB API tests and BaseDataLoadCheck),
Notification init scenario,
Registration scenarios,
Service account CUD scenarios,
Create app scenario.

as well as a GH workflow for manual trigger.
  • Loading branch information
irinamesh authored Aug 17, 2023
1 parent 845991d commit c58cdfc
Show file tree
Hide file tree
Showing 49 changed files with 3,730 additions and 12 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/test-automation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
###############################################################
###############################################################
# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
Expand Down Expand Up @@ -60,14 +60,14 @@ jobs:
project: ${{ secrets.REPORTPORTAL_PROJECT }}
uuid: ${{ secrets.REPORTPORTAL_AUTHENTICATION_UUID }}
url: ${{ vars.REPORTPORTAL_URL }}
run:
echo "project"
echo "uuid"
run: |
cd tests/endtoend
jq --arg project "$project" \
--arg uuid "$uuid" \
--arg url "$url" \
'.server |= ( .project = $project | .authentication.uuid = $uuid | .url = $url )' \
ReportPortal.config.json > temp.json && mv temp.json ReportPortal.config.json
ReportPortal.config.json > temp.json
mv temp.json ReportPortal.config.json
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v2
with:
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Build
run: dotnet build src --configuration Release --no-restore
- name: Tests - Interface Health Check
if: contains(fromJSON('["all", "interface health check"]'), github.event.inputs.test_category)
if: contains(fromJSON('["interface health check"]'), github.event.inputs.test_category)
continue-on-error: true # required for now as health checks still fail at the moment
env:
ENVIRONMENT: ${{ github.event.inputs.environment }}
Expand All @@ -100,7 +100,7 @@ jobs:
name: e2e-test-report
path: tests/endtoend/TestResults/e2eInterfaceHealthCheckResults.html
- name: Tests - Portal Health Check
if: contains(fromJSON('["all", "portal health check"]'), github.event.inputs.test_category)
if: contains(fromJSON('["portal health check"]'), github.event.inputs.test_category)
continue-on-error: true # required for now
env:
ENVIRONMENT: ${{ github.event.inputs.environment }}
Expand All @@ -118,7 +118,7 @@ jobs:
name: e2e-test-report
path: tests/endtoend/TestResults/e2ePortalHealthCheckResults.html
- name: Tests - Registration Tests
if: contains(fromJSON('["all", "registration"]'), github.event.inputs.test_category)
if: contains(fromJSON('["registration"]'), github.event.inputs.test_category)
continue-on-error: true # required as registration can fail
env:
ENVIRONMENT: ${{ github.event.inputs.environment }}
Expand All @@ -137,7 +137,7 @@ jobs:
name: e2e-test-report
path: tests/endtoend/TestResults/e2eRegistrationTestResults.html
- name: Tests - Portal Tests
if: contains(fromJSON('["all", "portal"]'), github.event.inputs.test_category)
if: contains(fromJSON('["portal"]'), github.event.inputs.test_category)
continue-on-error: true # required for now
env:
ENVIRONMENT: ${{ github.event.inputs.environment }}
Expand All @@ -156,3 +156,32 @@ jobs:
with:
name: e2e-test-report
path: tests/endtoend/TestResults/e2ePortalTestResults.html
- name: Tests - All E2E Tests
if: contains(fromJSON('["all"]'), github.event.inputs.test_category)
continue-on-error: true
env:
ENVIRONMENT: ${{ github.event.inputs.environment }}
BASE_PORTAL_URL: ${{ vars.BASE_PORTAL_URL }}
BASE_CENTRAL_IDP_URL: ${{ vars.BASE_CENTRAL_IDP_URL }}
CLEARING_HOUSE_URL: ${{ vars.CLEARING_HOUSE_URL }}
CLEARING_HOUSE_TOKEN_URL: ${{ vars.CLEARING_HOUSE_TOKEN_URL }}
SD_FACTORY_BASE_URL: ${{ vars.SD_FACTORY_BASE_URL }}
WALLET_BASE_URL: ${{ vars.WALLET_BASE_URL }}
BPDM_URL: ${{ vars.BPDM_URL }}
INTERFACE_HEALTH_CHECK_TECH_CLIENT_ID: ${{ secrets.INTERFACE_HEALTH_CHECK_TECH_CLIENT_ID }}
INTERFACE_HEALTH_CHECK_TECH_CLIENT_SECRET: ${{ secrets.INTERFACE_HEALTH_CHECK_TECH_CLIENT_SECRET }}
CLEARING_HOUSE_CLIENT_ID: ${{ secrets.CLEARING_HOUSE_CLIENT_ID }}
CLEARING_HOUSE_CLIENT_SECRET: ${{ secrets.CLEARING_HOUSE_CLIENT_SECRET }}
NOTIFICATION_OFFER_ID: ${{ vars.NOTIFICATION_OFFER_ID }}
PORTAL_USER_COMPANY_NAME: ${{ vars.PORTAL_USER_COMPANY_NAME }}
BASE_PORTAL_BACKEND_URL: ${{ vars.BASE_PORTAL_BACKEND_URL }}
TEMPMAIL_APIKEY: ${{ secrets.TEMPMAIL_APIKEY }}
PORTAL_USER_NAME: ${{ secrets.PORTAL_USER_NAME }}
PORTAL_USER_PASSWORD: ${{ secrets.PORTAL_USER_PASSWORD }}
run: dotnet test tests/endtoend --no-restore --verbosity minimal --logger "html;logfilename=e2eAllResults.html"
- name: 'Upload Artifact'
if: always()
uses: actions/upload-artifact@v3
with:
name: e2e-test-report
path: tests/endtoend/TestResults/e2eAllResults.html
2 changes: 1 addition & 1 deletion .github/workflows/unit.tests-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
- name: Check Format
run: dotnet format src --verify-no-changes --no-restore
- name: Test
run: dotnet test src --no-restore --verbosity normal
run: dotnet test src --filter FullyQualifiedName\!~Org.Eclipse.TractusX.Portal.Backend.EndToEnd.Tests --no-restore --verbosity normal
10 changes: 10 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@ nuget/nuget/-/Fare/2.1.1, MIT, approved, clearlydefined
nuget/nuget/-/FluentAssertions/6.7.0, Apache-2.0, approved, clearlydefined
nuget/nuget/-/Flurl.Http.Signed/3.2.4, MIT, approved, #3503
nuget/nuget/-/Flurl.Signed/3.0.6, MIT, approved, #3501
nuget/nuget/-/HtmlAgilityPack/1.11.49, MIT, approved, #9293
nuget/nuget/-/Humanizer.Core/2.8.26, MIT, approved, clearlydefined
nuget/nuget/-/Laraue.EfCoreTriggers.Common/6.3.6, MIT, approved, #5910
nuget/nuget/-/Laraue.EfCoreTriggers.PostgreSql/6.3.6, MIT, approved, #5911
nuget/nuget/-/MailKit/2.15.0, MIT, approved, clearlydefined
nuget/nuget/-/MimeKit/2.15.1, MIT, approved, clearlydefined
nuget/nuget/-/NHamcrest/3.2.0, MIT, approved, #9299
nuget/nuget/-/NJsonSchema/10.9.0, MIT, approved, #9300
nuget/nuget/-/Namotion.Reflection/2.1.2, MIT, approved, #9320
nuget/nuget/-/Newtonsoft.Json/12.0.2, MIT, approved, clearlydefined
nuget/nuget/-/Newtonsoft.Json/13.0.2, MIT AND BSD-3-Clause, approved, #3266
nuget/nuget/-/Newtonsoft.Json/13.0.3, MIT AND BSD-3-Clause, approved, #3266
nuget/nuget/-/Newtonsoft.Json/9.0.1, MIT, approved, clearlydefined
nuget/nuget/-/Npgsql.EntityFrameworkCore.PostgreSQL/6.0.7, PostgreSQL AND MIT AND Apache-2.0, approved, #5912
nuget/nuget/-/Npgsql/6.0.7, LicenseRef-BSD-style, approved, #5913
nuget/nuget/-/PasswordGenerator/2.1.0, MIT, approved, #3192
nuget/nuget/-/Portable.BouncyCastle/1.8.10, MIT, approved, clearlydefined
nuget/nuget/-/ReportPortal.Client/3.4.0, Apache-2.0, approved, #9298
nuget/nuget/-/ReportPortal.Shared/3.5.0, Apache-2.0, approved, #9301
nuget/nuget/-/ReportPortal.XUnit/2.4.5, Apache-2.0, approved, #9296
nuget/nuget/-/RestAssured.Net/4.0.0, Apache-2.0, approved, #9294
nuget/nuget/-/Serilog.AspNetCore/6.1.0, Apache-2.0 AND MIT, approved, #8437
nuget/nuget/-/Serilog.Enrichers.CorrelationId/3.0.1, MIT, approved, clearlydefined
nuget/nuget/-/Serilog.Enrichers.Environment/2.2.0, Apache-2.0, approved, clearlydefined
Expand All @@ -34,6 +43,7 @@ nuget/nuget/-/Serilog.Sinks.Debug/2.0.0, Apache-2.0, approved, clearlydefined
nuget/nuget/-/Serilog.Sinks.File/5.0.0, Apache-2.0, approved, clearlydefined
nuget/nuget/-/Serilog/2.12.0, Apache-2.0, approved, #8435
nuget/nuget/-/SharpZipLib/1.3.3, GFDL-1.3-or-later AND Apache-2.0 AND BSD-3-Clause AND MIT AND WTFPL AND bzip2-1.0.6, approved, #3264
nuget/nuget/-/Stubble.Core/1.10.8, MIT AND BSD-2-Clause, approved, #9297
nuget/nuget/-/SwashBuckle.AspNetCore/6.5.0, MIT AND Apache-2.0, approved, #7159
nuget/nuget/-/Swashbuckle.AspNetCore.Swagger/6.5.0, MIT AND Apache-2.0, approved, #7160
nuget/nuget/-/Swashbuckle.AspNetCore.SwaggerGen/6.5.0, MIT AND Apache-2.0, approved, #7156
Expand Down
15 changes: 15 additions & 0 deletions src/Portal.Backend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Models.Tests", "..\tests\framework\Framework.Models.Tests\Framework.Models.Tests.csproj", "{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.ProcessIdentity", "framework\Framework.ProcessIdentity\Framework.ProcessIdentity.csproj", "{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}"
EmdProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEnd.Tests", "..\tests\endtoend\EndToEnd.Tests.csproj", "{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1284,6 +1286,18 @@ Global
{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x64.Build.0 = Release|Any CPU
{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.ActiveCfg = Release|Any CPU
{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.Build.0 = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|x64.ActiveCfg = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|x64.Build.0 = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|x86.ActiveCfg = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Debug|x86.Build.0 = Debug|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|Any CPU.Build.0 = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|x64.ActiveCfg = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|x64.Build.0 = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|x86.ActiveCfg = Release|Any CPU
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1381,5 +1395,6 @@ Global
{031237BF-7B2A-4B37-9E37-4D4C575FDD22} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{5D70E30D-E9A2-472B-9834-BDB9824F8DEB} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ public enum NotificationTypeId
SERVICE_RELEASE_REJECTION = 20,

/// <summary>
/// Notification when a the user roles are updated
/// Notification when the user roles are updated
/// </summary>
ROLE_UPDATE_CORE_OFFER = 21,

/// <summary>
/// Notification when a the user roles are updated for an offer
/// Notification when the user roles are updated for an offer
/// </summary>
ROLE_UPDATE_APP_OFFER = 22,

Expand Down
19 changes: 19 additions & 0 deletions tests/endtoend/AlphabeticalOrderer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace Org.Eclipse.TractusX.Portal.Backend.EndToEnd.Tests;

public class AlphabeticalOrderer : ITestCaseOrderer
{
public IEnumerable<TTestCase> OrderTestCases<TTestCase>(
IEnumerable<TTestCase> testCases) where TTestCase : ITestCase =>
testCases.OrderBy(testCase => testCase.TestMethod.Method.Name);
}

public class DisplayNameOrderer : ITestCollectionOrderer
{
public IEnumerable<ITestCollection> OrderTestCollections(
IEnumerable<ITestCollection> testCollections) =>
testCollections.OrderBy(collection => collection.DisplayName);
}
Loading

0 comments on commit c58cdfc

Please sign in to comment.