HACKER Q&A
📣 fedeb95

Why reusing e2e tests output is bad?


I understand that the consensus is that each test should be independent in order to avoid side effects affecting other tests, but consider the following scenario.

I have n features f_1, ..., f_n. Each of them requires other features (a subset of them) to be executed in order to test the ith f_i. For each feature there is an end to end test t_i, which executes the corresponding feature and its dependencies and then makes some assertions on the feature under test.

Argument: the all set of test executions is a boolean expression t_1 AND ... AND t_n. So, for each t_i, we can describe it as f_i AND f_j AND ... for each dependency f_j of feature f_i, because if a dependency fails, the all test fails (it can't arrive to evaluating its assertions).

So the whole test execution could be represented as a BDD (https://en.wikipedia.org/wiki/Binary_decision_diagram) and reduced. Basically when I make a test, i reuse the output of a previous test which encompasses all the dependencies of the feature under test, for which assertions have already passed. Of course this means tests should have a precise scheduling order.

What's wrong with my idea? Thanks for the dedicated time.


  👤 austin-cheney Accepted Answer ✓
I use end to end testing my node application. The interface is in the browser so for me testing must mean doing what the user can in the browser. That also means progressively altering the interface one test at a time.

You can try out how I do it if your are interested. The application is at:

https://github.com/prettydiff/share-file-systems

The test command is:

    share test_browser