"...some of the tests will fails in browsers other than Firefox..."
One of the appealing parts of jsUnit is that I can run tests in
Firefox, Safari and IE, verifying that things behave pretty much as I
expect. What are others doing for tests?
Thx
We're currently working on expanding and streamlining the unit testing
framework used in Prototype, and it does some tricks already, like
automatic testing in all installed browsers.
You may want to check out:
http://prototypejs.org/contribute (scroll down to "the importance of
testing").
Plus my presentation on the framework:
http://mir.aculo.us/2006/9/16/adventures-in-javascript-testing
Best,
Thomas
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>JavaScript unit test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="assets/prototype.js" type="text/javascript"></script>
<script src="assets/unittest.js" type="text/javascript"></script>
<script src="../../public/javascripts/application.js" type="text/
javascript"></script>
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
</head>
<body>
<div id="content">
<div id="header">
<h1>JavaScript unit test file</h1>
<p>
This file tests <strong>tag.js</strong>.
</p>
</div>
<!-- Log output -->
<div id="testlog"> </div>
</div>
<script type="text/javascript">
// <![CDATA[
new Test.Unit.Runner({
setup: function() {
},
teardown: function() {
},
testEnclosingTag: function() { with(this) {
assertEqual(new Tag('b', 'this is a test'), '[b]this is a test
[/b]');
}}
}, "testlog");
Test.context('Tag class testing', {
'should create a simple tag': function(){
// Should I be extending Tag with Test.BDDMethods here?
// Where do setup (before) and teardown (after) blocks go?
tag = new Tag('b', 'this is a test');
tag.shouldEqual('[b]');
}
});
// ]]>
</script>
</body>
</html>
- Does the BDD stuff go inside the Test.Unit.Runner arguments, as
normal test cases do?
- Is there something analogous to before/after blocks in rSpec (I
know there is setup and teardown ... just wondered if there was more)?
- Do you have a spec that you'd like to put someplace public so I can
answer my own questions :-)
Thanks,
Steve
On Nov 21, 2007, at 12:14 PM, Thomas Fuchs wrote: