Angular JS单元测试教程和示例

时间:2022-02-09 12:47:52

I am new to karma-jasmine unit testing for Angular js. So guys please can u share good tutorials?

我是Angular js的karma-jasmine单元测试的新手。所以大家请你分享好的教程?

3 个解决方案

#1


12  

First of all, and most IMPORTANT:

首先,最重要的是:

Unit-testing is similar in all other languages.

单元测试与所有其他语言类似。

You have to keep in mind the main features of writing testable code.

您必须牢记编写可测试代码的主要功能。

Note: There is a good Pluralsight video ( Which cost money ) by Misko Hevery on Writing Testable Code).

注意:Misko Hevery在编写可测试代码时有一个很好的Pluralsight视频(费用很高)。

First: Watch this youtube by Vojta Jina - Installing and Starting Karma, the person who wrote karma.

第一:通过Vojta Jina观看这个youtube - 安装和启动写作业力的人Karma。

Second: Watch this 1 Hour tutorial which I highly recommand : Introduction to AngularJS Unit Testing By Jim Levin

第二:观看这个我强烈建议的1小时教程:AngularJS单元测试简介Jim Levin

After you complete those you should be able to test every piece of code in your Angular Project.

完成后,您应该能够测试Angular项目中的每一段代码。

Good Luck.

#2


6  

I've written a number of tutorials detailing how to get up and running with Karma and Jasmine for Unit Testing in AngularJS. I've also written a series of posts detailing ngMock in depth, which is Angular's own module that provides support for testing controllers, services etc in isolation.

我已经编写了一些教程,详细介绍了如何在AngularJS中使用Karma和Jasmine进行单元测试。我还写了一系列详细介绍ngMock的帖子,这是Angular自己的模块,它为隔离测试控制器,服务等提供支持。

Here's a link to a page that lists all these articles: AngularJS Unit Testing Tutorials

这是一个列出所有这些文章的页面的链接:AngularJS单元测试教程

#3


1  

There is an amazing documentation on Jasmine Testing provided by Angular IO on their official website.

Angular IO在其官方网站上提供了关于Jasmine Testing的精彩文档。

https://angular.io/docs/ts/latest/guide/testing.html

Good Luck

#1


12  

First of all, and most IMPORTANT:

首先,最重要的是:

Unit-testing is similar in all other languages.

单元测试与所有其他语言类似。

You have to keep in mind the main features of writing testable code.

您必须牢记编写可测试代码的主要功能。

Note: There is a good Pluralsight video ( Which cost money ) by Misko Hevery on Writing Testable Code).

注意:Misko Hevery在编写可测试代码时有一个很好的Pluralsight视频(费用很高)。

First: Watch this youtube by Vojta Jina - Installing and Starting Karma, the person who wrote karma.

第一:通过Vojta Jina观看这个youtube - 安装和启动写作业力的人Karma。

Second: Watch this 1 Hour tutorial which I highly recommand : Introduction to AngularJS Unit Testing By Jim Levin

第二:观看这个我强烈建议的1小时教程:AngularJS单元测试简介Jim Levin

After you complete those you should be able to test every piece of code in your Angular Project.

完成后,您应该能够测试Angular项目中的每一段代码。

Good Luck.

#2


6  

I've written a number of tutorials detailing how to get up and running with Karma and Jasmine for Unit Testing in AngularJS. I've also written a series of posts detailing ngMock in depth, which is Angular's own module that provides support for testing controllers, services etc in isolation.

我已经编写了一些教程,详细介绍了如何在AngularJS中使用Karma和Jasmine进行单元测试。我还写了一系列详细介绍ngMock的帖子,这是Angular自己的模块,它为隔离测试控制器,服务等提供支持。

Here's a link to a page that lists all these articles: AngularJS Unit Testing Tutorials

这是一个列出所有这些文章的页面的链接:AngularJS单元测试教程

#3


1  

There is an amazing documentation on Jasmine Testing provided by Angular IO on their official website.

Angular IO在其官方网站上提供了关于Jasmine Testing的精彩文档。

https://angular.io/docs/ts/latest/guide/testing.html

Good Luck