Must JsUnit Cases Reside Under the Same Directory as JsUnit?
- by chernevik
I have installed JsUnit and a test case as follows:
/home/chernevik/Programming/JavaScript/jsunit
/home/chernevik/Programming/JavaScript/jsunit/testRunner.html
/home/chernevik/Programming/JavaScript/jsunit/myTests/lineTestAbs.html
/home/chernevik/Programming/JavaScript/lineTestAbs.html
When I open the test runner in a browser as a file, and test lineTestAbs.html from the jsunit/myTests directory, it passes. When I test the same file from the JavaScript directory, the test runner times out, asking if the file exists or is a test page.
Questions:
Am I doing something wrong here, or is this the expected behavior?
Is it possible to put test cases in a different directory structure, and if so what is the proper path reference to to JsUnitCore.js?
Would JsUnit behave differently if the files were retrieved from an HTTP server?
<html>
<head>
<title>Test Page line(m, x, b)</title>
<script language="JavaScript" src="/home/chernevik/Programming/JavaScript/jsunit/app/jsUnitCore.js"></script>
<script language="JavaScript">
function line(m, x, b) {
return m*x + b;
}
function testCalculationIsValid() {
assertEquals("zero intercept", 10, line(5, 2, 0));
assertEquals("zero slope", 5, line(0, 2, 5));
assertEquals("at x = 10", 25, line(2, 10, 5));
}
</script>
</head>
<body>
This pages tests line(m, x, b).
</body>
</html>