- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to perform Automated Unit Testing with JavaScript?
To perform unit testing in JavaScript, use Unit.js. It is a cross-platform open-source unit testing framework.
Example
Let’s say the following in your test code −
var example = ‘Welcome’; test.string(example) .isEqualTo(‘Welcome’);
The function demo() displays a suit of tests, whereas demo1() is an individual test specification,
demo('Welcome’, function() { demo1('Welcome to the website', function() { var example = ‘Welcome’; test.string(example) .isEqualTo(‘Welcome’); }); });
Advertisements