Tests all test functions in the specified path. @param ctx database context @param root path to test modules @param job calling job @return resulting value @throws IOException I/O exception
(final IOFile root, final Context ctx, final Job job)
| 36 | * @throws IOException I/O exception |
| 37 | */ |
| 38 | public FNode test(final IOFile root, final Context ctx, final Job job) throws IOException { |
| 39 | final ArrayList<IOFile> files = new ArrayList<>(); |
| 40 | |
| 41 | final Performance perf = new Performance(); |
| 42 | final FBuilder suites = FElem.build(Q_TESTSUITES); |
| 43 | if(root.isDir()) { |
| 44 | for(final String path : root.descendants()) { |
| 45 | final IOFile file = new IOFile(root, path); |
| 46 | if(file.hasSuffix(IO.XQSUFFIXES)) files.add(file); |
| 47 | } |
| 48 | } else { |
| 49 | files.add(root); |
| 50 | } |
| 51 | |
| 52 | for(final IOFile file : files) { |
| 53 | final Unit unit = new Unit(file, ctx, job); |
| 54 | unit.test(suites); |
| 55 | errors += unit.errors; |
| 56 | failures += unit.failures; |
| 57 | skipped += unit.skipped; |
| 58 | tests += unit.tests; |
| 59 | } |
| 60 | return suites.attr(Q_TIME, Unit.time(perf)).finish(); |
| 61 | } |
| 62 | } |