Jasmine
Jasmine
https://www.npmjs.com/package/jasmine
The Jasmine Module
The
jasminemodule is a package of helper code for developing Jasmine projects for Node.js.The core of jasmine lives at https://github.com/jasmine/jasmine and is
jasmine-corein npm.Contents
This module allows you to run Jasmine specs for your Node.js code. The output will be displayed in your terminal by default.
Installation
# Local installation:npm install --save-dev jasmine# Global installationnpm install -g jasmineInitializing
To initialize a project for Jasmine
jasmine initTo seed your project with some examples
jasmine exampleshttps://jasmine.github.io/setup/nodejs.html
Note that if you installed Jasmine locally you could still use the command line like this:
node node_modules/jasmine/bin/jasmine init
DEMO
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});

API
https://jasmine.github.io/api/3.0/global.html#expect
describe(description, specDefinitions)
Create a group of specs (often called a suite).
Calls to describe can be nested within other calls to compose your suite as a tree.
Parameters:
| Name | Type | Description |
|---|---|---|
description |
String |
Textual description of the group |
specDefinitions |
function |
Function for Jasmine to invoke that will define inner suites and specs |
expect(actual) → {matchers}
Create an expectation for a spec.
Parameters:
| Name | Type | Description |
|---|---|---|
actual |
Object |
Actual computed value to test expectations against. |
Jasmine的更多相关文章
- jasmine入门
本文来自http://blog.fens.me/nodejs-jasmine-bdd 粉丝日志 张丹 前言TDD(Test Driven Development)测试驱动开发,是敏捷开发中提出的最 ...
- angularjs自动化测试系列之jasmine
angularjs自动化测试系列之jasmine jasmine参考 html <!DOCTYPE html> <html lang="en"> <h ...
- Karma+Jasmine实现自动化单元测试
1.Karma介绍 Karma是Testacular的新名字,在2012年google开源了Testacular,2013年Testacular改名为Karma.Karma是一个让人感到非常神秘的名字 ...
- JavaScript测试工具比较: QUnit, Jasmine, and Mocha
1. QUnit A JavaScript Unit Testing framework. QUnit is a powerful, easy-to-use JavaScript unit testi ...
- 基于Angularjs+jasmine+karma的测试驱动开发(TDD)实例
简介(摘自baidu) 测试驱动开发,英文全称Test-Driven Development,简称TDD,是一种不同于传统软件开发流程的新型的开发方法.它要求在编写某个功能的代码之前先编写测试代码,然 ...
- Jasmine测试ng Promises - Provide and Spy
jasmine提供了很多些很实用的处理Promises的方法,首先我们来考虑下面的这个例子: angular.module("myApp.store").controller(&q ...
- Jasmine入门(上)
什么是Jasmine Jasmine是一个Javascript的BDD(Behavior-Driven Development)测试框架,不依赖任何其他框架. 如何使用Jasmine 从Github上 ...
- Jasmine入门(结合示例讲解)
参考: http://www.cnblogs.com/wushangjue/p/4541209.html http://keenwon.com/1191.html http://jasmine.git ...
- angular测试-Karma + Jasmine配置
首先讲一下大致的流程: 需要node环境,首先先要安装node,node不会?请自行搜索.版本>0.8 安装node完成之后先要测试下npm是否测试通过,如下图所示 首先看下目录结构 目录为:F ...
- 使用jasmine来对js进行单元测试
互联网的快速发展,给web开发人员带来了前所未有的挑战.对于前端开发,前端开发er所需要编写的js早已不是那些寥寥几行的视觉效果代码.代码量的大增,多人协同,人员素质悬殊不齐,这都需要一个标准,来对代 ...
随机推荐
- Spring类型转换(Converter)
Spring的类型转换 以前在面试中就有被问到关于spring数据绑定方面的问题,当时对它一直只是朦朦胧胧的概念,最近稍微闲下来有时间看了一下其中数据转换相关的内容,把相应的内容做个记录. 下面先说明 ...
- python3 闭包函数
'''闭包函数:内部函数引用外部函数变量(非全局变量)'''def func(y): x = 1 def func1(): print(x, y) return func1 f = func(2)pr ...
- Redis数据持久化、数据备份、数据的故障恢复
1.redis持久化的意义----redis故障恢复 在实际的生产环境中,很可能会遇到redis突然挂掉的情况,比如redis的进程死掉了.电缆被施工队挖了(支付宝例子)等等,总之一定会遇到各种奇葩的 ...
- Python#常用的模块和简单用法
目录 random 随机模块 os 文件夹模块: time 时间模块: matplotlab.pyplot 作图模块 mpl_toolkits.mplot3d 绘制3D图模块 Pygame Reque ...
- 获取任意链接文章正文 API 功能简介
此文章对开放数据接口 API 之「获取任意链接文章正文」进行了功能介绍.使用场景介绍以及调用方法的说明,供用户在使用数据接口时参考之用. 1. 产品功能 接口开放了根据提供的文章链接 Url 参数,智 ...
- Mysql完整约束性
一.介绍 约束条件与数据类型的宽度一样,都是可选参数 作用:用于保证数据的完整性和一致性主要分为: PRIMARY KEY (PK) 标识该字段为该表的主键,可以唯一的标识记录 FOREIGN KEY ...
- Java泛型中<? extends E>和<? super E>的区别
这篇文章谈一谈Java泛型声明<? extends E>和<? super E>的作用和区别 <? extends E> <? extends E> 是 ...
- photoshop快速把新照片制作成老照片教学
原图 步骤1 在photoshop中找开需要处理的图片,Ctrl+J复制图片,得到图片1. 步骤2 单击图层面板底部的创建新的填充或调整图层图标,添加色调/饱和度调整图层.调整它的饱合度和明度. 步骤 ...
- 国内可访问的稳定docker镜像
可参考:https://yeasy.gitbooks.io/docker_practice/content/install/mirror.html 但在debian 9上进行相应配置后,在pull镜像 ...
- @Autowired 基本介绍,有待丰富
今天做项目对于@Autowired理解有点错误:过两天再来看看 转自:https://www.cnblogs.com/szlbm/p/5512931.html 什么是注解 传统的Spring做法是使用 ...