Skip to content

jeffflater/testjeff-course-python-behave-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 TestJeff Course: Python Behave API Testing

Welcome to the TestJeff Course Repository for mastering API Testing with Python and Behave. This repo contains hands-on examples, Docker integration, and complete test automation pipelines for REST, SOAP, GraphQL, WebSocket, and RPC APIs.


🚀 Course Overview

This repository supports the TestJeff API Testing Course. You'll learn how to:

  • Structure and write Gherkin feature files
  • Create step definitions using Behave
  • Test various API protocols: REST, SOAP, GraphQL, WebSocket, and JSON-RPC
  • Run tests in Dockerized environments
  • Integrate with CI and generate test reports

📂 Project Structure

test/
└── features/
    ├── environment/         # Global setup and teardown logic
    ├── steps/               # Step definitions (.py)
    ├── support/             # Utility modules
    └── *.feature            # Gherkin feature files
.env                         # API keys and configuration variables
docker-compose.yml           # Optional Docker services
reports/                     # Test output (e.g., JUnit, HTML)

🛠️ Prerequisites

  • Docker
  • VS Code
  • Python 3.10+ (if running outside Docker)
  • API keys for third-party APIs (Finnhub, etc.)

⚙️ Setup

Clone the repo

git clone https://github.com/testjeff/testjeff-course-python-behave-api.git
cd testjeff-course-python-behave-api

Create a .env file

FINNHUB_API_KEY=your_api_key_here
NEWS_API_KEY=your_api_key_here
WEATHER_API_KEY=your_api_key_here

Build Docker image

docker build -t behave-test .

▶️ Run Tests

VS Code Tasks

Use the preconfigured VS Code tasks:

  • Docker: Run Welcome Feature Only
  • Docker: Run Finnhub REST API Test
  • Docker: Run All Behave Tests

Or run manually:

docker run --rm --env-file .env -v ${PWD}/reports:/app/reports behave-test behave test/features

🧪 Sample Feature

Feature: Get stock quote from Finnhub API

  Scenario: Successful stock quote fetch for AAPL
    Given I have a valid API key
    When I request a stock quote for "AAPL"
    Then the response status should be 200
    And the current price should be a positive number

📘 Course Notes

Refer to the Module Guide included with the course to follow along lesson by lesson and get the most out of the provided examples.


🤖 GitHub Copilot

Try using Copilot to:

  • Auto-generate step definitions from feature files
  • Extend test coverage for edge cases
  • Refactor and improve test logic

🧑‍💻 Contributing

Pull requests are welcome! If you have ideas for extending this project or submitting test cases, feel free to fork and contribute.


📜 License

MIT License — see LICENSE file for details.


🎓 Learn With the Live Course

This repo is part of the TestJeff API Testing Course on Udemy.
Follow along with hands-on lessons, module guides, and real automation projects:

  • 🚀 Join the Course on Udemy
  • 🧑‍💻 Get step-by-step guidance while working directly with this repo.
  • 📂 Build a portfolio-ready test automation project.

🌐 Join the Test Automation Community of Practice (CoP)

Be part of the growing Test Automation Community of Practice (CoP) — a place to connect, learn, and share with other testers and automation engineers:

  • 🌐 Join the Community on Skool
  • 🤝 Network with software testers and automation professionals.
  • 📚 Access bonus resources, discussions, and live Q&A sessions.
  • 🚀 Stay ahead with the latest in AI-powered test automation.