Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Difficult to debug problems in suite-setup.xqy test modules #61

Closed
mblakele opened this issue Nov 30, 2012 · 3 comments
Closed

Difficult to debug problems in suite-setup.xqy test modules #61

mblakele opened this issue Nov 30, 2012 · 3 comments
Assignees
Labels

Comments

@mblakele
Copy link
Contributor

The test runner code makes it too hard to debug problems in suite-setup.xqy test modules. Most errors get swallowed up by this try-catch block in test/default.xqy.

  try {
    helper:log(" - invoking suite setup"),
    xdmp:invoke(fn:concat("suites/", $suite, "/suite-setup.xqy"))
  }
  catch($ex) {if ($ex//error:code = ("SVC-FILOPN", "XDMP-TEXTNODE", "XDMP-MODNOTFOUND")) then () else helper:log($ex)},

The logging looks like a good idea, but finding a simple syntax errors requires the user to go turn on the UNIT-TEST trace event. Even that doesn't seem to be documented.

Myself I'd favor simply dropping the try-catch: if my suite-setup fails with any error at all, I want the world to stop. If I want error handling in my suite-setup, I'll code it with an internal try-catch. But I'm guessing there was some reason for this code, so I thought I'd ask before working up a patch.

Is there a use-case that I'm missing?

@ghost ghost assigned dmcassel Jan 23, 2013
@dmcassel
Copy link
Collaborator

Mike, the use case is that there may not be a suite-setup module to run, in which case the invoke will throw an exception. I agree that the current setup makes it hard to debug problems. Let me see what I can do here.

@mblakele
Copy link
Contributor Author

That makes sense. In that case I'd suggest surfacing errors that aren't related to a missing module. So the else clause simply becomes: else xdmp:rethrow().

@dmcassel
Copy link
Collaborator

Fixed in the dev branch. I updated the catches around suite-setup, suite-teardown, setup, and teardown. xdmp:rethrow() for anything other than that specific module missing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants