The YUI test can contain test suites, test cases, and test functions. A YUI test suite is a group of related test cases. Each test case includes one or more test functions for the JavaScript code. Every test function should contain one or more assertion in order to perform the tests and verify the outputs.
The YUI Test.Suite
object is responsible for creating a YUI test suite, while the YUI Test.Case
object creates a YUI test case. The add
method of the Test.Suite
object is used for attaching the test case object to the test suite. The following code snippet shows an example of a YUI test suite:
YUI().use('test', 'console', function(Y){ var testcase1 = new Y.Test.Case({ name: "testcase1", testFunction1: function() { //... }, testFunction2: function() { //... } }); var testcase2 = new Y.Test.Case({ name: "testcase2", testAnotherFunction: function() { //... } }); ...