caolan / caolan/nodeunit

Is it possible to split the tests into setup, run test, and teardown?

Aperta
#315 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
1.9k
Fork
359
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con il codice del driver usando nodeunit's default reporter e tests/sortingTests.js, quindi esamina gli entry point dell'esecuzione dei test e del ciclo di vita di nodeunit insieme all'API di setup, misurazione e teardown di benchmark.js. Determina se le tre fasi possono essere invocate indipendentemente per ogni test e documenta o definisci il comportamento di integrazione previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, node.js
Ambito
testing
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.