Go Table Driven Tests CodeLens ProviderA Visual Studio Code extension that enhances the workflow of working with Go test files by injecting CodeLens above test case declarations. These CodeLens actions allow you to easily run or debug individual test cases with a single click. 📖 OverviewThe Given the following single-line test structure:
Or this multi-line test structure:
The extension will display Run Test and Debug Test options above each test case declaration. 🚀 FeaturesCodeLens for Structured Test Cases:Detects and highlights test cases with a name field inside struct declarations. CodeLens for Inline Test Cases:Recognizes inline test case definitions within test arrays or slices. One-Click Testing:Run or debug individual test cases directly from the editor. Parent Test Function Detection:Associates test cases with their parent test function to ensure proper execution. 🔧 Problem It SolvesManually identifying and executing specific test cases in large test suites can be time-consuming. This extension automates this process by injecting actionable CodeLens above test case declarations, allowing developers to:
🖥️ CompatibilitySupported VS Code Versions: >=1.93.0. Supported Go Versions: Standard Go testing patterns are assumed. 📚 UsageOpen a _test.go file in your Go project. Hover over test case declarations to see the Run Test and Debug Test options. Click the desired option to run or debug the specific test case. 💡 NotesThis extension uses regular expressions to identify test case declarations. Ensure your test cases follow standard Go testing patterns. For structured test cases, ensure the name field is present at the beginning of the test declaration and uniquely identifies each test. 🛠️ ContributingContributions are welcome! Feel free to fork the repository, submit issues, or create pull requests. 📜 LicenseThis project is licensed under the MIT License. |