Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4241a94
Full tested feature and working
charanNHS Feb 27, 2025
0684a3c
Removed api version check in deps yaml
charanNHS Mar 4, 2025
7a0188b
fixed format
charanNHS Mar 4, 2025
52b1c3f
Merge branch 'main' into feat/DTOSS-3660-NHS--id-in-participant--man-…
charanNHS Mar 4, 2025
adf0891
Fix issue compose core
charanNHS Mar 6, 2025
9941340
fixed cucumber gherkin issue
charanNHS Mar 6, 2025
89225b6
copied necessary classes from smoke tests project
charanNHS Mar 18, 2025
b8865e9
Merge remote-tracking branch 'origin/main' into feat/DTOSS-3660-NHS--…
charanNHS Mar 19, 2025
74d5739
Added gitignore
charanNHS Mar 19, 2025
fe22581
Merge remote-tracking branch 'origin/main' into feat/DTOSS-3660-NHS--…
charanNHS Mar 19, 2025
0df490b
Removed reference of epic1 in smoke tests solution
charanNHS Mar 19, 2025
9e0742c
Added end to end tests to gitleaks file
charanNHS Mar 19, 2025
b7b276c
Renamed Smoke context to end to end context
charanNHS Mar 19, 2025
03d1d9c
Removed gitginore and using the one on root
charanNHS Mar 19, 2025
90c9b1b
Added check to include test files in gitignore
charanNHS Mar 19, 2025
2f56002
Merge branch 'main' into feat/DTOSS-3660-NHS--id-in-participant--man-…
charanNHS Mar 19, 2025
3ac8383
Removed unused methods in datavalidation helper and included just Tes…
charanNHS Mar 19, 2025
20dbc70
Merge branch 'feat/DTOSS-3660-NHS--id-in-participant--man-demograp' o…
charanNHS Mar 19, 2025
f5f1f55
Just ignored csproj file
charanNHS Mar 19, 2025
4614924
Moved Private methods to the bottom of the class
charanNHS Mar 19, 2025
176fcf9
Renamed name spaces and project
charanNHS Mar 20, 2025
31525d5
Edited gitignore file
charanNHS Mar 20, 2025
53d2058
Merge branch 'main' into feat/DTOSS-3660-NHS--id-in-participant--man-…
charanNHS Mar 20, 2025
40f6d7c
Including old project name
charanNHS Mar 20, 2025
33f419e
Merge branch 'feat/DTOSS-3660-NHS--id-in-participant--man-demograp' o…
charanNHS Mar 20, 2025
0c7693e
Renamed feature file
charanNHS Mar 20, 2025
8b3e2c3
Renamed Scenarios with meaningful name
charanNHS Mar 20, 2025
b355299
Renamed scenarios to will suggestions
charanNHS Mar 20, 2025
e60d4e5
Added missing crt back to gitignore
charanNHS Mar 20, 2025
e9cbb4e
Added old proj reference
charanNHS Mar 20, 2025
ae7eacc
Renamed appsettings.json
charanNHS Mar 20, 2025
4359ddc
Merge branch 'main' into feat/DTOSS-3660-NHS--id-in-participant--man-…
charanNHS Mar 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Comment thread
charanNHS marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ application/CohortManager/.vscode/
# Ignore generated feature bindings
*.feature.cs
tests/smoke-tests/dtos-cohort-manager-smoke-tests/Config/appsettings-local.json
*.crt
Comment thread
charanNHS marked this conversation as resolved.
tests/e2e-tests/dtos-cohort-manager-e2e-tests/Config/appsettings-local.json
2 changes: 1 addition & 1 deletion application/CohortManager/compose.deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ services:
condition: service_healthy
environment:
- PASSWORD=${PASSWORD}
- DB_NAME=${DB_NAME}
- DB_NAME=${DB_NAME}
3 changes: 2 additions & 1 deletion scripts/config/gitleaks.toml
Comment thread
charanNHS marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ paths = [
'''tests/CaasIntegrationTests/receiveCaasFileTest/receiveCaasFileTest.csproj''',
'''tests/IntegrationTests/integration.csproj''',
'''application/CohortManager/src/Functions/Shared/Model/Model.csproj''',
'''tests/smoke-tests/dtos-cohort-manager-smoke-tests/'''
'''tests/smoke-tests/dtos-cohort-manager-smoke-tests/''',
Comment thread
charanNHS marked this conversation as resolved.
'''tests/e2e-tests/dtos-cohort-manager-e2e-tests/'''
]


Expand Down
87 changes: 87 additions & 0 deletions tests/e2e-tests/dtos-cohort-manager-e2e-tests/.gitignore
Comment thread
charanNHS marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# WARNING: Please, DO NOT edit this section of the file! It is maintained in the repository template.

.scannerwork
*cloc*report*.json
*sbom*report*.json
*vulnerabilities*report*.json
*report*json.zip
.version

*.code-workspace
!project.code-workspace

# Please, add your custom content below!

# keys

*.pfx
*.pem
*.key

# User-specific files
*.suo
*.user

# Visual Studio 2015/2017 cache/options directory
.vs/

# Visual Studio 2017 auto generated files
Generated\ Files/

# Text Editors
.vscode/*
!.vscode/tasks.json
_ReSharper.*/
*/*/.idea/*

# Azurite
__azurite*
__blobstorage__
__queuestorage__

# Tests
TestResults

# Builds
bin
obj
OutputDirectory

# Mac
.DS_Store

# User Settings
local.settings.json

# Docker
.env

# sample data
application/CohortManager/SampleData/
*.csv
*.parquet
!tests/UnitTests/CaasIntegrationTests/receiveCaasFileTest/*.parquet
!tests/smoke-tests/dtos-cohort-manager-smoke-tests/TestFiles/**/*.parquet

# csv to sql statement scripts
bs_select_gp_practice_lpk.txt
current_posting.txt
select_outcode_mapping_lkp_output.txt

# Python
*.pyc


recreate_local_settings.sh

.history
application/CohortManager/Set-up/SampleData/CaaSSchema02.json
infrastructure/.terraform.lock.hcl
infrastructure/tf-core/.terraform.lock.hcl
infrastructure/tf-audit/.terraform.lock.hcl
application/CohortManager/.vscode/

# Ignore generated feature bindings
*.feature.cs
tests/smoke-tests/dtos-cohort-manager-smoke-tests/Config/appsettings-local.json
tests/e2e-tests/dtos-cohort-manager-e2e-tests/Config/appsettings-local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using dtos_cohort_manager_e2e_tests.Config;
public class AzureSettings
{
public bool IsCloudEnvironment { get; set; }
}

public class AppSettings
{
public ConnectionStrings ConnectionStrings { get; set; }
public AzureSettings AzureSettings { get; set; }
public string? ManagedIdentityClientId { get; set; }
public FilePaths FilePaths { get; set; }
public string BlobContainerName { get; set; }
public string AzureWebJobsStorage { get; set; }
}

public class ConnectionStrings
{
public string DtOsDatabaseConnectionString { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace dtos_cohort_manager_e2e_tests.Config;

public class FilePaths
{
public string Add { get; set; }
public string Amended { get; set; }
public string Remove { get; set; }
}
Comment thread
charanNHS marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"AppSettings": {
"ConnectionStrings": {
"DtOsDatabaseConnectionString": ""
},
"AzureSettings": {
"IsCloudEnvironment": true
},
"FilePaths": {
"Add": "TestFiles/add/",
"Amended": "TestFiles/amended/",
"Remove": "TestFiles/remove/"
},
"CloudFileStorageConnectionString": "",
"BlobContainerName": "inbound",
"ManagedIdentityClientId": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CsvHelper;
using dtos_cohort_manager_e2e_tests.Models;

namespace dtos_cohort_manager_e2e_tests.Contexts;

public class EndToEndTestsContext
{
public string FilePath { get; set; }

public RecordTypesEnum RecordType { get; set; }

public List<string>? NhsNumbers { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Feature: Epic1_AutomatedRegressionSuite
DTOSS Regression TEST PACK.

Background:
Given the database is cleaned of all records for NHS Numbers: 1111110662, 2222211794,2312514176,2612314172,2612514171
And the application is properly configured

@DTOSS-7583 @Regression
Scenario: Verify NHS data propagation across participant tables after file upload for ADD record
Comment thread
charanNHS marked this conversation as resolved.
Outdated
Given file <FileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then verify the NHS numbers in Participant_Management and Participant_Demographic table should match the file data

Examples:
| FileName | RecordType | NhsNumbers |
| ADD_2_RECORDS_-_CAAS_BREAST_SCREENING_COHORT.parquet | Add | 1111110662, 2222211794 |

@DTOSS-7583 @Regression
Scenario: Verify NHS data propagation across participant tables after file upload for AMENDED record
Given file <AddFileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
And the file is uploaded to the Blob Storage container
And the NHS numbers in the database should match the file data
And file <AmendedFileName> exists in the configured location for "Amended" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then verify the NhsNumbers in Participant_Management table should match <RecordType>
And the Participant_Demographic table should match the <AmendedGivenName> for the NHS Number

Examples:
| AddFileName | AmendedFileName | NhsNumbers | AmendedGivenName | RecordType |
| ADD1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | AMENDED1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | 2312514176 | AMENDEDNewTest1 | Amended |

@DTOSS-7584 @Regression
Scenario: Confirm NHS Number Count Integrity Across Participant Tables After Processing for ADD record
Given file <FileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then the NHS Number should have exactly 1 record in Participant_Management
And the NHS Number should have exactly 1 record in Participant_Demographic

Examples:
| FileName | RecordType | NhsNumbers |
| ADD_2_RECORDS_-_CAAS_BREAST_SCREENING_COHORT.parquet | Add | 1111110662, 2222211794 |

@DTOSS-7584 @Regression
Scenario: Confirm NHS Number Count Integrity Across Participant Tables After Processing for AMENDED record
Given file <AddFileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
And the file is uploaded to the Blob Storage container
And the NHS numbers in the database should match the file data
And file <AmendedFileName> exists in the configured location for "Amended" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then the NHS Number should have exactly 1 record in Participant_Management
And the NHS Number should have exactly 1 record in Participant_Demographic

Examples:
| AddFileName | AmendedFileName | NhsNumbers |
| ADD1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | AMENDED1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | 2312514176 |

@DTOSS-7585 @Regression
Scenario: Verify exception records doesn't end up in Participant_Demographic and Participant_Management table for ADD record
Comment thread
charanNHS marked this conversation as resolved.
Outdated
Given file <AddFileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then the Exception table should contain the below details for the NHS Number
| FieldName | FieldValue |
| RULE_ID | 36 |
| RULE_DESCRIPTION | Invalid primary care provider GP practice code |
Then the NHS Number should have exactly 1 record in Participant_Management
And the NHS Number should have exactly 1 record in Participant_Demographic
And the NHS Number should have exactly 0 record in Cohort_Distribution table

Examples:
| AddFileName | NhsNumbers |
| Exception_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | 2612314172 |

@DTOSS-7585 @Regression
Scenario: Verify exception records doesn't end up in Participant_Demographic and Participant_Management table for AMENDED record
Comment thread
charanNHS marked this conversation as resolved.
Outdated
Given file <AddFileName> exists in the configured location for "Add" with NHS numbers : <NhsNumbers>
And the file is uploaded to the Blob Storage container
And the NHS numbers in the database should match the file data
And file <AmendedFileName> exists in the configured location for "Amended" with NHS numbers : <NhsNumbers>
When the file is uploaded to the Blob Storage container
Then the Exception table should contain the below details for the NHS Number
| FieldName | FieldValue |
| RULE_ID | 17 |
| RULE_DESCRIPTION | Date of birth invalid |
Then the NHS Number should have exactly 1 record in Participant_Management
And the NHS Number should have exactly 1 record in Participant_Demographic
And the NHS Number should have exactly 1 record in Cohort_Distribution table

Examples:
| AddFileName | AmendedFileName | NhsNumbers |
| ADD_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | AMENDED_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet | 2612514171 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.IO;
using System.Threading.Tasks;
using Azure.Storage.Blobs;
using Microsoft.Extensions.Logging;

namespace dtos_cohort_manager_e2e_tests.Helpers;

public class BlobStorageHelper
{
private readonly BlobServiceClient _blobServiceClient;
private readonly ILogger<BlobStorageHelper> _logger;


public BlobStorageHelper(BlobServiceClient blobServiceClient, ILogger<BlobStorageHelper> logger)
{
_blobServiceClient = blobServiceClient;
_logger = logger;
}

public async Task UploadFileToBlobStorageAsync(string filePath, string blobContainerName)
{
if (!File.Exists(filePath))
{
_logger.LogError($"File not found at {filePath}");
return;
}

_logger.LogInformation("Uploading file {FilePath} to blob storage", filePath);

var blobContainerClient = _blobServiceClient.GetBlobContainerClient(blobContainerName);
await blobContainerClient.CreateIfNotExistsAsync();

var blobClient = blobContainerClient.GetBlobClient(Path.GetFileName(filePath));
await blobClient.UploadAsync(File.OpenRead(filePath), true);

_logger.LogInformation("File uploaded successfully");
}
}
47 changes: 47 additions & 0 deletions tests/e2e-tests/dtos-cohort-manager-e2e-tests/Helpers/CsvHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using CsvHelper;
using CsvHelper.Configuration;

namespace dtos_cohort_manager_e2e_tests.Helpers
{
public static class CsvHelperService
{
public static List<string> ExtractNhsNumbersFromCsv(string filePath)
{
using var reader = new StreamReader(filePath);
using var csv = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture));
var records = new List<string>();
csv.Read();
csv.ReadHeader();
while (csv.Read())
{
records.Add(csv.GetField(3));
}
return records;
}

public static List<Dictionary<string, string>> ReadCsv(string filePath)
{
using var reader = new StreamReader(filePath);
using var csv = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture));
var records = new List<Dictionary<string, string>>();
csv.Read();
csv.ReadHeader();
var headers = csv.HeaderRecord;

while (csv.Read())
{
var record = new Dictionary<string, string>();
foreach (var header in headers)
{
record[header] = csv.GetField(header);
}
records.Add(record);
}

return records;
}
}
}
Loading