Robot Framework Code - VS Code Extension
VS Code extension for Robot Framework - Create and manage Robot Framework projects with ease.
Requirements
- Python 3.8+ and Robot Framework 7.2+
- Visual Studio Code with Python extension
- Robot Framework Language Server (recommended)
Installing
Robot Framework Code can be installed from the Visual Studio Marketplace.
Configuration
Robot Framework Code is designed to work out of the box without additional configuration. The extension automatically:
- Detects and validates Python interpreters
- Configures VSCode settings for Robot Framework
- Sets up Python paths for both VENV and Poetry environments
- Configures Robot Framework Language Server integration
All configuration is handled automatically during the "Install Environment" process.
Features (0.1.4)
Environment Setup
- Install Environment: Interactive command to configure complete Robot Framework environment
- Support for VENV and POETRY dependency management
- Automatic installation of project-specific libraries
- Automatic VSCode and Robot Framework Language Server configuration
Project Types Supported
- API: RequestsLibrary for API testing ✅ Fully implemented
- WEB: BrowserLibrary for web testing 🔄 Coming in future updates
- MOBILE: AppiumLibrary for mobile testing 🔄 Coming in future updates
API Keyword Generation
- Generate Keywords From Swagger: Generate keywords from Swagger/OpenAPI URL
- Generate Keywords from Swagger JSON: Generate keywords from local JSON file
- Generate Keywords from cURL: Generate keywords from cURL commands
- Automatic API session creation
- Python contract generation for complex payloads
- Multi-environment configuration (dev, hml, sdb, prd)
- Automatic GitHub Actions workflow creation 🆕
Project Structure
- API: Complete structure with automatic directory creation ✅ Fully implemented
- WEB & MOBILE: Basic structure creation 🔄 Coming in future updates
- Organized resource management
CI/CD Integration
- Automatic GitHub Actions workflow creation 🆕
- Poetry and VENV support with optimized caching
- Robot Framework test execution on PRs and pushes
- Automatic report generation and PR comments
- Artifact upload for detailed test analysis
User Experience
- English Language Support: All user-facing messages and console logs in English
- Clean Interface: No emojis in user messages for professional appearance
- Comprehensive Error Handling: Clear error messages and validation feedback
Commands
Command |
Description |
Robot Framework Code: Install Environment |
Configure Robot Framework environment |
Robot Framework Code: [API] Generate Keywords From Swagger |
Generate keywords from Swagger URL |
Robot Framework Code: [API] Generate Keywords from Swagger JSON |
Generate keywords from JSON file |
Robot Framework Code: [API] Generate Keywords from cURL |
Generate keywords from cURL command |
Usage Examples
Setting up Environment for API Testing
- Open a folder in VS Code
- Execute
Robot Framework Code: Install Environment
- Select API as project type
- Choose VENV as environment manager
- Wait for automatic configuration
Note: WEB and MOBILE project types are coming in future updates. Currently, only API projects are fully supported.
Generating Keywords for Petstore API
- Execute
Robot Framework Code: [API] Generate Keywords From Swagger
- Enter:
https://petstore.swagger.io/v2/swagger.json
- Configure session:
- Application name:
petstore
- Session alias:
petstore_session
- Environments: dev, hml, sdb, prd
- Extension will generate keywords for all endpoints
Generating Keyword from cURL
- Execute
Robot Framework Code: [API] Generate Keywords from cURL
- Paste the command:
curl -X POST "https://api.example.com/users" \
-H "Content-Type: application/json" \
-d '{"name": "John", "email": "john@example.com"}'
- Enter name:
Create User
- Extension will generate keyword with parameters and Python contract
Note: GitHub Actions workflow creation is only available for API projects during environment setup.
Automatic GitHub Actions Workflow Creation 🆕
When creating an API project through the "Install Environment" command, the extension automatically creates a GitHub Actions workflow for CI/CD:
- Automatic Detection: Detects if project uses Poetry or VENV
- Template Selection: Chooses appropriate workflow template
- Cache Optimization: Configures optimized caching for dependencies
- Complete Setup: Creates
.github/workflows/robot-tests.yml
Features:
- ✅ Poetry Support: Optimized cache for
.venv
and .cache/pypoetry
- ✅ VENV Support: Optimized cache for
~/.cache/pip
and venv/
- ✅ Automatic Triggers: PRs, pushes to main, and manual execution
- ✅ Report Generation: Uploads test reports as artifacts in Github Actions
Generated Workflow:
name: Robot Framework Tests
on: [pull_request, push, workflow_dispatch]
jobs:
execute_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Cache dependencies
- name: Install dependencies
- name: Execute tests
- name: Upload reports
- name: Comment on PR
The workflow is automatically created during API project setup and includes all necessary configurations for Robot Framework testing.
Project Structure
API Project
api-project/
├── tests/ # Stores test suites
├── resources/
│ ├── connections/ # Responsible for files and keywords related to connections
│ ├── routes/ # Responsible for storing keywords that execute API endpoints
│ └── contracts/ # Responsible for storing Python libs that build request bodies
├── session.resource # Responsible for creating API sessions
├── session_data.yml # Responsible for storing session data, separated by environments
├── base.resource # Responsible for imports and environment control variables
└── requirements.txt (or pyproject.toml)
Web Project
web-project/
├── tests/ # Created automatically
├── resources/ # Created automatically
└── requirements.txt (or pyproject.toml)
Mobile Project
mobile-project/
├── tests/ # Created automatically
├── resources/ # Created automatically
└── requirements.txt (or pyproject.toml)
Dependencies by Project Type
API
robotframework>=7.2
robotframework-requests>=1.0a14
pyyaml>=6.0
WEB
robotframework>=7.2
robotframework-browser>=19.7.0
pyyaml>=6.0
MOBILE
robotframework>=7.2
robotframework-appiumlibrary>=3.0.0
pyyaml>=6.0
Poetry Support
When selecting POETRY as environment manager:
- Project Description: Will be requested for the project
- Automatic Initialization:
poetry init
command will be executed automatically
- Project Name: Will use the workspace folder name
- Dependencies: Will automatically install Robot Framework and specific libraries
- Robust Configuration: Will configure Poetry Python interpreter in VSCode with validation
Python Interpreter Validation
The extension includes robust Python interpreter validation to avoid common issues:
For Poetry
- ✅ Automatic Detection: Uses
poetry env info --path
to get correct path
- ✅ Validation: Verifies if interpreter exists and works
- ✅ Fallback: Multiple detection strategies to ensure compatibility
- ✅ Complete Configuration: Includes all necessary VSCode settings
Automatic Settings
{
"python.defaultInterpreterPath": "path/to/poetry/python",
"python.pythonPath": "path/to/poetry/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.analysis.extraPaths": ["./src"],
"python.analysis.autoImportCompletions": true,
"robotframework.language-server.python": "path/to/poetry/python"
}
Roadmap
✅ Completed
- [x] Robot Framework environment installation
- [x] VENV and Poetry support
- [x] Swagger keyword generation (URL and JSON)
- [x] cURL keyword generation
- [x] Automatic API session creation
- [x] Python contract generation
- [x] Automatic VSCode configuration
- [x] Multi-environment support
- [x] Automatic GitHub Actions workflow creation 🆕
- [x] English language support and message improvements 🆕
🔄 In Development
- [ ] Web testing with BrowserLibrary
- [ ] Test recording
- [ ] Locator debugging
- [ ] Advanced templates
📋 Planned
- [ ] Mobile testing with Appium
- [ ] Custom reports
- [ ] Advanced CI/CD features
- [ ] Multi-browser support
Contributing
Contributions are welcome! To contribute:
- Fork the project
- Create a feature branch
- Commit your changes
- Open a Pull Request
Reporting Issues
If you encounter problems or have questions:
- Verify Python is installed and in PATH
- Ensure Python and Robot Framework LSP extensions are installed
- Open an issue on GitHub with problem details
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For support and questions:
- Check if Python is installed and in PATH
- Make sure Python and Robot Framework LSP extensions are installed
- Open an issue on GitHub with problem details
Developed with ❤️ for the Robot Framework community