VReq - File Based API Testing for VS Code
Run API requests from simple text files with environments, chaining,
scripts, and tests --- directly inside VS Code.
VReq is a lightweight file-based API testing tool designed as a
developer-friendly alternative to GUI tools like Postman.
Sample test API repository setup here
Features
• Run HTTP requests directly from .vreq files
• Environment configuration using .venv files
• Request chaining and dependencies
• Pre/Post request scripts
• Built-in response viewer (JSON + headers + timing)
• Test assertions for API validation
• CodeLens support for quick execution
• Diagnostics and linting for request files
File Types
File Purpose
.vreq API requests and collections
.venv Environment variables
.vscript Pre/Post scripts
.vtest Optional test definitions
Quick Start
Create an environment
Create env/dev.venv
host: https://postman-echo.com
headers.Accept: application/json
tenantId: dev
timeoutMs: 30000
debug: false
forceNoProxy: false
useSystemProxy: false
# optional enterprise CA bundle (PEM)
tls.caFile: C:\\certs\\corp-root-ca.pem
# optional override when useSystemProxy=true
# proxyUrl: http://proxy.company.local:8080
Create a request
Create reqs/echo.vreq
Collection: Echo Demo
---
Name: getEcho
Request:
GET {{host}}/get
Query:
hello: world
tenant: {{tenantId}}
page: 1
Headers:
Accept: application/json
Tests:
- status is 200
- header content-type contains json
Select environment
Open Command Palette and run:
VReq: Select Environment
Run the request
Open the .vreq file and click:
▶ Run Request
or
▶ Run File
Tests
Example assertions:
Tests:
- status is 200
- header content-type contains json
- json.path user.id exists
- json.path status equals success
- body contains success
- time lessThanMs 500
Scripts
Example pre-script.vscript
log.info("Executing pre request script")
ctx.set("traceId", crypto.randomUUID())
req.headers["X-Trace-Id"] = ctx.get("traceId")
Objects available inside scripts:
Object Purpose
env environment variables
ctx shared runtime variables
req request object
res response object
log extension logger
Commands
Command Description
VReq: Select Environment choose environment
VReq: Run Current Request run request under cursor
VReq: Run File run entire collection
VReq: Show Last Response open response viewer
Why VReq?
Most API tools rely heavily on GUI workflows.
VReq focuses on:
• version-controlled API tests
• simple text-based configuration
• automation-friendly workflows
• developer-centric experience
Your API tests live alongside your source code.
License
MIT License