44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
|
|
#ifndef AISE_TESTING_HPP
|
|||
|
|
#define AISE_TESTING_HPP
|
|||
|
|
|
|||
|
|
#include "aise/types.hpp"
|
|||
|
|
#include <vector>
|
|||
|
|
#include <string>
|
|||
|
|
|
|||
|
|
namespace aise {
|
|||
|
|
|
|||
|
|
// ── 测试自动化与验证(SRS-AISE_F-003) ──
|
|||
|
|
class TestingModule {
|
|||
|
|
public:
|
|||
|
|
TestingModule();
|
|||
|
|
|
|||
|
|
// 根据需求生成测试用例集
|
|||
|
|
std::vector<TestCase> generateTestCases(const std::string& req_id,
|
|||
|
|
const std::string& code_snapshot);
|
|||
|
|
|
|||
|
|
// 执行测试并生成覆盖率报告
|
|||
|
|
struct TestRunResult {
|
|||
|
|
bool all_passed;
|
|||
|
|
uint32_t total;
|
|||
|
|
uint32_t passed;
|
|||
|
|
uint32_t failed;
|
|||
|
|
std::vector<CoverageReport> coverage;
|
|||
|
|
std::string log_summary;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
TestRunResult execute(const std::vector<TestCase>& cases,
|
|||
|
|
const std::string& executable_path);
|
|||
|
|
|
|||
|
|
// 需求覆盖率统计
|
|||
|
|
double computeReqCoverage(const std::vector<RequirementItem>& reqs,
|
|||
|
|
const std::vector<TestCase>& cases) const;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
// 模拟静态分析:提取路径
|
|||
|
|
std::vector<std::string> extractPaths(const std::string& code);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} // namespace aise
|
|||
|
|
|
|||
|
|
#endif // AISE_TESTING_HPP
|