I’ve been writing unit tests in strongly typed languages and I have a fair good understanding about it. When writing unit tests in JavaScript to verify if certain functions are working properly in certain browsers I am back to the manual testing. I have no understanding of how it works. Because JavaScript is meant to close the gap between data and presentation and make it more interactive. And everything is happening within browsers and it's more to do with UI. So I am assuming that if I were going to write a unit test I would write something like (in pseudo code):
run function A
check DOM if certain element has been created
if not then fail
check if element is visible
if not then fail
check for the content of that element
if null then fail
etc…
Writing these tests seem like “hard coding” to me and what’s missing is that the tests wouldn’t be able to tell if it’s been rendered properly, it's only doing the pure functional tests. So I am wondering if someone can explain to me what are the proper test procedures in JavaScript, how to do build automations and some general concepts in doing it. I was just looking at John Resig's project testswarm but yet to figure out what it’s about. I am also reading about QUnit at the moment.
I am looking for some introductory materials on the concepts/practices that can me started. I am not looking for specific libraries or tools unless they have good introduction on the concepts.
Thanks.