@@ -23,18 +23,18 @@ three parameters to configure Fox's test generation:
23
23
24
24
- The **seed ** allows you to seed the random number generator Fox uses. This
25
25
allows you to set the PRNG to help reproduce failures that Fox may have
26
- generated during a test run. Setting this to the default (``0 ``) will make
26
+ generated during a test run. Setting this to the default (``0 ``) makes
27
27
Fox generate a seed based on the current time.
28
- - The **number of tests ** indicates the number of tests Fox will generate for
28
+ - The **number of tests ** indicates the number of tests Fox generates for
29
29
this particular property. More tests generated will more thoroughly cover the
30
- property at the cost of time. Setting this to the default (``0 ``) will make
30
+ property at the cost of time. Setting this to the default (``0 ``) makes
31
31
Fox run ``500 `` tests.
32
- - The **maximum size ** indicates the maximum size factor Fox will use when
32
+ - The **maximum size ** indicates the maximum size factor Fox uses when
33
33
generating tests. Generators use this size factor as a hint to produce data
34
- of the appropriate sizes. For example, ``FOXInteger `` will generate integers
35
- within the range of 0 to ``maximumSize `` and ``FOXArray `` will generate
34
+ of the appropriate sizes. For example, ``FOXInteger `` generates integers
35
+ within the range of 0 to ``maximumSize `` and ``FOXArray `` generates
36
36
arrays whose number of elements are in the range of 0 to ``maximumSize ``.
37
- Setting this to the default (``0 ``) will make Fox run with a ``maximumSize ``
37
+ Setting this to the default (``0 ``) makes Fox run with a ``maximumSize ``
38
38
of ``200 ``. If you know this property's data generation can tolerate larger
39
39
sizes, feel free to increase this. Large collection generation can be
40
40
prohibitively expensive.
@@ -45,8 +45,8 @@ be recorded to reproduce a failure that Fox may have generated.
45
45
Per Assertion Configuration
46
46
---------------------------
47
47
48
- By default, Fox will generate **500 tests per assertion ** with a **maximum size
49
- of 200 ** and a random seed. By changing ``FOXAssert `` to ``FOXAssertWithOptions ``
48
+ By default, Fox generates **500 tests per assertion ** with a **maximum size of
49
+ 200 ** and a random seed. By changing ``FOXAssert `` to ``FOXAssertWithOptions ``
50
50
we can provide optional configuration by using the ``FOXOptions ``::
51
51
52
52
FOXAssertWithOptions(FOXForAll(...), (FOXOptions){
@@ -61,14 +61,60 @@ Global Configuration
61
61
Values can be overridden using `environment variables `_ to globally change the
62
62
defaults.
63
63
64
+ .. note :: Note that as of this time of writing, ``xcodebuild test`` (command
65
+ line) does not properly pass environment variables to test bundles
66
+ for iOS. Use the setter style listed after the environment variables
67
+ instead.
68
+
69
+ It is fine to set environment variables via Xcode.
70
+
64
71
- Setting ``FOX_SEED `` can specify a specific seed to run for all properties.
65
72
- Setting ``FOX_NUM_TESTS `` sets the number of tests to generate for each
66
73
property.
67
- - Setting ``FOX_MAX_SIZE `` sets the maximum size factor Fox will use to when
74
+ - Setting ``FOX_MAX_SIZE `` sets the maximum size factor Fox uses to when
68
75
generating tests.
69
76
70
77
.. _environment variables : http://nshipster.com/launch-arguments-and-environment-variables/
71
78
79
+ If you cannot use environment variables, Fox also allows you to manually
80
+ override the values via setters:
81
+
82
+ - ``FOXSetSeed(NSUInteger seed) `` sets the random seed.
83
+ - ``FOXSetNumberOfTests(NSUInteger numTests) `` sets the number of tests.
84
+ - ``FOXSetMaximumSize(NSUInteger maxSize) `` sets the maximum size.
85
+
86
+ An easy way to use these setters would be in an ``+[initialize] `` or ``+[load] `` method::
87
+
88
+ @interface TestHelper : NSObject
89
+ @end
90
+
91
+ @implementation TestHelper
92
+
93
+ + (void)initialize {
94
+ if (self == [TestHelper class]) {
95
+ FOXSetNumberOfTests(200);
96
+ FOXSetMaximumSize(50);
97
+ }
98
+ }
99
+
100
+ @end
101
+
102
+ Using compile-time settings or macros, you can conditionally customize the
103
+ values as needed.
104
+
105
+ Configuration Priority
106
+ ----------------------
107
+
108
+ Even though Fox accepts many different ways of setting global configuration,
109
+ there is a specific ordering Fox checks for configuration values.
110
+
111
+ The priority that Fox takes for these configurations are in order:
112
+
113
+ 1. The per-assertion configuration if provided.
114
+ 2. The environment variable overrides if provided.
115
+ 3. The setter function values are used if provided.
116
+ 4. Fox's internal default values are used.
117
+
72
118
.. _Random Number Generators :
73
119
74
120
Random Number Generators
0 commit comments