| 1 | /* -*- Mode: java; tab-width: 8 -*- |
| 2 | * Copyright (C) 1997, 1998 Netscape Communications Corporation, |
| 3 | * All Rights Reserved. |
| 4 | */ |
| 5 | |
| 6 | package com.netscape.javascript.qa.drivers; |
| 7 | |
| 8 | /** |
| 9 | * TestEnvironment creates the JavaScript environment in which the program in |
| 10 | * the TestFile is evaluated. It expects the test result to be a JavaScript |
| 11 | * array of JavaScript TestCase objects. TestEnvironment creates a |
| 12 | * com.netscape.javascript.qa.drivers.TestCase object for each TestCase it |
| 13 | * finds, and populates the TestCase, TestFile, and TestSuite object |
| 14 | * properties. |
| 15 | * |
| 16 | * @see com.netscape.javascript.qa.drivers.TestDriver |
| 17 | * @author [email protected] |
| 18 | * |
| 19 | */ |
| 20 | public interface TestEnvironment { |
| 21 | /** |
| 22 | * Pass the JavaScript program to the JavaScript environment. |
| 23 | */ |
| 24 | |
| 25 | public void runTest(); |
| 26 | |
| 27 | /** |
| 28 | * Create a new JavaScript context in which to evaluate a JavaScript |
| 29 | * program. |
| 30 | * |
| 31 | * @return the JavaScript context |
| 32 | * |
| 33 | */ |
| 34 | public Object createContext(); |
| 35 | |
| 36 | /** |
| 37 | * Given a filename, evaluate the file's contents as a JavaScript |
| 38 | * program. |
| 39 | * |
| 40 | * @return the return value of the JavaScript program. If the test throws |
| 41 | * a Java exception or JavaScript runtime or compilation error, return the |
| 42 | * string value of the error message. |
| 43 | */ |
| 44 | public Object executeTestFile(); |
| 45 | |
| 46 | /** |
| 47 | * Evaluate the result of the JavaScript program. Attempt to get the |
| 48 | * JavaScript Array of TestCase objects. For each TestCase object |
| 49 | * found, create a com.netscape.javascript.qa.drivers.TestCase object |
| 50 | * and populate its fields. |
| 51 | * |
| 52 | * @return true if the the result could be parsed successfully; false |
| 53 | * otherwise. |
| 54 | */ |
| 55 | |
| 56 | public boolean parseResult(); |
| 57 | |
| 58 | /** |
| 59 | * Close the context. Destroy the JavaScript environment. |
| 60 | */ |
| 61 | public void close(); |
| 62 | } |