Skip to content

JunKai-v/manual-cli-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI Tests Automation

⚠️ Demo / Beta — A learning project exploring Python GUI development and automation. Testing the waters!

A Python desktop app that automates CLI test execution. It opens a real cmd.exe window and uses pyautogui to type commands character-by-character — simulating a human typing into the terminal.

CLI Tests Automation

How It Works

  1. On startup, the app scans the test_cases/ folder for .py files
  2. Each file's first comment line (# Title) becomes the checkbox label
  3. Select test cases, set your options, and click ▶ Start Run
  4. A cmd.exe window opens and commands are typed automatically via pyautogui
  5. The Console Log shows real-time progress of each test case
  6. Click ⬛ Abort Run to stop mid-execution (cleans up folders)

Features

  • 🎯 Visual Automation – Watch commands being typed into a real cmd.exe window
  • ☑️ Multi-select – Select All / Deselect All test cases
  • 🧹 Clean before/after – Remove generated folders automatically
  • Abort – Stop mid-run, auto-cleanup on abort
  • 📋 Console Log – Real-time execution progress
  • 🎨 Dark Theme – Catppuccin Mocha colour palette
  • 🔄 Auto-flow Layout – Checkboxes wrap to fit window width

Requirements

  • Python 3.10+
  • Windows (uses cmd.exe + pyautogui)

Quick Start

pip install pyautogui
python app.py

Adding Test Cases

Drop a .py file in the test_cases/ folder:

# My Test Case Title
# clean: output_dir
def run(engine):
    engine.cmd("dotnet new console -o output_dir", wait=4.0)
    engine.cmd("cd output_dir", wait=1.0)
    engine.cmd("dotnet build", wait=4.0)
    engine.cmd("cd ..", wait=1.0)

Header Format

Line Purpose
# Title First comment = display name in GUI
# clean: dir1, dir2 (Optional) Folders to remove on clean

Engine API

Method What it does
engine.cmd(command, wait=2.0) Types command + Enter, waits N seconds
engine.write_file(path, content) Writes a file relative to base directory

Project Structure

├── app.py           ← GUI application (run this)
├── automation.py    ← Low-level: open cmd, type characters, send commands
├── engine.py        ← Engine wrapper passed to test case run() functions
├── service.py       ← Orchestration: validation, cleanup, countdown, execution
├── test_loader.py   ← Discovers .py files in test_cases/, parses headers
└── test_cases/
    ├── case1_dotnet_info.py
    ├── case2_console_app.py
    └── case3_solution.py

Settings

Setting Description
Base directory Working directory where cmd.exe opens and commands run
Typing delay (sec) Delay between each character typed (0 = instant)
Countdown (sec) Seconds to wait before automation starts
Clean before run Remove test case folders before execution
Clean after run Remove test case folders after execution

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages