qunit Questions
5
I have two questions:
Can you have parameterised unit tests in qunit?
How do you do mocking with qunit e.g. mocking a getJSON call?
Thanks
Ferment asked 6/2, 2009 at 22:16
1
Solved
I'm just starting to use QUnit and having issues.
I'm currently using TypeScript, which is a JavaScript compiler. I have my Tests in classes which parallel the structure of my main classes.
In ea...
Brainwash asked 23/10, 2012 at 22:14
2
Solved
As seen in this jsFiddle, I have a function 'init' that configures a button so that when clicked it opens a progress dialog and issues an Ajax call. I want to unit test this JavaScript code (using ...
Scotfree asked 22/8, 2012 at 14:4
3
What is the equivalent of nUnits [SetUp] attribute for qUnit?
Fulllength asked 5/11, 2009 at 20:36
1
Solved
I'm trying to validate image URLs with Qunit by setting the URL as the src attribute of a test image and checking with the error event handler whether that went well. So far what I have is:
test('...
Rea asked 2/8, 2012 at 11:20
2
Solved
Is it possible to have teardown methods that run after every test in qUnit? If not, are there any plugins around that will do this?
Naseberry asked 8/1, 2010 at 14:53
1
Solved
The info on this page seems less-than-forth-coming -- https://github.com/kof/node-qunit. I've got a setup where I installed nodejs and installed the node-quit module. I have test runner and execute...
Winnipegosis asked 28/6, 2012 at 0:24
2
Solved
Background:
I'm coming from Java background so not too familiar with Javascript.
We are planning to introduce JavaScript unit testing to both our existing (legacy) code and future work. We are a...
Jardena asked 18/6, 2012 at 11:21
1
Solved
In the following unit test code:
TestModel = Backbone.Model.extend({
defaults: {
'selection': null
},
initialize: function() {
this.on('change:selection', this.doSomething);
},
doSomething:...
Jotting asked 2/6, 2012 at 19:39
2
Solved
I am new to Qunit and unit testing.
I am trying to figure out what and how to test the following function. It does not do much at the moment but I wanted to assert that if I pass it incorrect valu...
Willettawillette asked 17/4, 2012 at 11:31
2
I've used qunit to write a series of tests for javascript code I have. Right now for some reason, the first test in my list will run, and then the LAST test in the list runs, followed by the 2nd to...
Queen asked 27/3, 2012 at 6:23
2
Solved
I'm testing some JavaScript with qUnit. In one object I pass a DOM element, and some methods will change some properties of the element.
How can I mock a DOM object in qUnit?
I'd like to use a so...
Nuri asked 1/10, 2011 at 14:55
1
I am attempting to get a set of asynchronous QUnit tests to run from an Ant build script, using PhantomJS. What I have seems to be working, but it seems like there should be a nicer way to achieve ...
Claussen asked 28/2, 2012 at 9:21
1
Solved
I'm writing specs for different test cases for Jasmine and QUnit to compare them and they looked the same before I needed to write a test to check if an event is binded to an element.
Event bindin...
Mise asked 15/1, 2012 at 12:48
4
Solved
I do version control with Git, and unit testing with QUnit. Sometimes I find a bug in my software that was not present in a past version. It's easy for me to write a unit test specifically for that...
Incalculable asked 19/12, 2011 at 15:31
1
Solved
I have the following set up in QUnit:
/* Dozen or so previous tests here */
test("Test some markup generation", function () {
$('#qunit-fixture').plugin(); // jQuery plugin: Generates a table
...
Inquisitive asked 5/12, 2011 at 23:17
2
Solved
I have an ASP.NET MVC web application running from http://localhost/myappname. From jQuery, I make jQuery $.ajax() calls to return partial views based on some user action. I usually call this from ...
Predation asked 10/10, 2011 at 13:55
1
Solved
The Facebook JS SDK has the equivalent of jQuery's trigger() function, FB.Event.fire
that allows you to trigger the handlers you attach for particular events. Its helpful for my unit tests in QUnit...
Essex asked 8/9, 2011 at 14:45
2
As I see many times, a self-executing anonymous function is used to contain entire libraries. How can these libraries be tested, if e.g. QUnit cannot access anything inside the anonymous function w...
Richly asked 17/8, 2011 at 12:17
1
Solved
What are the main differences between these two testing frameworks?
I am a totally new to Test Driven Development and starting from the very beginning.
Fula asked 12/8, 2011 at 23:34
2
Solved
In Javascript polluting the global namespace is generally regarded as a bad thing. This is why Coffeescript wraps all of your Javascript in a (function() {}).call(this); wrapper.
However, I've beg...
Dela asked 24/6, 2011 at 23:23
1
Solved
I'm just starting using Qunit and would like to know whether is there a way to capture/verify/omit alerts, For example:
function to_test() {
alert("I'm displaying an alert");
return 42;
}
and...
Foxtrot asked 7/7, 2011 at 9:10
14
Solved
My main JavaScript framework is jQuery, so I would like my unit test and mocking frameworks to be compatible with that. I'd rather not have to introduce another JavaScript framework.
I am cur...
Markos asked 16/10, 2008 at 16:56
1
Solved
So QUnit provides the "raise" assertion to test if an exception is thrown. Is there any way to test the actual message thrown by the exception, though? For instance, say I have this function:
thro...
Gentry asked 6/5, 2011 at 17:11
1
Solved
Does anyone know if there exists a test suite (written in QUnit, for example) that tests for ECMAScript 5 support?
Asphyxiant asked 9/4, 2011 at 13:40
© 2022 - 2024 — McMap. All rights reserved.