Is it possible to split the tests into setup, run test, and teardown?
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.9k
- Forks
- 359
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I am using this basic code to run some test on various sorting algorithms in the same file:
Here is the driver code:
```
var reporter = require('nodeunit').reporters.default;
reporter.run(['tests/sortingTests.js']);
```
This works good so far for my testing needs. But now I am interested in using [benchmark.js](https://github.com/bestiejs/benchmark.js) to benchmark each of those sorting algorithms.
I want to reuse the testing code for the purpose of Benchmarking to reduce redundancy.
Benchmark provides helpful setup and teardown functions in its API. That is important because we don't want to measure the time taken during setup and tear down.
All I want is that in Benchmark's setup function, I should be able to instruct node-unit to run the setup.
And then in measurement function, I tell node-unit to separately run only the test.
And later in Benchmark's teardown function, I should be able to call node-unit's teardown.
And repeat above 3 steps for every test in that same file.
Any ideas how should I go about it?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit dem Treibercode unter Verwendung von nodeunit's default reporter und tests/sortingTests.js. Überprüfe anschließend nodeunit's Einstiegspunkte für die Testausführung und den Lebenszyklus zusammen mit der Setup-, Mess- und Teardown-API von benchmark.js. Ermittle, ob die drei Phasen für jeden Test unabhängig aufgerufen werden können, und dokumentiere oder definiere das erwartete Integrationsverhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- testing
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100