testcase-run
v0.2.1
Published
Testcase Runner
Downloads
1
Readme
Testcase Runner
Run testcases generated by testcase-gen and collect stdout and execution time of your code.
Something You Should Know
This tool comes with testcase-gen.
It works with testcases that generated by testcase-gen.
But of course, you can use it without testcase-gen by generating same-structure testcases manually.
How to Use
1. Install
npm i testcase-run
2. Run your code
const { Runner } = require("testcase-run");
const fs = require("fs");
const path = require("path");
const testcases = fs.readFileSync(path.join(__dirname, "testcases.json"), "utf-8");
const runner = new Runner(testcases);
runner.run("D:\\sum.exe", { timeout: 10_000, core: 2 }).then((report) => {
fs.writeFileSync(path.join(__dirname, "report.json"), JSON.stringify(report, null, 2), "utf-8");
console.log(`runned ${report.reduce((acc, cur) => acc + cur.results.length, 0)} testcases`);
});
CLI Tool
Install CLI
npm i -g testcase-run
Use CLI
testcase-run --executable [executable path] --testcase [testcase path] --output [output path] --timeout [timeout] --core [core number]
--executable (-e): Executable File Path.
--testcase (-t): Testcase File Path.
--output (-o): Output (Report) File Path.
--timeout (-ti): Timeout (ms).
--core (-c): Core Number.
--version (-V) or (-v): Show version and help.