nose-devs/nose — pull request #738 by adiroiban (2013-10-15 12:58:41+00:00)
Title: Continous run tests.

Problem description
===================

This is an experimental usage of nose test runner.

Karma Test Runner from JS has a nice feature which allows continuously running the tests.
The idea is that you run tests in a loop and test runner waits for changes in the test files, reload them and re-run the tests.

I have a Python backed project, but it has a web fronted which is implemented in JS and for which we run Selenium tests.

Starting and stopping selenium is slow, and starting browsers is also slow, so we tried to keep selenium running together with a browser instance.

I know that sharing fixtures is a bad think, but when creating a fixtures takes 5 seconds you don't have other options (ex starting Chrome or IE browser in Selenium)

This is only a prototype to experiment with the idea of continuous tests.

This does not work for Python Code TDD since only tests are reloaded, but it works for testing the JS code since the browser will reload the JS code.

Changes description
===================

All tests are run in a loop which can be interrupted by CTRL+C.

There is a NOSE shared variable which informs tests the current state of

At exit the teardown is called one more time so that you can clean the test fixtures that you want to persist durring the loop.

It waits 1 seconds and then check if tests files were modified, reload all tests and rerun them.

The wait is stupid and reload only tests files as a proof of concept.

There is a simple Plugin which is used to add the `--with-loop` configuration option.

How to try and test the changes
===============================

Enable LoopPlugin and run tests with `--with-loop`.

Change a test file and wait for test runner to automatically re-run it.

Let me know if you find this feature useful and are interested in changing nose to support it.

It does not require to be included in upstream node and the only required change is to move the following lines in a separate method

```
result = self.testRunner.run(self.test)
self.success = result.wasSuccessful()
```

In this way, the TestProgram can be extend and implement various running strategies.

Thanks!