(tests)
| 21 | } |
| 22 | |
| 23 | function run(tests) { |
| 24 | /* Executes each method which name starts with "test", |
| 25 | * for each TestCase object in the given array. |
| 26 | * Throws AssertException if the method fails. |
| 27 | */ |
| 28 | for (var i=0; i < tests.length; i++) { |
| 29 | for (var method in tests[i]) { |
| 30 | if (method.substring(0,4) == "test") { |
| 31 | tests[i].setUp(); |
| 32 | try { |
| 33 | tests[i][method](); |
| 34 | } catch(e) { |
| 35 | throw e + " in " + method + "()"; |
| 36 | } |
| 37 | tests[i].tearDown(); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | } |