安装与配置

  1. 安装框架
    使用 pip 安装:

    pip install testing_framework
    

    📌 提示:安装后请通过 测试框架文档 查看详细配置说明

  2. 初始化项目
    在项目根目录执行:

    testing_framework init
    

    ⚙️ 会自动生成 test_casesreports 目录结构

基础用法

  • 创建测试用例
    test_cases 目录下新建 example_test.py

    import unittest
    
    class TestExample(unittest.TestCase):
        def test_addition(self):
            self.assertEqual(1+1, 2)
    
  • 运行测试
    执行命令:

    testing_framework run
    

    📈 测试结果将保存在 reports/quick_start.html

示例代码

# test_cases/sample_test.py
def test_string_operations():
    """测试字符串处理功能"""
    assert "hello".upper() == "HELLO"
    assert "world".capitalize() == "World"
测试框架结构图

扩展阅读

📌 提示:所有测试用例会自动识别并执行,建议使用 测试框架调试模式 查看详细日志