TracksGuided Small Projects With AI AssistanceProject One: CLI ScriptTesting and Completing the Project(9 of 9)

Testing and Completing the Project

Your code might look complete, but until you've tested it thoroughly, you don't know if it actually works. Testing reveals bugs, edge cases, and usability issues that aren't obvious from reading code.

Testing the Happy Path

Start with normal usage — what happens when everything goes right?

Verify each feature works as documented.

Testing Error Paths

Now deliberately break things:

Test with invalid symbols, missing API keys (temporarily rename your .env file), and disconnected network (turn off Wi-Fi briefly).

Your Testing Checklist

Work through these scenarios:

  • Single valid symbol returns correct data
  • Multiple valid symbols all return data
  • Invalid symbol shows helpful error message
  • Missing API key shows clear instructions
  • All output formats (text, json, csv) work correctly
  • File output creates the file with correct content
  • Help flag shows useful documentation

Cleaning Up Your Code

Before sharing, tidy up:

Remove debug code: Delete any print() statements you added while developing.

Add comments: Explain non-obvious logic. Future you will thank present you.

Consistent formatting: Use a tool like black to format your Python code consistently.

Writing Your README

A README tells others what your project does and how to use it:

# Stock Price Fetcher

Fetch current stock prices from the command line.

## Installation

1. Clone this repository
2. Create virtual environment: `python -m venv venv`
3. Activate it: `source venv/bin/activate`
4. Install dependencies: `pip install -r requirements.txt`
5. Copy `.env.example` to `.env` and add your API key

## Usage

python stocks.py AAPL GOOGL --format json

Include installation steps, usage examples, and any configuration needed.

See More

Last updated December 13, 2025

You need to be signed in to leave a comment and join the discussion