欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JavaScript testing frameworks

程序员文章站 2022-06-30 09:16:36
...

Jasmine

Jasmine is a JavaScript testing framework. It can be easily integrated and run for websites

and is agnostic to AngularJS. It provides spies and other features. It can also be run on its

own without Karma. Some of the pros and cons are as follows:

Pros cons
Default integration with Karma No file-watching feature available when running tests.This means that tests have to be return by the user as they change.
Provides additional functions to assist with testing, such as test spies,fakes,and the pass-through functionality. The learning curve can be steep for all the Protractor methods and features.
Cleans readable syntax that allows tests to be formatted in a way that relates to the behavior being tested.  
Integration with several output reporters.  

Selenium

“Selenium automates browsers. That’s it!”

Automation of browsers means that developers can interact with browsers easily. They can

click on buttons or links, enter data, and so on. Selenium is a powerful toolset that, when

used and set up properly, has lots of benefits; however, it can be confusing and

cumbersome to set it up. Some of the pros and cons of Selenium are as follows:

Pros

Cons

Large feature set Has to be run as a separate process
Distributed testing Several steps to configure
SaaS support through services such as Sauce Labs  
Documentation and resources available  

 

Mocha

Mocha is a testing framework originally written for Node.js applications but supports

browser testing as well. It is very similar to Jasmine and mirrors much of its syntax. Let’s

 

discuss some of the pros and cons of Mocha:

Pros Cons
Easy to install Separate plugins/modules required for assertions,spies,and so on
Good documentation available Additional configulation required to use it with Karma
Has several reproters  
Plugs in with several node projects