1pas2ut(1) Free Pascal unit test creation tool pas2ut(1)
2
3
4
6 pas2ut - The Free Pascal unit to unit test case conversion tool.
7
8
10 pas2ut [options] inputfile [outputfile]
11
12
14 pas2ut Scans the input file for classes and routines, and creates a
15 testcase for all classes and routines found in the interface section of
16 the file. It can generate a unit or an include file. All tests are
17 created with a standard fail message. By default, only tests for pub‐
18 lic, published and default visibility members of classes are generated.
19
20
22 pas2ut takes the following options at this time:
23
24 --defaultclasstest=list
25 Specify a comma-separated list of default tests for each class.
26 The elements in the list must be valid pascal identifiers.
27
28 --failmessage=Msg
29 Set the message for the Fail() statement inside each test
30 method.
31
32 --limit=list
33 Specify a comma-separated list of global identifiers for which
34 to generate tests. By default, tests are generated for all
35 global identifiers in the interface section of a unit.
36
37 --prefix=name
38 Set the prefix for the test names (default is Test ). A test is
39 named after the identifier it tests, with this prefix.
40
41 --singletestclass
42 Use a single test class for each class found. The default is to
43 create a testcase class per class in the input unit.
44
45 --skip-classes
46 Do not generate test code for classes, only for functions and
47 procedures.
48
49 --skip-declaration
50 Do not generate declarations for the tests, only implementa‐
51 tions.
52
53 --skip-default
54 skip tests for default visibility members. By default, they are
55 generated, together with Public or published members.
56
57 --skip-fail
58 Do not create fail() statements in test routine implementations.
59
60 --skip-fields
61 Do not generate testcases for fields of classes (only for meth‐
62 ods and properties).
63
64 --skip-functions
65 Do not generate tests for functions/procedures, only for
66 classes.
67
68 --skip-implementation
69 Do not generate (empty) implementation for the tests, only a
70 class declaration is generated. (it can be completed in an IDE
71 such as Lazarus or MSIDE)
72
73 --skip-methods
74 Do not generate tests for methods of classes, only for fields
75 and properties.
76
77 --skip-properties
78 Do not generate tests for properties of classes, only for fields
79 and methods.
80
81 --skip-property-default
82 Do not generate a default test for each property.
83
84 --skip-public
85 Skip tests for public members, only protected members will be
86 tested if --test-protected is in effect.
87
88 --skip-published
89 Do not generate tests for published members, only public and
90 default members will be tested.
91
92 --skip-register
93 Do not generate RegisterTests statement.
94
95 --skip-setup
96 Do not override the TTestCase.Setup() method in the generated
97 class.
98
99 --skip-teardown
100 Do not override the TTestCase.TearDown() method in the generated
101 class.
102
103 --skip-unit
104 Do not generate a unit, just an include file.
105
106 --testparentname=name
107 Set the name of the parent class for generated test classes. The
108 default is TTestCase this can be used to set another class
109 name.
110
111 --test-property-bounds
112 Generate a GetBounds test for each property.
113
114 --test-property-maxlen
115 Generate a MaxLen test for each property.
116
117 --test-property-notify
118 Generate a Notify test for each property.
119
120 --test-property-required
121 Generate a Required test for each property.
122
123 --test-protected
124 Also generate tests for protected class members. By default,
125 tests are only generated for public, published and default visi‐
126 bility members.
127
128 --testunitname=name
129 Set the name of the generated unit (default is taken from output
130 file name)
131
132 --tiopf
133 Create tiopf tests (this is the same as specifying
134 --default,--bounds,--required,--notify and --maxlen tests.)
135
136
137 --unittestclassname=name
138 Set the global unit test class name. To be used with --sin‐
139 gletestclass.
140The --limit and --defaultclasstest may be specified multiple times.
141
142
144 fpc(1)
145
146
147
148Free Pascal 5 sep 2015 pas2ut(1)