Changes between Version 5 and Version 6 of Tests
- Timestamp:
- Aug 30, 2013, 11:26:39 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tests
v5 v6 2 2 3 3 The MacPorts testing framework uses tcltest ![0] for its unit tests as well as regression tests. 4 Maintainer: marius@macports.org 4 Maintainer: marius [at] macports.org 5 6 === Running tests === 7 8 The easiest way to run all the tests, is to use the target in the Makefile. 9 * make test 10 11 Each 'tests/' directory has a 'test.tcl' file, used by the make target to run all tests and format the output, making it easy to read. 12 The file can be used also to: 13 * run all tests: ' tclsh test.tcl ' 14 * get debug info: ' tclsh test.tcl -debug \[0-3\] ' 15 * list individual test files: ' tclsh test.tcl -l ' 16 * run specific test files: ' tclsh test.tcl -t macports.test ' 17 * print help message: ' tclsh test.tcl -h ' 18 19 Specific test cases can be run using the '-match' argument for the file that contains the test, from its parent directory. 20 * tclsh macports.test -match mportclose 21 22 Regression tests can be found in ' trunk/base/tests/ ' and can be run just as unit tests. 5 23 6 24 7 25 === Must know === 8 26 27 * regression tests have their own directory, found in ' trunk/base/tests/ ' 9 28 * each module of MacPorts (port1.0, macports1.0, package1.0) has its own ‘tests/’ directory where the test files are located and also additional files needed (Portfile, test.tcl) 10 29 * each file in a module has a corresponding test file (.test extension) in the ‘tests/’ directory … … 12 31 * each test case must be independent from each other, so they can be run individually if needed 13 32 * each test must clan all auxiliary files or directories it creates and revert all port it installs 33 * use a single test proceduce for each tested proc; sub-test cases should be included in the same body 34 * when adding new regression tests, make sure to specify its name in the test_suite list of ' trunk/base/tests/test.tcl ' 14 35 15 36 … … 49 70 test mportclose { 50 71 Mport close unit test. 72 # this branch is optional and you can use other constraints too 73 } -constraints { 74 root 51 75 # the setup branch is optional 52 76 } -setup { … … 69 93 }}} 70 94 71 72 === Resources ===73 74 ![0] - [[http://wiki.tcl.tk/1502 | Tcltest official wiki page]]\\75 ![1] - [[http://web.archive.org/web/20080617153002/www.tclscripting.com/articles/apr06/article1.html | Getting started with tcltest]]\\76 ![2] - [[http://www.tcl.tk/man/tcl8.5/TclCmd/tcltest.htm | Official tcltest documentation]]