Service - Integration Testing: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
Line 88: Line 88:
= Working documents =
= Working documents =


[[:Category:Working_documents - Integration Testing]]
[[:Category:Working_documents - Integration Testing|Working_documents - Integration Testing]]


[[Category:Backend services| Integration Testing]]
[[Category:Backend services| Integration Testing]]

Revision as of 08:42, 4 November 2020

Overview

Service that pulls integration tests from the Integration Test Config service, invokes each test and monitors the steps execute as expected.

This service is intended to be run in a deployed AWS environment, all services and resources required for the integration tests need to be operational.

DynamoDB tables

TestRecord

Fields

integrationTestTag
(partition key)
testStartedTimestamp
(sort key)
time the integration test was started/created.
testCompleteTimestamp
time the integration test completed.
testSettings
straight copy of test configuration testSettings property
stages
an object that holds the details and status of each stage #testRecord.stages structure
testStatus
current status of the integration test, either processing, passed, or failed
testErrors
an array of any misc errors found (probably stored as a set, ordering is not important and should not have any duplicates)

testRecord.stages structure

[
    {
        stageConfig: {
            //straight copy of this stage from integration test config
        },
        stageStatus: waiting|passed|failed,
        stageFinishedTimestamp: {time that all tests finished and testRecord.stages.{stageKey}.stageStatus updated}
        stageResults: {
            //results at the point of entering the resource (eg a Lambda function is invoked)
            inputResult: {
                resultTimestamp: {time result saved},
                resultStatus: passed|failed,
                requestParams: {a copy of the requestParams}
            },
            //results at the point of returning from the resource (eg a Lambda function returns)
            outputResult: {
                resultTimestamp: {time result saved},
                resultStatus: passed|failed,
                returnValue: {a copy of the value returned by the resource} 
                //.. maybe other settings for errors etc..
            },
            //results at the point of invoking an external resource (eg the tested Lambda function is invoking another Lambda function)
            invokes: {
                {serviceName_resourceType_resourceName_inputEventTag}: {
                    invokeTimestamp: {time result saved},
                    resultTimestamp: {time result saved},
                    resultStatus: passed|failed,
                    invokeParams: {a copy of the parameters sent to the resource}
                    returnValue: {a copy of the value returned by the resource}
                },
                ..
            },
        },
        stageErrors: [
            //misc errors encountered
        ]
    },
    ...
]

Initiating tests

When the initial request is sent to begin an integration test the middleware LOG_LEVEL is set to DEBUG, this causes all Lambda functions and requests to external services to also add a message to the services MsgOut queue.

The Integration Testing service subscribes to these queues and uses these messages to monitor each stage of the workflow to ensure input and output is as expected, and that the integration test completes fully.

Add the following Correlation Ids to the initial request so we can track the integration test, filter messages, etc.:

intTest-tag
matches the test's integrationTestTag
intTest-time
matches the test's testStartedTimestamp

These can also be used in production environment to exclude requests that middleware randomly set to debug from requests initiated by Integration Test service.

Working documents

Working_documents - Integration Testing