Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

วิธีทำ Automated Unit Testing ด้วย JavaScript

ใช้ Unit.js - cross-platform open-source unit testing framework

ตัวอย่าง

var example = 'Welcome';
test.string(example)
  .isEqualTo('Welcome');

โครงสร้าง test suite:

demo('Welcome', function() {
  demo1('Welcome to the website', function() {
    var example = 'Welcome';
    test.string(example)
      .isEqualTo('Welcome');
  });
});