AWS prescriptive-guidance documentation change
Summary
Updated formatting of section headers, fixed punctuation (straight apostrophes), expanded SQS service name to full form, standardized test pattern terminology (arrange/act/assert), and clarified best practices section title
Security assessment
The changes are grammatical improvements, formatting adjustments, and clarification of service names/acronyms. No specific security vulnerabilities or security features are mentioned. While IAM role/policy validation is referenced, this is existing security documentation rather than new content.
Diff
diff --git a/prescriptive-guidance/latest/serverless-application-testing/faq.md b/prescriptive-guidance/latest/serverless-application-testing/faq.md index ff5718475..1b4ace193 100644 --- a//prescriptive-guidance/latest/serverless-application-testing/faq.md +++ b//prescriptive-guidance/latest/serverless-application-testing/faq.md @@ -5 +5 @@ -I have a Lambda function that performs calculations and returns a result without calling any other services. Do I really need to test this in the cloud?How can testing in the cloud help with unit testing? If it’s in the cloud and connects to other resources, isn’t that an integration test? +I have a Lambda function that performs calculations and returns a result without calling any other services. Do I really need to test this in the cloud?How can testing in the cloud help with unit testing? If it's in the cloud and connects to other resources, isn't that an integration test? @@ -11 +11 @@ I have a Lambda function that performs calculations and returns a result without -Yes. Lambda functions have configuration parameters that could change the outcome of the test. All Lambda function code has a dependency on [timeout and memory settings](https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html), which could cause the function to fail if they aren’t set properly. Lambda policies also enable standard output logging to [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/). Even if your code doesn’t call CloudWatch directly, a permission is required in order to enable logging, and that permission cannot be accurately mocked or emulated. +Yes. AWS Lambda functions have configuration parameters that could change the outcome of the test. All Lambda function code has a dependency on [timeout and memory settings](https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html), which could cause the function to fail if they aren't set properly. Lambda policies also enable standard output logging to [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/). Even if your code doesn't call CloudWatch directly, a permission is required in order to enable logging, and that permission cannot be accurately mocked or emulated. @@ -13 +13 @@ Yes. Lambda functions have configuration parameters that could change the outcom -## How can testing in the cloud help with unit testing? If it’s in the cloud and connects to other resources, isn’t that an integration test? +## How can testing in the cloud help with unit testing? If it's in the cloud and connects to other resources, isn't that an integration test? @@ -15 +15 @@ Yes. Lambda functions have configuration parameters that could change the outcom -We define unit tests as tests that operate on architectural components in isolation. This definition doesn’t necessarily preclude the use of service calls or other network communications. +We define unit tests as tests that operate on architectural components in isolation. This definition doesn't necessarily preclude the use of service calls or other network communications. @@ -17 +17 @@ We define unit tests as tests that operate on architectural components in isolat -Many serverless applications do have architectural components that can be tested in isolation, even in the cloud. A basic example is a Lambda function that takes some input, interprets it, and sends a message to an SQS queue. A unit test of such a function would likely test whether input values result in certain values being present in the queued message. Consider a test that is written by using the Arrange, Act, Assert pattern: +Many serverless applications do have architectural components that can be tested in isolation, even in the cloud. A basic example is a Lambda function that takes some input, interprets it, and sends a message to an Amazon Simple Queue Service (Amazon SQS) queue. A unit test of such a function would likely test whether input values result in certain values being present in the queued message. Consider a test that is written by using the _arrange, act, assert_ pattern: @@ -19 +19 @@ Many serverless applications do have architectural components that can be tested - * _Arrange_ : Allocate resources (a queue to receive messages, and the function under test). + * **Arrange** – Allocate resources (a queue to receive messages, and the function under test). @@ -21 +21 @@ Many serverless applications do have architectural components that can be tested - * _Act_ : Call the function under test. + * **Act** – Call the function under test. @@ -23 +23 @@ Many serverless applications do have architectural components that can be tested - * _Assert_ : Retrieve the message sent by the function, and validate the output. + * **Assert** – Retrieve the message sent by the function, and validate the output. @@ -28 +28 @@ Many serverless applications do have architectural components that can be tested -A mock testing approach would involve mocking the queue with an in-process mock object, and creating an in-process instance of the class or module that contains the Lambda function code. During the Assert phase, the queued message would be retrieved from the mocked object. +A mock testing approach would involve mocking the queue with an in-process mock object, and creating an in-process instance of the class or module that contains the Lambda function code. During the assert phase, the queued message would be retrieved from the mocked object. @@ -30 +30 @@ A mock testing approach would involve mocking the queue with an in-process mock -In a cloud-based approach, the test would create an SQS queue for the purposes of the test, and would deploy the Lambda function with environment variables that are configured to use the isolated SQS queue as the output destination. After running the Lambda function, the test would retrieve the message from the SQS queue. +In a cloud-based approach, the test would create an Amazon SQS queue for the purposes of the test, and would deploy the Lambda function with environment variables that are configured to use the isolated Amazon SQS queue as the output destination. After running the Lambda function, the test would retrieve the message from the Amazon SQS queue. @@ -32 +32 @@ In a cloud-based approach, the test would create an SQS queue for the purposes o -The cloud-based test would run the same code, assert the same behavior, and validate the application’s functional correctness. However, it would have the added advantage of being able to validate the settings of the Lambda function: the IAM role, IAM policies, and the function’s timeout and memory settings. +The cloud-based test would run the same code, assert the same behavior, and validate the application's functional correctness. However, it would have the added advantage of being able to validate the following settings of the Lambda function: the AWS Identity and Access Management (IAM) role, IAM policies, and the function's timeout and memory settings. @@ -40 +40 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please -Best practices +Best practices for testing serverless applications