qunit

Uncaught Error: Assertion Failed: calling set on destroyed object

霸气de小男生 提交于 2019-12-03 00:59:30
working in ember-cli testing. After all tests passed it returns extra two test with errors. Uncaught Error: Assertion Failed: calling set on destroyed object Source : '../dist/assets/vendor.js:13269' this is one unit test configuration import Ember from "ember"; import { test,moduleFor } from 'ember-qunit'; import startApp from '../helpers/start-app'; var App; module('An Integration test',{ setup:function(){ App=startApp(); }, teardown: function() { Ember.run(App, 'destroy'); } }); Huafu This is either because in the result of a promise or any other deferred code you do not check the destroy

Unit testing AJAX requests with QUnit

自闭症网瘾萝莉.ら 提交于 2019-12-03 00:32:10
We are trying to implement QUnit JavaScript tests for a JS-heavy web app. We are struggling to find a way to successfully test methods that involve jQuery AJAX requests. For example, we have the following constructor function (obviously this is a very simplistic example): var X = function() { this.fire = function() { $.ajax("someURL.php", { data: { userId: "james" }, dataType: "json", success: function(data) { //Do stuff } }); }; }; var myX = new X(); myX.fire(); We are trying to find a way to test the fire method, preferably with a stubbed URL instead of the real someURL.php . The only

not able to write the qunit test results to output xml using build.xml

谁说我不能喝 提交于 2019-12-02 21:44:23
问题 I am using build.xml with phantom.js to execute the qunit testcases,test are passing but the results are not getting written to output xml file.qunit.done function of qunit.runner.js gives Cannot write junit results file error in QUnit.done function. any one has any idea/suggestion thanks in advance 来源: https://stackoverflow.com/questions/23238119/not-able-to-write-the-qunit-test-results-to-output-xml-using-build-xml

QUnit isn't running manually namespaced setup code like I would expect?

时光怂恿深爱的人放手 提交于 2019-12-02 19:23:38
问题 In stuff.js: function init() { return "works"; } (function(ParentNamespace) { ParentNamespace.MySubNamespace = {}; })(window.MyNamespace || (window.MyNamespace = {})); In my test JS file: /// <reference path="../../../project1/Shared/sub1/Javascript/stuff.js" /> test("foo test", function () { deepEqual(init(), "works", "couldn't access source JS file"); ok(window, "no window context"); var ns = window.MyNamespace; ok(ns in window, "namespace is bad"); var ns2 = window.MyNamespace

BDD framework for the frontend?

删除回忆录丶 提交于 2019-12-02 18:20:10
On the server side we have Rspec/Cucumber for BDD development (ruby) vowsjs (node.js) Is there a BDD frameworks to use on web browsers (not qUnit or YUI test since these are only for TDD)? Check out jasmine describe("Jasmine", function() { it("makes testing JavaScript awesome!", function() { expect(yourCode).toBeLotsBetter(); }); }); http://pivotal.github.com/jasmine/ https://github.com/pivotal/jasmine Should_be ( sic ) very familiar to a ruby person You could also look at Yadda . Rather than being a standalone test framework like CucumberJS, it enables to use a Gherkin like syntax from other

QUnit vs Jasmine? [closed]

爷,独闯天下 提交于 2019-12-02 16:32:59
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. QUnit is very easy to get started with, as you only need to include two files and a little bit of markup, then you can start writing tests. Jasmine strength, afaik is its BDD-style syntax, if that is something that you prefer (probably not a selling point for you) and tight integration into Ruby/Rails tools. In the end both get the job done. I recommend to start with QUnit. Once you're feeling comfortable, try Jasmine and check if the BDD style

How to catch an SVG parsing error?

巧了我就是萌 提交于 2019-12-02 00:04:24
问题 I'm trying to write a unit test (using qunit ) for my code that generates an SVG path as a string. One of the test should be whether that thing is actually valid SVG at all. In the Chrome browser console, it's easy to test just by doing this: $("<svg xmlns=\"http://www.w3.org/2000/svg\"><path d=\"asdsdsadas\" /></svg>") This will fail with an appropriate error message: Error: Invalid value for attribute d="asdsdsadas" However, it also returns the invalid document, same as if it would have

QUnit, assert not OK?

落爺英雄遲暮 提交于 2019-12-01 20:35:15
Sorry if this is obvious, but is there a notOK or equivalent function in QUnit, if we want to assert that a method returns false? I can't see a way to negate OK in the documentation . I tried: !ok... but that didn't work. You could use: ok(!method_expected_to_be_false) According to the documentation : The most basic assertion in QUnit, ok() requires just one argument. If the argument evaluates to true, the assertion passes; otherwise, it fails. You can verify that a method return a false value by writing an expression which evaluates to a true value in the case the method returns false , and

EmberJS Service Injection for Unit Tests (Ember QUnit)

纵饮孤独 提交于 2019-12-01 16:55:46
Specs: Ember version: 1.13.8 node: 0.10.33 npm: 2.13.4 I have import Alias from "../../../services/alias"; .... moduleFor("controller:test", "Controller: test", { integration: true, beforeEach: function() { this.register('service:alias', Alias, {singleton: true}); this.inject.service('alias', { as: 'alias' }); this.advanceReadiness(); }, }); ... test('Alias Alias Alias ', function(assert) { var controller = this.subject(); //sample function controller.send("test"); assert.equal(true, controller.alias.get("alias"), "alias should be true"); }); (Using 'alias' as example because I'm not allow to

EmberJS Service Injection for Unit Tests (Ember QUnit)

落花浮王杯 提交于 2019-12-01 14:51:10
问题 Specs: Ember version: 1.13.8 node: 0.10.33 npm: 2.13.4 I have import Alias from "../../../services/alias"; .... moduleFor("controller:test", "Controller: test", { integration: true, beforeEach: function() { this.register('service:alias', Alias, {singleton: true}); this.inject.service('alias', { as: 'alias' }); this.advanceReadiness(); }, }); ... test('Alias Alias Alias ', function(assert) { var controller = this.subject(); //sample function controller.send("test"); assert.equal(true,