AWS Amplify Serverless Backend Adds CLI Mocking and Testing
After a recent infusion of machine lerning functionality, Amazon Web Services Inc. (AWS) has boosted the capabilities of its Amplify Framework, a cloud-powered, serverless backend for mobile and Web apps, specifically mock-based testing.
Recently AWS added a Predictions category to the list of pre-trained machine learning models that developers can leverage in their apps.
Last week, AWS announced new mocking and testing functionality for Amplify CLI, the command-line interface used with the framework.
Amplify CLI provides a unified toolchain of libraries, UI components and a command-line interface to help developers add cloud services and backend resources to Web or mobile apps via CloudFormation, which provides a common language for describing and provisioning cloud infrastructure resources.
A new mocking capability speeds up the iterative development process by locally emulating a simplified cloud service API for quicker testing, without needing to resort to full-blown usage of the service that requires accompanying management details and overhead.
While not acting exactly like a complete service API, the emulation provides basic functionality for testing purposes.
"With this new mocking capability you can test your changes quickly, without the need of provisioning or updating the cloud resources you are using at every step," AWS said. "In this way, you can set up unit and integration tests that can be executed rapidly, without affecting your cloud backend. Depending on the architecture of your app, you can set up automatic testing in your CI/CD pipeline without provisioning backend resources."
Initially, the Amplify CLI service can locally mock:
- AppSync GraphQL APIs, including resolver mapping templates and storage backed by Amazon DynamoDB.
- AWS Lambda functions invoked directly or as resolvers of a GraphQL API.
- Amazon Simple Storage Service (S3) buckets used as storage for an application.
- Amazon Cognito User Pool authentication for GraphQL APIs, but developers need first to get a JSON Web Token (JWT) from the actual service; after that, the JWT is honored locally.
AWS last week published guidance to help developers get started with the new functionality in an article titled "Developing and testing GraphQL APIs, Storage and Functions with Amplify Framework Local Mocking features."
Amplify CLI development is done on GitHub.
David Ramel is an editor and writer for Converge360.