https://github.com/jacoblincool/testcase-run
Testcase Runner
https://github.com/jacoblincool/testcase-run
testcase testcase-runner
Last synced: 10 months ago
JSON representation
Testcase Runner
- Host: GitHub
- URL: https://github.com/jacoblincool/testcase-run
- Owner: JacobLinCool
- License: mit
- Created: 2021-10-29T17:02:03.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T17:54:52.000Z (about 2 years ago)
- Last Synced: 2025-02-25T02:18:50.766Z (11 months ago)
- Topics: testcase, testcase-runner
- Language: JavaScript
- Homepage: https://jacoblincool.github.io/testcase-run/
- Size: 190 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Testcase Runner
Run testcases generated by [**testcase-gen**](https://github.com/JacobLinCool/testcase-gen) and collect stdout and execution time of your code.
[](https://www.npmjs.com/package/testcase-run)
## Something You Should Know
This tool comes with [**testcase-gen**](https://github.com/JacobLinCool/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
```bash
npm i testcase-run
```
### 2. Run your code
```javascript
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
```bash
npm i -g testcase-run
```
### Use CLI
```bash
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.
```