-
Notifications
You must be signed in to change notification settings - Fork 29
Assertion Style
Home -> User Guide ->
This document was last updated on February 11, 2021.
Cobol Check supports an "expect" assertion style, similar to RSpec for Ruby, Jasmine for JavaScript, or the Kotest Expect Spec style for Kotlin. It looks like this:
TESTCASE 'IT CONVERTS TEXT FIELD 1 TO UPPER CASE'
MOVE 'something' TO TEXT-VALUE-1
PERFORM 2100-CONVERT-TEXT-FIELD-1
EXPECT TEXT-OUT-1 TO BE 'SOMETHING'
The line "EXPECT TEXT-OUT-1 TO BE 'SOMETHING'" means the framework will compare the value in Data Division item TEXT-OUT-1 with the literal value 'SOMETHING' after executing paragraph 2100-CONVERT-TEXT-FIELD-1. If the values are equal, the test cases passes; otherwise, it fails.
Developers who are accustomed to a particular assertion style when working with other unit test frameworks may want cobol-check to support their preferred style. Developers unfamiliar with unit test frameworks may be surprised at the number of assertion styles that are used in various frameworks.
A variety of different assertion styles are possible, and none of them provides any real functionality that the others do not. The differences are a matter of personal preference. Preferences are often defended on the basis of intuitive assumptions about how particular English words trigger our thinking. There is no science behind such assumptions, as far as we know.
You may have a strong personal preference regarding assertion style. It is feasible to support additional assertion styles with this framework. Feel free to open an issue to request support for your preferred style, and/or initiate a discussion about it on the cobol-check forum.
However, as it does not affect functionality, and cobol-check is currently at an early stage of development, please understand we will not address requests to support additional assertion styles for some time to come. Once we have completed higher-priority development items, we will consider implementing support for additional assertion styles based on user demand.