Improve Lambda Test Tool v2 getting-started docs and add samples - #2494
Improve Lambda Test Tool v2 getting-started docs and add samples#2494GarrettBeatty wants to merge 3 commits into
Conversation
Rewrite the LambdaTestTool-v2 README to be usage-first and fix several copy-paste-breaking inaccuracies: - Add a top-of-page Quick Start (install -> run -> invoke -> result) and a Prerequisites section (.NET 8+, PATH for global tools, verify step). - Fix the API Gateway route Endpoint example to use the base URL (http://localhost:5050) instead of appending the function name. - Make emulator-mode examples consistently HttpV2 to match the sample handler (avoids HTTP 502) and normalize Get/HttpV2 casing. - Correct and complete the command-line options table; document the info command, SQS and DynamoDB Streams event sources, the web UI workflow, built-in sample events, saved requests, and theming. - Add Troubleshooting and Known Limitations sections; remove the duplicate H1 and stale version note; reframe the Aspire pointer. Add runnable sample projects under samples/ (AddFunctionTopLevel, AddFunctionClassLibrary, SQSProcessor, ToUpperFunction), each with its own README and committed launch profile. Add a .gitignore exception so the samples' launchSettings.json files are tracked.
Verified end-to-end that a class-library Lambda function can run from the command line (not just an IDE). The Executable launch profile relies on the IDE expanding $(Configuration) and resolving workingDirectory, which plain 'dotnet run --launch-profile' does not do. - Add CopyLocalLockFileAssemblies to the AddFunctionClassLibrary sample so its NuGet dependencies are copied to the build output, making the function self-contained for a command-line 'dotnet exec' launch. - Restructure README Option 2 to lead with the command-line 'dotnet exec' steps and keep the IDE launch profile as a secondary option, noting the dotnet-run-vs-IDE caveat. - Rewrite the sample README with both command-line and IDE launch paths.
| # AWS Lambda Test Tool | ||
|
|
||
| ## Overview | ||
| The AWS Lambda Test Tool provides local testing capabilities for .NET Lambda functions with support for both Lambda emulation and API Gateway emulation. This tool allows developers to test their Lambda functions locally in three different modes: |
There was a problem hiding this comment.
i had go through here and correct a bunch of things. i then asked it to go through the readme and follow the steps and see if it could run the test tool etc following the steps in the readme and it could
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> |
There was a problem hiding this comment.
will update to net 10. same in other places
There was a problem hiding this comment.
Pull request overview
Improves the getting-started experience for Lambda Test Tool v2 by restructuring and correcting the main README and adding runnable sample projects under Tools/LambdaTestTool-v2/samples/ to demonstrate common local-testing workflows (Lambda emulator, API Gateway emulator, and SQS).
Changes:
- Reworked
Tools/LambdaTestTool-v2/README.mdinto a usage-first guide (Quick Start, prerequisites, web UI, event sources, troubleshooting/limitations). - Added multiple minimal, runnable sample projects (API Gateway
HttpV2, class-library launch, SQS handler, and UI-only string handler), each with its own README and launch profile. - Updated
.gitignoreto ensure samplelaunchSettings.jsonfiles are tracked.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/LambdaTestTool-v2/README.md | Major documentation restructure + new feature coverage and troubleshooting/limitations sections. |
| Tools/LambdaTestTool-v2/samples/README.md | Index of available sample projects and prerequisites. |
| Tools/LambdaTestTool-v2/samples/AddFunctionTopLevel/AddFunctionTopLevel.csproj | New net8 sample project for Quick Start flow. |
| Tools/LambdaTestTool-v2/samples/AddFunctionTopLevel/Program.cs | Top-level HttpV2 API Gateway handler sample implementation. |
| Tools/LambdaTestTool-v2/samples/AddFunctionTopLevel/README.md | Step-by-step run/invoke instructions for the top-level API Gateway sample. |
| Tools/LambdaTestTool-v2/samples/AddFunctionTopLevel/Properties/launchSettings.json | Launch profile wiring AWS_LAMBDA_RUNTIME_API for the sample. |
| Tools/LambdaTestTool-v2/samples/AddFunctionClassLibrary/AddFunctionClassLibrary.csproj | New net8 class-library sample project configuration (deps/runtimeconfig + local deps copy). |
| Tools/LambdaTestTool-v2/samples/AddFunctionClassLibrary/Function.cs | Class-library handler sample implementation. |
| Tools/LambdaTestTool-v2/samples/AddFunctionClassLibrary/README.md | CLI + IDE instructions for launching a class-library handler under the test tool’s runtime support shim. |
| Tools/LambdaTestTool-v2/samples/AddFunctionClassLibrary/Properties/launchSettings.json | IDE launch profile wrapping dotnet exec for the shim-based class-library flow. |
| Tools/LambdaTestTool-v2/samples/SQSProcessor/SQSProcessor.csproj | New net8 SQS sample project. |
| Tools/LambdaTestTool-v2/samples/SQSProcessor/Program.cs | SQSEvent handler sample implementation. |
| Tools/LambdaTestTool-v2/samples/SQSProcessor/README.md | Instructions for testing with built-in sqs.json and with a real queue via event-source polling. |
| Tools/LambdaTestTool-v2/samples/SQSProcessor/Properties/launchSettings.json | Launch profile wiring AWS_LAMBDA_RUNTIME_API for the sample. |
| Tools/LambdaTestTool-v2/samples/ToUpperFunction/ToUpperFunction.csproj | New net8 UI-only string handler sample project. |
| Tools/LambdaTestTool-v2/samples/ToUpperFunction/Program.cs | Minimal string-to-upper handler using runtime support bootstrap. |
| Tools/LambdaTestTool-v2/samples/ToUpperFunction/README.md | Instructions focused on invoking via the web UI. |
| Tools/LambdaTestTool-v2/samples/ToUpperFunction/Properties/launchSettings.json | Launch profile wiring AWS_LAMBDA_RUNTIME_API for the sample. |
| .gitignore | Adds an exception rule so sample launchSettings.json files are committed. |
Comments suppressed due to low confidence (1)
Tools/LambdaTestTool-v2/README.md:226
- The options table lists a default value for
--api-gateway-emulator-mode, but the CLI requires this option to be explicitly set whenever--api-gateway-emulator-port/--api-gateway-emulator-https-portare provided. Marking a default here can lead readers to omit the option and hit an error.
| `--api-gateway-emulator-mode <MODE>` | API Gateway mode: `Rest`, `HttpV1`, or `HttpV2`. | `HttpV2` |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…g-storage-path docs
|
fixed copilot comments |
| @@ -0,0 +1,78 @@ | |||
| # AddFunctionClassLibrary | |||
There was a problem hiding this comment.
You could remove this file, not needed for this sample and I assume just created from the new project template.
| @@ -0,0 +1,38 @@ | |||
| # AddFunctionTopLevel | |||
There was a problem hiding this comment.
You could remove this file, not needed for this sample and I assume just created from the new project template.
| @@ -0,0 +1,39 @@ | |||
| # SQSProcessor | |||
There was a problem hiding this comment.
You could remove this file, not needed for this sample and I assume just created from the new project template.
| @@ -0,0 +1,27 @@ | |||
| # ToUpperFunction | |||
There was a problem hiding this comment.
You could remove this file, not needed for this sample and I assume just created from the new project template.
Summary
Improves the getting-started experience for the Lambda Test Tool v2. Based on a full review of the README against the actual source, this fixes copy-paste-breaking inaccuracies, documents features that shipped but were undocumented, restructures the doc to be usage-first, and adds runnable sample projects. Every sample and documented flow was verified end-to-end against the installed tool (v0.15.0).
README changes
HttpV2.~/.dotnet/toolson PATH, verify step).Endpointnow uses the base URL (http://localhost:5050) instead of wrongly appending the function name.HttpV2to match the sample handler (previouslyRest, which yields HTTP 502); casing normalized (HttpV2,Get).infocommand, SQS and DynamoDB Streams event sources, the web UI invoke workflow, the 58 built-in sample events, saved requests, and theming.dotnet execpath and keeps the IDE launch profile as a secondary option, with thedotnet runvs IDE caveat called out.Sample projects (new, under
Tools/LambdaTestTool-v2/samples/)AddFunctionTopLevelAddFunctionClassLibrarySQSProcessorSQSEventhandler (SQS event source or built-insqs.json)ToUpperFunctionEach has its own README and a committed launch profile (added a
.gitignoreexception so the samplelaunchSettings.jsonfiles are tracked).Verification
Installed the tool (
amazon.lambda.testtool0.15.0) and ran each sample:AddFunctionTopLevel—curl /add/5/3→8(HTTP 200)AddFunctionClassLibrary— verified both the.storeruntime-support path and a token-free CLIdotnet execlaunch →8(HTTP 200)ToUpperFunction—"hello world"→"HELLO WORLD"(HTTP 200)SQSProcessor— built-insqs.jsonevent → processed "Hello from SQS!" (HTTP 200)