failure in Fununit because of not accessing assert inside hooks
I want to use Fununit3.4.2 with Qunit2 but because of a bug in funcunit, I am not able to use Funcunit. I have opened issue on the funcunit github page but I think the funcunit fix will require in-depth knowledge of Test object in QUnit2. The problem is with the Qunit2 adapter code in Funcunit: https://github.com/bitovi/funcunit/blob/7ec6932b44f2590f30ac98bc091bb43f8f4886ae/browser/adapters/qunit2.js#L17 In QUnit1.x the assert was associated with the global QUnit object but in QUnit2 the assert needs
qunit, circleci, and google apps script
Hi there Can anyone provide any direction on running qunit via circleci? I'm using qunit to test my google apps script. Thanks in advance!
How to unit test private function in jquery??
How to unit test private functions this is one of question asked by every one..... it would be great if some one answers
qunit 2.4.* using cli tests
Hi ## Tell us about your runtime: QUnit 2.4.0 * **What environment are you running QUnit in? browser, debian stable, (debian testing) For a shame: npm is not available in debian (for security reasons and this is good actually) but getting into it by hand is really a mess when new to node and all the great stuff) Most docs and tools i found are outdated. Can you help with a link at least how to get qunit 2.4* run on travis-ci following the basic examples on http://qunitjs.com. Thats whould be really
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
Using Qunit with Foundation 6
I'm trying to use Qunit with a Foundation 6 (latest version) project, but not sure how to do it. I tried to import it like I've done with other plugins but I get errors. I try the import like this: import QUnit from 'qunitjs'; But I get this error: Uncaught TypeError: Cannot use 'in' operator to search for 'default' in undefined Is it not possible to use it in such a project or am I just doing something wrong?
QUnit via Grunt causing… PhantomJS threw an error:ERROR >> 0 [ '' ]
I'm running QUnit tests and Instambul coverage reporting via Grunt on a new machine and getting a nasty PhantomJS error. The tests have run fine in the past. QUnit works fine in the browser. I'm using grunt-qunit-istanbul to run the tests. Perhaps a version compatibility issue? Perhaps a missing dependency that I had globally install previously? Here's the error messsage... PhantomJS threw an error:ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code null. Use --force to continue.
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 and benchmarking
I was wandering if QUnit has some sort of benchmarking of each test that is run, and, if not, can this functionality be developed into QUnit?
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
Manually choose tests for execution
I'm using qunit 2.3.3 with qunit-parameterize. I'm interested in preparing a modal dialog html at start of the suite/runner.html which is used to select the test cases for execution. Is there a way to do this or any thoughts or leads around this please Note: I have explored qunit.config.autostart(false) & start()/stop() for execution. But unable to call start() & stop() as they are not recognized as qunit functions. How to solve this ?
What is obj in the QUnit code example?
QUnit I read this web-page. It contains code example: QUnit.test( "step test", function( assert ) { obj.start = function() { assert.step('start'); }; obj.middle = function() { assert.step('middle'); }; obj.end = function() { assert.step('end'); }; return obj.process().then(function() { assert.verifySteps(['start', 'middle', 'end']); }); }); What is obj in this code example? I don't understand how to use `assert.verifySteps` method. This is my attempt: QUnit.test(
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
Adding QUnit.config properties to toolbar
It would be great to cleanly add other QUnit.config Boolean settings to the toolbar 1) Currently I delete QUnit.config.requireExpects; before using QUnit.config.urlConfig.push(); to add that option to the UI. This is based on what I see in qunit-2.3.2,js at line 2897 (QUnit.begin). 2) Adding QUnit.config.collapse to the UI causes a page reload which would be difficult to avoid. This is based on what I see in qunit-2.3.2.js at line 3132 (toolbarChanged).
JSCover - JavaScript Code Coverage
Hi, I've developed JSCover (based on JSCoverage) and was wondering if anyone from JQuery is interested in assisting in integrating it with JQuery. I'm looking at this anyway (as I'm interested in improving the quality), but help from your side would be great. I'm running the 1.8.3 branch with Mongoose, but always get 4 failures. Running through JSCover results in a few more failures (I'd like help tracking down the cause of all failures), but I think the result are still useful. To run in proxy mode
datepicker and sortable tests hang on ppc64le
Hi All, I am trying to install (from source) an run the jquery unit tes on ppc64le and am getting an issue wherin the sortable and datepicker tests are hanging. Relevant version information is as below. bash-4.2# phantomjs --version 2.1.1 bash-4.2# node --version v6.2.1 bash-4.2# npm --version 3.9.3 This is the log I see >> 6 files lint free. Running "requirejs:js" (requirejs) task Running "qunit:files" (qunit) task Testing tests/unit/accordion/accordion.html ............................................OK
Do you use QUnit Parameterize plugin?
The plugin Parameterize was made for QUnit version below 2.x and I updated it to work with version 2.x. I have tried it on my own project and yes you can develop parametric tests very well but I haven't a chance to test combinatorial or sequential functions. Do you use this plugin and is it working as expected?
Rerun Qunit test with alternate js code, ie for extended logs
Context : a parser/validator module requiring 40 atomic tests, which are run with minified code for efficiency, using grunt/uglify for minification. When one test fails, I need to use the QUnit/rerun function of that very atomic test, but with an alternate code, in order to get extensive parsing logs in the console (1000+ log lines for one of those tests). The best solution I found is to grab the 'filter' url query parameter added by Qunit on rerun to detect if we currently are in a rerun, like so
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.
Need advice about simple custom assert
I'm trying to create really simple assert to simplify calls like this(as I have a lot of them): assert.equal(typeof(externalFunction), "function", "externalFunction() must be defined"); So I've tried this: QUnit.assert.isFunction = function( testfunc, message ) { message = message || ( testfunc ? "okay" : "failed, expected argument to be function, was: " + QUnit.dump.parse( testfunc ) ); this.pushResult( { result: "function" == typeof(testfunc),
How to create independent test report?
I need to send page with QUnit report to another person, who doesn't have access to specific environment, so can't just rerun tests. But we need him to be able to filter results, collapse/extend tests and so on for analysis/review. How one can do that?
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
QUnit: Cannot read property 'onfocusout' of undefined
I'm working on an open source project, and I'm trying to bring its JS libraries up to date. I know very little about QUnit (this is the first time I've encountered it), but I'm getting an error that's over my head. I've created a jsfiddle for it here: https://jsfiddle.net/kzm57xv2/ Please let me know if you have any pointers. Thanks, Jamie
testDone should get assert message
According to the documentation, the testDone() callback does not receive the assertion message. IE: assert.ok(false, "Here is important debugging information you need to fix this test"); By experimentation, I see that there's actually an additional field, "assertions" which contains the info I need. So the documentation for that callback could use an update.
Can I use QUnit browserless with Rhino?
I've found my self having to write a library of Javascript functions for a Embedded Web UI I'm not very experience with javascript and the modern Web development environment. The function I need to write are simple utility function. independent of the browser environment. QUnit looked like a good framework to use for a unit tests. However it appears to require a browser which does not work well for automating the tests with my build process. I did discover the work by Benjamin Lee (Qunit-cli) which
How to mock one function from another .js file
Hi All, I am new to QUnits world. I am trying to mock one function from one .js file which is using one function from another .js file. Example : Services.js function foo (){ if(......) return true; else return false; } Model.js function bar (){ var result = services.foo(); if(result){ - - } else{ - - } } Now here, I am writing test cases using QUnits for function bar() and want to mock
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.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;
Wait for async call completion in QUnit.testStart() callback
Previously I used start()/ stop() to implement waiting Async callback inside QUnit.testStart() callback. Now start() is partially deprecated and stop() is deprecated. I'm wondering what is the proper way to wait for the async call completion. I tried assert.async() inside QUnit.testStart() callback but It throws error. Uncaught ReferenceError: assert is not defined And document stated that asset.async() should be used inside 'test'. So i'm wondering whether we can use asset.async() inside QUnit.testStart()
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:
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 test function select
Hi everyone! Im going to try once again :) Im working with Qunit for testing javascript functions in a web site. I did a couple of test but im not sure if im doing it right or wrong, I dont get errors but im suspecting that Im not really testing the function it self but just simulating functionalities in the test.... Can someone tell me if im right or wrong? Im so very new in QUnit that I dont know whwere should I start... But if somene has the time to explain very shortly if Im on the right way
Async Improvement to check if it's completed from external code
Hi, I'd like to propose a change to the QUnit async function that I found useful. Specifically testing if another async function has not completed this could be a cause for issues. Therefore this change proposes a way to check for this by attaching a state variable to the returning function: // Increment this Test's semaphore counter, then return a single-use function that // decrements that counter a maximum of once. async: function() { var test = this.test, popped = false; test.semaphore += 1;
jQuery test suite crashes with IE11
Hi all, I have tried to run all tests of jQuery 2.1.4 test suite with Internet Explorer 11, but after some tests, the page become irresponsive and the browser crashes. Any idea what is going wrong? Thanks, Ahmed
How to do Automated Mobile Testing
We want to set up some regression functional testing on our sites for iOS and Android cell phones and tablets. This seems to be a hard to solve issue on Selenium or other platforms. Has anyone accomplished this at a less than enterprise line item budget?
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!
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 ?
Documentation of QUnit.load()
I try to build an run through various Qunit-tests in various pages generated by a CMS.. After a page with its unit-tests worked out, the browser should load via AJAX the next testpage with other Qunit-Tests. I choose that way of testing, because I can develop the tests in small portions for special situations. I missed the documentation of QUit.load(), because I need that function to restart the Unittest after loading a new Page with new tests. I used the following sequence to restart the QUnit-tests
Testing with Ajax
I am a newbie to QUnit. I want to test the ValidatePhoneNumber function which has a callback as follows. Would anyone help me to write a test in QUnit for this function? Thanks ValidatePhoneNumber: function (userName, successCallback, errorCallback) { VaultModel.callService(successCallback, errorCallback); } callService: function (successCallback, errorCallback) { $.support.cors = true; $.mobile.allowCrossDomainPages = true; $.ajax({ success: successCallback,
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
Next Page