我是jasmine.js框架的新手。
这段代码中有什么问题:
beforeEach(function(){
var fixtureUrl = "/../path/to/templates/home.html";
var html = jasmine.getFixtures().read(fixtureUrl);
console.log(html);
});
我收到了一个错误:
TypeError:未定义不是Object.上的函数
TypeError: undefined is not a function at Object<anon
我正在尝试学习如何使用Jasmine和Sinon来测试主干应用程序,并且我一直在关注。然而,我遇到了一个我不知道如何解决的问题。
很可能解决方案很简单,但我需要一些指导...
在我的project.spec.js文件中,这是导致问题的代码:
it("should not save when name is empty", function() {
var eventSpy = sinon.spy();
this.project.bind("error", eventSpy);
this.project.save({"name
当从Resharper运行Jasmine测试时,所有测试都会出现以下错误,但是,当直接从Visual中的Chutzpah扩展启动时,相同的测试就会成功。
Jasmine 2.0.0
finished in 0.106s
10 specs, 10 failures
Spec List | Failures
UI.tools Tests (name)
ReferenceError: setFixtures is not defined
ReferenceError: setFixtures is not defined
at Object.<anonymous> (http:/
我用angularjs创建了一个应用程序,我学过为angularjs编写茉莉单元测试用例,但问题是,在我的应用程序中,我有角范围方法和普通JavaScript函数,当我为该函数编写测试用例时,我得到了以下异常
ReferenceError: isInvalid is not defined
at null.<anonymous> (http://fiddle.jshell.net/_display/:83:16)
at jasmine.Block.execute (http://jasmine.github.io/1.3/lib/jasmine.js:1064:17
我是JavaScript和测试新手。我的任务是在RequireJS模块中测试这个函数:
editProfile: function () {
this.checkForReload();
var editProfileView = new EditProfileView();
this.changeView(editProfileView);
//needs to be called separately since whe it's passed as parameter view to change is replaced with sideba
我在跑
DEBUG=1 JASMINE_DEBUG=1 VELOCITY_DEBUG=1 VELOCITY_DEBUG_MIRROR=1 meteor
我得到一个期望的结果
[[[[[ ~/Projects/uge-spark/gui ]]]]]
=> Started proxy.
=> Started MongoDB.
Meteor._wrapAsync has been renamed to Meteor.wrapAsync
[Velocity.FileCopier] Replace file in mirror /home/juanpa/Projects/uge-spark
Struggling on writing the testcases on click,toggle,slideUp,fade events.
How do I write jasmine test cases to check if div is clicked or not and the slideUp and down and toggle events. Is there a provision in jasmine to test them.
我列出了我的代码,点击测试用例以供参考。
SpecRunner.html file
<!DOCTYPE html>
&l
我试图为我的角2应用程序编写单元测试。我在Visual 2015中使用茉莉花,Chutzpah。当测试没有任何依赖项或需求时,测试就可以工作了。但是,当测试有一个时,测试就不会启动。
在输出中,当我尝试开始测试时,我得到:
Error: ReferenceError: Can't find variable: require at global code in ...\scripts\_references.js
Error: ReferenceError: Can't find variable: jQuery at global code in ...\scripts\_
我在Jasmine2中使用Protractor,而e2e的执行是在浏览器堆栈上执行的。
E2E的执行有大约60个Spec文件-每个Spec文件大约有10个it()
所有规范都通过逗号分隔的列表传递,例如a、b、c、d等
如果由于规格b的某些不一致而出现超时错误,则c&d的执行永远不会恢复,并在日志中显示错误,如(node:67941) UnhandledPromiseRejectionWarning: WebDriverError: Session not started or terminated
然后下面的错误10:59:45来自异步测试: 10:59:45错误10:59:45 a
每当我执行loadFixture()调用或文本下面的测试时,我都会收到一个错误声明:
Frontend should be able to set fixtures.
TypeError: undefined is not a function
TypeError: undefined is not a function
at jasmine.Fixtures.cleanUp (http://localhost:4567/__spec__/helpers/jasmine-jquery.js:89:5)
at null.<anonymous> (http://loca
我最近升级到量角器2.5.1,现在我的所有测试都失败了。我怀疑这与茉莉花有关,但我不知道该如何解决。如有任何帮助将不胜感激,谢谢。以下是我收到的错误:
Should login successfully
Message:
ReferenceError: testFn is not defined
Stack:
ReferenceError: testFn is not defined
at Object. (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasminewd2\index.js:81:16)
at attemptA
我正在写一个程序来测试不同的三角形类型,但我被卡住了。以下是我的测试结果:
(在思考过程中留下了评论)。
app-spec.js
describe("Answer", function () {
var equilateral;
var sideA;
var sideB;
var sideC;
it("Should return equilateral when all sides are equal", function () {
expect(whichTriangle(sideA, sideB, si
从Jasmine开始,按照关于异步测试的说明,我注意到从未调用过beforeEach函数。
知道为什么不行吗?我在网上找不到任何相关的提示。谢谢。
码
代码非常简单:
describe("Testing test.php", function()
{
it ("Gets me a coke", function()
{
var asyncResult = null;
// query function with callback
var queryFcn = function(callback)
我有一个量角器项目,它像我预期的那样启动并运行规范,但是在将近2分钟之后,它开始在其余的测试用例上得到这个错误。我也不知道原因。它在一周前运行得很好,但现在我遇到了这个错误,它没有给出(或者我看不见)关于错误的任何细节。
“错误:失败:堆栈(Z:\dev\lmw\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2200:17) at buildExpectationResult (Z:\dev\lmw\node_modules\protractor\node_modules\jasmi