QUnit and Automated Testing
Just wondering...Has anyone setup or have any ideas on an ideal usage of QUnit with automated testing tools? Currently at my company we are using Hudson as our build server. We would like to: 1. Automatically startup a browser and run QUnit tests 2. Save the QUnit tests to an easily parsable file format (JUnit xml seems to be the standard) Once that is done, it should be trivial to report the results in the CI server. Currently we're doing this by firing up Selenium and then loading the page with
selenium and dialog
Hello everybody, I'm working on the test writinh with selenium. On my window I have a jquery dilaog and I want to simulate a click on a button from my dialog. Is it possible? or maybe can I put an id on the button of dialog jquery? Thanks in advance for your answer J
Async setup and teardown
Guys, I've had to run some async code on my setup and teardown methods but it was not working properly. Here's a simple patch to make it run and the corresponding test cases: http://github.com/fgrehm/qunit/compare/2dbf6037778266fa01a1...master What do you guys think, is this really needed? Cheers, Fábio Rehm
After my test passes do I relocate the successful code?
0 down vote favorite I'm developing a Javascript app with Wordpad [forced to]. When my test passes within the browser that houses qunit code, do I move the successful code to an alternate location?
Qunit for testing authenticated rest api calls
Hi, I am unable to hit rest api when using $ajax function in jquery through qunit. All my rest calls have to maintain a jsessionid which gets created in the browser cookie when a login post call with parameters username and password is done. I was able to do the same using restassured as it allows to get the jsession id and maintain it while doing any more further api calls. Is there a possible way of doing it through qunit ?
jQuery on HbbTV devices / qUnit test suite with XML
Hello jQuery people! on my company we're developing HbbTV apps for TV sets. This is an open standard described here http://hbbtv.org/. The standard requires that the pages are deviered by the webserver with the content-type: application/xhtml+xml - more exactly application/vnd.hbbtv.xhtml+xml and when we use this content type the browser switches to a strict XML checking which causes a lot of problmes with jQuery on this devices. Now I want to run jQuerys tests in XML mode. In the test folder there
Memory Leak In QUnit.equiv
During our analysis on our qunit test suite, we found an issue originated from QUnit.equiv(). We use Chrome dev tool memory tab to take snapshot of the memory, and we found that the global queue "pairs" still holds references to the objects (and their sub-objects) we passed into QUnit.equiv(). When the objects to be compared are big, the leak is big as well. We currently workaround this issue by invoking QUnit.equiv() again with two empty strings, that will replace the global queue with the two empty
Populate Drop Down List using jquery mobile from textbox
I have a textbox whose id is other and I want to populate this textbox value into drop down list This is javascript I am using to populate... but this is not working.. Any suggestion will be appreciated...!! I want to do like this:- http://viralpatel.net/blogs/demo/dynamic-combobox-listbox-dropdown-in-javascript.html <SCRIPT language="javascript"> function addCombo() { var textb = $('#other').attr('id'); var combo = $('#category').attr('id'); alert(combo); var
Module names and test names prevent QUnit operating
Hi, I've just started working with QUnit this morning and I'm getting some unexplainable behaviour. Calling a module anything other than "QUnit Test" and a test anything other than "Sample test" will prevent the tests from running at all. This works (in Safari 4 and Firefox 3.6): var domReady = function(f) {document.addEventListener("DOMContentLoaded", f, false);}; domReady(function(){ module("QUnit Test"); test("Sample test", function() { expect(1);
Is fireunit still active?
Just a quick question, is fireunit still active? I don't see much chatter on it in the last year, I wanted to know before I lost too many cycles trying to get it working.
How to test a form submit in QUnit
I would need to test the a form submit but cannot see on how to do this in QUnit. Because a new page will be loaded it most likely involves the use of an "iframe" but I cannot really see on how to do this and any help or example would be very much appreciated. A typical use case would be a submit of a form that will be processed in the backend and returns a new page and the content of the page must be checked against the original form content. Please also note that I'm aware that this can be quite
QUnit creating tests is not that simple.
A couple of times I've tried to use QUnit for test support. But my experience is that I'm more busy debugging and trying to fix my QUnit test scripts, than developing functions. It goes well when using QUnit for testing plain JavaScript libraries, like function X returns something. But when DOM is involved, or ASync then it's getting fuzzier. My current problem, without going into details, is that my last test call, is executed as first. Partly because my code is depending on Asynchronous Callbacks.
line break in message?
Is it possible to have line break in messages? If it is not supported, isn't it nice to add it in case some users need more customized messages.
How to call blur event from JS file while writing Qunit test case
I have custom search.JS file and contents in JS file as below: $(document).ready(function () { $("#number_c").blur(function(){ toggle($("#number_c"),[$("#number_a"),$("#number_b")]); }); function toggle(input1, inputs) { if (input1.val() != '' ) { for (var i = 0; i < inputs.length; i++ ) { input = inputs[i]; input.val(''); input.prop("disabled",true); } } else { for (var i = 0; i < inputs.length; i++ ) { input = inputs[i]; input.removeAttr("disabled"); } } } }); I need to write Qunit test case
Qunit test cases for javascript logging
I am working on javascript client logging.I have function in JavaScript called WriteLog,which basically post a message/Exception to specified server URL through Ajax post and also writes a message/exception to console.log,console.error and console.warn(if available) based on type(error,warn,info passed to WriteLog function). I am looking for reference how to write qunit testing cases for WriteLog function( to check a ajax request has been made to a server and cross verify a message written to console.log)
Append DOM objects to qunit-fixture + Qunit
<div> <form action="/" id="Form1" method="post"> <div> <input data-val="true" data-val-fileextensions="The DocumentFileName field only accepts files with the following extensions: doc,docx,txt,rtf,pdf" data- val-fileextensions-fileextensions="doc,docx,txt,rtf,pdf" id="Text1" name="FileExtensiondTest.fileExtensionInValid.DocumentFileName" type="text" value="test.ppt" /> </div> </form> </div> I would to add above DOM object to qunit-fixture and access DOM object attributes in Test cases such as below:
QUnits for JS directly accessing UI components
Hi, I am trying to add Qunit tests for our MVVM based UI application. I planned to have separate tests.html which will have Qunit test fixtures and acts as test report page. So I am focusing on testing the view models (JS files) of the application. But I have some parts of js files expecting the actual UI components to be present, especially jquery selector calls such as $('#xyz'). How can I test this code, can you please guide me. The reason I didn't put qunit DIV in main application index.html
How to setup Qunit testing with webpack?
Hi, I could not see any document specific to setting up Qunit testing with Webpack. Could you please share necessary detail to setup Qunit with webpack? Thanks
Question regarding the define in QUnit
Hi, We have observed that with new QUnit upgrade our tests have been failing with multipleDefine errors. After investigating the cause, it looks like in AMD there are problems when multiple script tags are doing define. And we hit the issue since both our runner.js and QUnit do define that are pulled with script tags. if ( typeof define === "function" && define.amd ) { define( function() { return QUnit; } ); QUnit.config.autostart = false; } Is there a reason to do define in QUnit?
QUnit inconsistency/alternately fails tests
I have a simplified QUnit test which consists of 2 simple tests that fails randomly/alternately for no good reason (They are both atomic, meaning that one test doesn't change anything of the other element) Please see this jsFiddle try to run multiple times module("Basic actionBind"); //two simple tests test("action1", function() { ok(ele2.trigger("click").hasClass("clicked"), "basic click action"); }); test("action2", function() { ok(ele1.click().hasClass("clicked"), "basic click action"); }); http://stackoverflow.com/questions/16444561/qunit-inconsistency-alternately-fails-tests
How can I compare two HTML strings, disregarding the order of attributes
I have got a test that parses XML and appends an element to another on a page. How can I compare this actual element to an expected string or object, so that the order of attributes does not matter to prevent false positives because of differences caused by cross browser processing Tom
How to measure DOM size?
Hi all, I regularly keep an eye on the size of my DOM using $(*).length however it is not as accurate as I would like it to be. Is there another method I can use? I want to, in effect, count every character that exists within my HTML document (dynamically created from the client or served from the server). Why? When I use jquery ui it dynamically adds/removes to the document weight. When writing an application that requires few page reloads, I am afraid of legacy data stacking up. It is true that
QUnit test runner output via Karma process?
I currently have two runners for my tests, which means maintaining two, and I'd like to meld them into one process. I have the standard QUnit html runner page, and I have Karma running tests through PhantomJS. Is it possible, from Karma, to pipe and output test results through the QUnit html runner page? What I'm ultimately after is the reporting and granularity of the QUnit runner page, but having that sourced and output via Karma, rather than having to maintain the QUnit runner page as a separate
phonegap application containing SQLite database testing by qunit
hii, I am new to Qunit. I want to test PhoneGap application containig SQLite database coding by Qunit.Can anyone give me suggestion,How I can do that? //This is javascript code:- window.addEventListener('load', function(){ // Wait for PhoneGap to load document.addEventListener("deviceready", onDeviceReady, false); }, false); // PhoneGap is ready function onDeviceReady() { var db = window.openDatabase("Database2", "1.0", "DigitalNoiz", 200000);
Err "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"
Hi, In the file myTests.js I have the code below: test('assertions', function() { equals( 1, 1, 'one equals one'); }) when I run it I got the err "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal " instead if I run : test('assertions', function() { ok( 1 == 1, 'one equals one'); }) everything are ok. what shell I do to fox this problem err ? Thanks
asynchronous tests sometimes call start() after timeout
Imagine a test script with two tests that looks like this: test("some test description", function(){ stop(3000); // set test timeout at 3 seconds async_call(parameter, function(){ ok(true, "This assertion passes"); start(); }); }); test("some other test description", function(){ ok(true, "another assertion that returns true"); }); If the first test times out during async_call but it comes back later, its assertion (ok) gets run during the second test ("some other test description").
Qunit totorials
Does anyone know of a decent Video (or not) tutorial on using Qunit? I've found a lot of videos that are more lectures than "How to's". Perhaps someone has a video series or such. Thanks in advance!
QUnit Module Setup and Teardown
For the QUnit callback functions for setup and teardown: Does setup get called before each test function? Does teardown get called after each test? From what I can see in my own tests it seems like setup gets called ONCE per module and teardown gets called once PER TEST. Just wondering if this assumption is correct or not. Thanks!
integrating JQuery Qunit with ASP.net MVC 4.0
Hi, I m new in Jquery Qunit. Could you please help me in Integrating with ASP.net MVC 4. 0 I have an application build in ASP.net. for that i want to automate Unit testing. Could you please explain me with an example. Application contains numeric and many more validation. Thanks in Advance, Gauri Rane
Simulating keypress events?
I know that I can use jQueryObj.trigger('keypress') to simulate a key press event, but how can I populate the keypress event attributes? I am testing an autocomplete plugin which of course requires simulating keystrokes.
why mouseover and mouseout event does not work in qunit?
s("a.flyoutlink:eq(0)").mouseover(function(){ //this is not working???? s("span.contexthelpcontent").exists function(){ ok(true,"floater exists"); }) })
Why this fails? equal($("<h1/>"), $("<h1/>"))
Or even equal($("<h1/>")[0], $("<h1/>")[0]) http://jsfiddle.net/kdEtk/24/ Thanks
test click with QUnit
i want to test this js code with Qunit but i can't find solution for the following error : Object expected Source: file :/ / / C :/ / / / video.js:..... 5 Which corresponds to line 5 of my code below 1- function clickCamSel() { 2- if (player_state == 3) 3- { .. ......... 4- } } 5- $("#t_vid_type_live").click(clickCamSel);
How to unit test extjs application using qunit ?
please can any one suggest me some tutorials or reference links for qunit for extjs
Stripping QUnit tests for deployment?
I have QUnit tests running in my project and it's great - except I don't want to have to manually comment them out every time I deploy my code (or have the extra bits go over the wire). Is there an easy solution for this? Perhaps this is provided as a feature of a minifier. Does anyone have a good solution for getting the benefits of Unit testing in Javascript without having to take additional steps to remove the tests from the actual customer facing code? Thanks! Nathan
QUnit.config.collapse, small bug?
I find that QUnit.config.collapse does not work exactly as documented. When 'false' all failed tests collapse. When 'true', the first failed test is not collapsed. v. 1.20.0 This is the statement at the top of my js testing unit: QUnit.config.collapse = true;
Changing rerun url
I was wondering if there is a parameter or setting I can set that will change the URL that is fired when the "rerun" link is clicked on one of my tests. My current application is built in Require.js and and Backbone.js, so right now when I click on the rerun link, it navigates me back to my home page. I was just hoping that there is a way to modify where the rerun link points, rather than have to start managing a new set of URL paths in my router. Thanks!
global failure when running qunit simple test in container
i am running a real simple qunit test, the one you see from web site. it runs fine in browser. But when I deploy to a container such as jetty, and then visit the page, I am getting 1 success and another error: global failure (1, 0, 1) script error, source : 0 what may be the problem? i am using qunit 1.11 Thx! Yan <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>QUnit basic example</title> <link rel="stylesheet" href="/resources/qunit.css"> </head> <body> <div id="qunit"></div> <div
Inexplicably failing tests when run in a full suite: what can I do?
I currently have 40 tests with approximately 200 assertions running. When all of them are run, the same two are almost always failing. Run individually, or with about half of all the available tests, they pass. The total running time is typically 8-10 seconds. If I run *all* the tests with the developer console open (set up so that the browser cache is not used), the same two tests *always* fail - the total running time is closer to 30 seconds). Almost all of these tests involve the following
Assert equals between two identical objects does not display the given result
Hi, Why this assertion does not pass, and why it does not output the result? http://jsbin.com/niteyupojo/2/edit?html,output Thanks!
Next Page