Closed AkashKumar7902 closed 12 months ago
@Rune-Christensen Hey In the testconfig.properties file, what value should I set for cobolcheck.unmock.call.alerttype.error ?
@Rune-Christensen I am currently asserting the error messages, if you want me to assert warning messages as well I would like to know which logging library would be best. Thank you
Hi @AkashKumar7902 We discussed this issue. And have decided that this is the wrong approach. Sorry for not figuring this out sooner. The work you have done is great, and the tests are spot on, thank you.
COBOL Check should not be issueing warnings or errors for unmocked call statements, while it is processing the unit test and COBOL source. This could result in confusing the end user, because of a requirement to mock every call, even though the call is not used in the unit test.
Instead COBOL Check should add code to the resulting COBOL code that will cause the unit tests to fail, when the user is trying to run a mocked call statement.
It should be possible to enable and disable this, using a configuration variable, that is set to default true. (true means create the error)
Examples: A call that is not mocked:
100-Demo section.
Call 'dummy'
.
Results in:
100-Demo section.
* Call 'dummy'
Add 1 to number-of-errors
display "Call not mocked in testcase "testcasename" in testsuite "testsuitename"
display "All used calls should be mocked, to ensure the unit test has control over input data"
The same call that is mocked results in:
100-Demo section.
* Call 'dummy'
Evaluate testsuite and testcase
When "some-testsuite" and "some-testcase"
continue
When other
perform when-other-section
end-evaluate
.
when-other-section section.
* Call 'dummy'
Add 1 to number-of-errors
display "Call not mocked in testcase "testcasename" in testsuite "testsuitename"
display "All used calls should be mocked, to ensure the unit test has control over input data"
.
Again, sorry for not figuring this out sooner. I hope you are not discouraged from trying to solve the issue this way. Thank you
@Rune-Christensen In the example you provided, what role will number-of-errors play ?
@AkashKumar7902
@Rune-Christensen In the example you provided, what role will number-of-errors play ?
It is the variable that has the number of failed tests when the generated COBOL code is running, i believe the actual variable is called ==UT==NUMBER-FAILED
Fixes: #288