Юнит-тесты для FireBug
18 декабря 2008
Расширение для FireBug для проведения модульного тестирования.
Пример кода
// Простая проверка true/false fireunit.ok( true, "Пройдёт успешно!" ); fireunit.ok( false, "Не пройдёт!" ); // Сравнить строки - показать // различия, если не равны fireunit.compare( "The lazy fox jumped over the log.", "The lazy brown fox jumped the log.", "Are these two strings the same?" ); // Сравнить с регулярным выражением fireunit.reCompare( /The .* fox jumped the log./, "The lazy brown fox jumped the log.", "Compare a string using a RegExp." ); // Общий результат fireunit.testDone(); // -- События // Можно вызывать события браузера var input = document.getElementsByTagName("input")[0]; fireunit.mouseDown( input ); fireunit.click( input ); fireunit.focus( input ); fireunit.key( input, "a" ); // -- Запуск групп тестов // Запуск нескольких страниц: fireunit.runTests("test2.html", "test3.html"); // Добавляем в каждый такой файл: fireunit.testDone();
Комментарии RSS по email OK