You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A test fixture can contain 1 or mote test cases. Test cases are discovered when execute_tests() is called on the test fixture. Every test case is comprised of 2 required and 2 optional methods and are discovered by the following convention: prefix_testname, where valid prefixes are: before_, run_, assertion_, and after_. A test fixture that has run_fred and assertion_fred methods has 1 test case called 'fred'. The following are details about test case methods:
111
+
A test fixture can contain 1 or mote test cases. Test cases are discovered when execute_tests() is called on the test fixture. Every test case is comprised of 1 required and 3 optional methods and are discovered by the following convention: prefix_testname, where valid prefixes are: before_, run_, assertion_, and after_. A test fixture that has run_fred and assertion_fred methods has 1 test case called 'fred'. The following are details about test case methods:
112
112
113
113
*_before\_(testname)_ - (optional) - if provided, is run prior to the 'run_' method. This method can be used to setup any test pre-conditions
114
114
115
-
*_run\_(testname)_ - (required) - run after 'before_' if before was provided, otherwise run first. This method typically runs the notebook under test
115
+
*_run\_(testname)_ - (optional) - if provider, is run after 'before_' if before was provided, otherwise run first. This method is typically used to run the notebook under test
116
116
117
-
*_assertion\_(testname)_ (required) - run after 'run_'. This method typically contains the test assertions
117
+
*_assertion\_(testname)_ (required) - run after 'run_', if run was provided. This method typically contains the test assertions
118
118
119
119
__Note:__ You can assert test scenarios using the standard ``` assert ``` statement or the assertion capabilities from a package of your choice.
120
120
@@ -144,7 +144,7 @@ print(result.to_string())
144
144
145
145
### before_all and after_all
146
146
147
-
Test Fixtures also can have a before_all() method which is run prior to all tests and an after_all() which is run after all tests.
147
+
Test Fixtures also can have a before_all() method which is run prior to all tests and an after_all() which is run after all tests.
148
148
149
149
```Python
150
150
from runtime.nutterfixture import NutterFixture, tag
@@ -162,6 +162,42 @@ class MultiTestFixture(NutterFixture):
162
162
…
163
163
```
164
164
165
+
### Multiple test assertions pattern with before_all
166
+
167
+
It is possible to support multiple assertions for a test by implementing a before_all method, no run methods and multiple assertion methods. In this pattern, the before_all method runs the notebook under test. There are no run methods. The assertion methods simply assert against what was done in before_all.
168
+
169
+
```Python
170
+
from runtime.nutterfixture import NutterFixture, tag
0 commit comments