Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/402b20ad-c01f-45f1-9743-05eadb1f710e@37.6
For more complex testing, TestCase provides the void fail(String failResponse) method. Calling this method will immediately cause the test method to fail and the failResponse string will be displayed. Since this method does not know the actual or expected results, the failResponse string should contain more detailed information about what exactly failed and how it failed. In the next screen shot is an example of using fail(...) where the test code was written such that it would fail:
Using fail(...) in a test method
Figure 7.5 The ***fail(...)*** method immediately throws an error exception when it is executed.
- 1401 reads