简体   繁体   中英

Qunit Test in Javascript

I am using Qunit and I am newly Qunit to test my internal javascript functions, I want to use it also for some user interactions like testing error message after Jquery validations. Since I dont use HTML pages (I should test them on gsp, which requires a working runtime.) I dont know how to test them. Is it possible to test them on a given host name(like Selenium-tests)?

Is it really necessary to test your interactions against a real host? You could always use mocks and test only if your error messages are being called properly, without actually contacting any external elements. That's the whole point of unit testing, after all. I personally use SinonJS for that kind of thing. You could also check for other mocking frameworks if you like (eg JsMockito ).

For more information about mocks and stubs, I'd recommend you to read this article and do a little research about it on Google's testing blog .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM