Running tests

R13B03以後 OTP的模塊加入了大量的測試模塊,這些模塊都是common_test的使用例子. 我們可以學到的2點 1. 如何編寫common_test 2. 如何養成好習慣,爲我們自己的工程編寫測試案例.

以下是如何允許測試案例:

原文地址: [url]http://wiki.github.com/erlang/otp/running-tests[/url]

Running tests
Building

Build the tests like this

make release_tests

Running

To run the test first do:

cd release/tests/test_server

and then start Erlang:

$ERL_TOP/bin/erl

Install the ts framework

ts:install().

To run all test suites do

ts:run().

Note that running all tests will require several hours, so you may want to run the test cases for a single application

ts:run(Application, [batch]).

or even part of the test suite for an application, for example

ts:run(emulator, bs, [batch]).

to run all test suite modules starting with bs (i.e. all modules that test the bit syntax).

To run a specific test case in a module, the full name of the module and test case must be spelled out:

ts:run(emulator, bs_bincomp_SUITE, byte_aligned, [batch]).

Run ts:help() to show some help.

There will currently be 15 or so failed test cases in the kernel application.
Examining the results

Open the file release/test/test_server/index.html in a web browser. Or open release/test/test_server/last_test.html when a test suite is running to examine the results so far for the currently executing test suite.
發佈了66 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章