Note that there are some explanatory texts on larger screens.

plurals
  1. POQUnit asyncTest for CORS AJAX Call always fails
    text
    copied!<p>I am learning QUnit Unit Testing for UI testing.</p> <p>I want to test an AJAX CORS Call with asyncTest function by QUnit and following is my code,</p> <pre class="lang-js prettyprint-override"><code>asyncTest("Async Test", 1, function () { $.getJSON("http://oursite.com/api/product" + "/?PageSize=' + 25 + '&amp;ActiveOnly=' + 1 + '&amp;Index=' + 0", function (data) { deepEqual(data, { status: "ok" }); start(); }); }); </code></pre> <p>but IE Gives me following error </p> <p>1.Died on test #1: Invalid character - { "description": "Invalid character", "number": - 2146827274, "stack": "SyntaxError: Invalid character at parseJSON (<a href="http://oursite.com/scripts/json.js:532:13" rel="nofollow">http://oursite.com/scripts/json.js:532:13</a>) at ajax (<a href="http://oursite.com/Scripts/jquery-" rel="nofollow">http://oursite.com/Scripts/jquery-</a> 2.0.3.js:7276:4) at Anonymous function (<a href="http://oursite.com/Scripts/jquery-2.0.3.js:7447:3" rel="nofollow">http://oursite.com/Scripts/jquery-2.0.3.js:7447:3</a>) at getJSON (<a href="http://oursite.com/Scripts/jquery-2.0.3.js:7430:3" rel="nofollow">http://oursite.com/Scripts/jquery-2.0.3.js:7430:3</a>) at Anonymous function (<a href="http://oursite.com/scripts/custom/JSUnitTest.js:64:5" rel="nofollow">http://oursite.com/scripts/custom/JSUnitTest.js:64:5</a>) at run (<a href="http://oursite.com/scripts/qunit.js:102:4" rel="nofollow">http://oursite.com/scripts/qunit.js:102:4</a>) at Anonymous function (<a href="http://oursite.com/scripts/qunit.js:232:5" rel="nofollow">http://oursite.com/scripts/qunit.js:232:5</a>) at process (<a href="http://oursite.com/scripts/qunit.js:869:4" rel="nofollow">http://oursite.com/scripts/qunit.js:869:4</a>) at Anonymous function (<a href="http://oursite.com/scripts/qunit.js:408:5" rel="nofollow">http://oursite.com/scripts/qunit.js:408:5</a>)", "toJSONString": function( a ){ [code] }, "parseJSON": function( a ){ [code] } } </p> <p>PLEASE NOTE: qunit asyncTest is not even making an AJAX Call, I guess it is failing even before it does anything. It is a PARSING Error but why? Any help will be appreciated. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload