Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QUnit can't recognize more than one test

I am having a problem with QUNIT, no matter what I seem to do the test suites will only ever recognize one test or module, even though I have multiple one's in the javascript. Any help will be greatly appreciated!

    <script>
          $(document).ready(function(){
            QUnit.log = function(result, message)
            {
                if (window.console && window.console.log)
                {
                   window.console.log(result +' :: '+ message);
                }   
            }
            module("Basic Unit Test");
            test("Sample test", function()
            {
                expect(1);
                equal(divide(4,2),2, 'Expected 2 as the result, result was ' + divide(4,2));
            });
                        test("Test two", function() {
                        expect(1);
                        equal(divide(8,2),2,'Expected 4 as the result, result was ' + divide(8,2));
                        });

            function divide(a,b){
                return a / b;
            }
          });

    </script>
like image 538
scalabilitysolved Avatar asked Sep 10 '25 02:09

scalabilitysolved


1 Answers

You probably have QUnit-Url-Parameters in the Url which restrict testing to the modules / tests specified in these filter params (on http://docs.jquery.com/Qunit see "URL Parameters"). Start with a clean URL and then all your tests should be executed.

eg. Your URL contains blah.html?testNumber=1. This means only one test will run. Remove ?testNumber=1.

like image 105
Dietmar Koenig Avatar answered Sep 12 '25 18:09

Dietmar Koenig