Must JsUnit Cases Reside Under the Same Directory as JsUnit?
Posted
by chernevik
on Stack Overflow
See other posts from Stack Overflow
or by chernevik
Published on 2010-03-13T18:35:36Z
Indexed on
2010/03/24
16:53 UTC
Read the original article
Hit count: 149
JavaScript
|jsunit
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>
© Stack Overflow or respective owner