.netasp.net-mvcasp.net-mvc-3watinelmah

Detect ELMAH exceptions during integration (WATIN + NUNIT) tests


Here is my scenario:

Question: How can I verify that no unexpected exceptions occurred during each test run. It would also be nice to provide a link to the ELMAH detail of the exception in the NUNIT output if an exception did occur.


Solution

  • This is what my tests do:

    1. During test setup record the time
    2. Run test
    3. During test teardown browse to (elmah.axd/download) and parse the ELMAH CSV
    4. Filter out rows that don't match the user that is running the WATIN tests and rows where the UNIX time was before the recorded time in (1)
    5. If there are rows report the exception message and the error URL to NUNIT.

    Seems to work well, we have already caught a couple of bugs that wouldn't have surfaced until a human tested the app.