I am looking for a mature framework that can do Javascript mocking, especially on AJAX and JSON area.
Is there any existing mocking framework for Javascript ( and/ or JQuery) that you are used and can recommend?
Edit: I have evaluated jqmock and jqunit. It seems that it's the only framework that can do basic library mocking and stubbing, but it can't do AJAX call.
Here are some links that might help you:
amok (claims to have ajax support)
fakequery
QUnit
JSMock
qMock
jqunit + jqmock
Other javascript testing "frameworks"
jqunit
Jack
YUI Test
JSSpec
I prefer modular code. Modular code is easy to mock!
var function fetchAjaxData(){
// Perform ajax request.
// Call 'update' with the data in question.
}
var update = function(ajaxData){
// do things with ajaxData
}
With this kind of code, all you need to do is to call the 'update' function to mock a ajax request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With