[{"data":1,"prerenderedAt":66},["ShallowReactive",2],{"content-testing-python-starter-4-testing-in-the-cloud":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":12,"contributorPaths":13,"menuType":16,"contentName":17,"slug":18,"readingTime":19,"menu":20,"nextDocItem":52,"previousDocItem":40},"\u003Ch2>Run integration tests against cloud resources\u003C\u002Fh2>\n\u003Cp>Integration tests run against deployed cloud resources. Since local unit tests cannot adequately test IAM permissions, our integration tests confirm that permissions are properly configured. Run integration tests against your deployed cloud resources with the following command:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\"># Set the environment variable AWS_SAM_STACK_NAME to the name of the stack you specified during deploy\n AWS_SAM_STACK_NAME=&lt;stack-name&gt; python3 -m pytest -s tests\u002Fintegration -v\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>Invoke a Lambda function in the cloud\u003C\u002Fh2>\n\u003Cp>The \u003Ccode>AWS CLI\u003C\u002Fcode> enables you to invoke a Lambda function in the cloud.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\"># invoke a Lambda function in the cloud using the AWS CLI.  Substitute the function name as created in your stack.\n aws lambda invoke --function-name apigw-lambda-PythonTestDemo-6Ecinx8IauZv outfile.txt\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>Use SAM Accerate to speed up feedback cycles\u003C\u002Fh2>\n\u003Cp>AWS SAM Accelerate is a set of features that reduces deployment latency and enable developers to test their code quickly against production AWS services in the cloud. To learn more \u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=DDhOa4ekn80&ab_channel=ServerlessLand\">watch the video\u003C\u002Fa> or \n\u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Faccelerating-serverless-development-with-aws-sam-accelerate\u002F\">read the blog post\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\"># synchronize local code with the cloud\n sam sync --watch --stack-name apigw-lambda\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Now find the Lambda handler function in the \u003Ccode>src\\app.py\u003C\u002Fcode> file. Make a change to the \u003Ccode>print\u003C\u002Fcode> statement on line 26 and notice what happens in your sync window.\u003C\u002Fp>\n",{"title":6,"order":7,"callout":8},"Testing in the Cloud",4,{"title":9,"description":10,"link":11},"Check out other starter guides","Do you prefer to learn in another language? We also have starter guides in Java, TypeScript, and .NET.","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-test-samples\u002F","## Run integration tests against cloud resources\nIntegration tests run against deployed cloud resources. Since local unit tests cannot adequately test IAM permissions, our integration tests confirm that permissions are properly configured. Run integration tests against your deployed cloud resources with the following command:\n\n```bash\n# Set the environment variable AWS_SAM_STACK_NAME to the name of the stack you specified during deploy\n AWS_SAM_STACK_NAME=\u003Cstack-name> python3 -m pytest -s tests\u002Fintegration -v\n```\n\n## Invoke a Lambda function in the cloud\nThe `AWS CLI` enables you to invoke a Lambda function in the cloud.\n\n```bash\n# invoke a Lambda function in the cloud using the AWS CLI.  Substitute the function name as created in your stack.\n aws lambda invoke --function-name apigw-lambda-PythonTestDemo-6Ecinx8IauZv outfile.txt\n```\n\n## Use SAM Accerate to speed up feedback cycles\nAWS SAM Accelerate is a set of features that reduces deployment latency and enable developers to test their code quickly against production AWS services in the cloud. To learn more [watch the video](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=DDhOa4ekn80&ab_channel=ServerlessLand) or \n[read the blog post](https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Faccelerating-serverless-development-with-aws-sam-accelerate\u002F).\n\n```bash\n# synchronize local code with the cloud\n sam sync --watch --stack-name apigw-lambda\n```\n\nNow find the Lambda handler function in the `src\\app.py` file. Make a change to the `print` statement on line 26 and notice what happens in your sync window.\n",[14,15],"content\u002Fcontributors\u002Fdan-fox.json","content\u002Fcontributors\u002Frohan-mehta.json","LIST","Python Test Samples Starter Project","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F4-testing-in-the-cloud","2 min",[21],{"title":22,"content":23},"Testing Guide",[24,32,40,48,52,59],{"title":25,"order":26,"callout":27,"time":28,"path":29,"id":30,"link":31},"Introduction",1,{"title":9,"description":10,"link":11},"1 min","1-introduction","1-introduction.md","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F1-introduction",{"title":33,"order":34,"callout":35,"time":36,"path":37,"id":38,"link":39},"Project Setup",2,{"title":9,"description":10,"link":11},"3 min","2-project-setup","2-project-setup.md","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F2-project-setup",{"title":41,"order":42,"callout":43,"time":44,"path":45,"id":46,"link":47},"Local Testing",3,{"title":9,"description":10,"link":11},"4 min","3-local-testing","3-local-testing.md","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F3-local-testing",{"title":6,"order":7,"callout":49,"time":19,"path":50,"id":51,"link":18},{"title":9,"description":10,"link":11},"4-testing-in-the-cloud","4-testing-in-the-cloud.md",{"title":53,"order":54,"callout":55,"time":19,"path":56,"id":57,"link":58},"Observability in Testing",5,{"title":9,"description":10,"link":11},"5-observability-in-testing","5-observability-in-testing.md","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F5-observability-in-testing",{"title":60,"order":61,"callout":62,"time":28,"path":63,"id":64,"link":65},"Cleanup",6,{"title":9,"description":10,"link":11},"6-cleanup","6-cleanup.md","\u002Fcontent\u002Ftesting\u002Fpython-starter\u002F6-cleanup",1792578875033]