dunit

Can I write 'parameterized' tests in DUnit

主宰稳场 提交于 2019-11-29 21:47:20
I am using DUnit to test a Delphi library. I sometimes run into cases, where i write several very similar tests to check multiple inputs to a function. Is there a way to write (something resembling) a parameterized test in DUnit? For instance specifying an input and expected output to a suitable test procedure, then running the test suite and getting feedback on which of the multiple runs of the test failed? (Edit: an example) For example, suppose I had two tests like this: procedure TestMyCode_WithInput2_Returns4(); var Sut: TMyClass; Result: Integer; begin // Arrange: Sut := TMyClass.Create;

Measuring code coverage in Delphi

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 20:20:01
Is there any way to measure code coverage with DUnit? Or are there any free tools accomplishing that? What do you use for that? What code coverage do you usually go for? Jim McKeeth: Thanks for the detailed answer. I am talking about unit testing in the sense of a TDD approach, not only about unit tests after a failure occured. I'm interested in the code coverage I can achieve with some basic prewritten unit tests. Christer Fahlgren I have just created a new open source project on Google Code with a basic code coverage tool for Delphi 2010. https://sourceforge.net/projects/delphicodecoverage/

Measuring code coverage in Delphi

与世无争的帅哥 提交于 2019-11-28 16:19:50
问题 Is there any way to measure code coverage with DUnit? Or are there any free tools accomplishing that? What do you use for that? What code coverage do you usually go for? Jim McKeeth: Thanks for the detailed answer. I am talking about unit testing in the sense of a TDD approach, not only about unit tests after a failure occured. I'm interested in the code coverage I can achieve with some basic prewritten unit tests. 回答1: I have just created a new open source project on Google Code with a basic