2021-01-15 - Integration Testing - Adding DynamoDB result tests

From Izara Wiki
Jump to navigation Jump to search

Service - Integration Testing

Goal is to check DynamoDB results at the end of processing any Lambda stage.

There is no way to ensure the order Lambda output results will arrive and be processed by Integration Testing so should only test data that will not change during other stages.

building the configuration

2020-10-01 - Integration Testing - Lambda Functions:initiateTest

if have any stage has dynamoDbOutput set, use lambdaEndpoint_getEventTests to pull in the dynamoDbOutput eventTag, put into that dynamoDbOutput element's object as eventConfig property.

performing the tests

2020-10-01 - Integration Testing - Lambda Functions:receiveMsgOutput

(if can use checkOutputEventOneLevel to compare DynamoDB item with dynamodbOutputCfg.eventConfig): Planning on any not matching properties to go into propertyNotPass array, mixed with Lambda response properties that do not pass.

Add an extra parameter to checkOutputEventOneLevel function: notPassPrefix, this gets passed each level of checkOutputEventOneLevel invocation, default to "". When propertyNotPass.push add this string before propertyName.

After running checkOutputEventOneLevel:

  1. if resultTag == 'outputResult' && testRecord.Item.stages[matchingStageKey].stageConfig.dynamodbOutput exists
    1. iterate testRecord.Item.stages[matchingStageKey].stageConfig.dynamodbOutput as variable: dynamodbOutputCfg
      1. use dynamodbOutputCfg.eventConfig.keyValues to create query keys
      2. do a get to pull record from DynamoDB table
      3. should be able to use checkOutputEventOneLevel function to compare DynamoDB item with dynamodbOutputCfg.eventConfig, set notPassPrefix to "DynamoDB result {eventTag}.{propertyName}"