Do you create tests for your apps?

4 posts / 0 new
Last post
walkero
walkero's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2009-05-03 16:54
Do you create tests for your apps?

For the last few days I am interested in unit testing and I am learning how to do it with my C projects. I found a few libraries that help a lot with that. Some of them are huge and some are pretty minimal.

But I wanted to ask you if you do create unit tests for your applications, and if you do, what do you like to use?

OldFart
OldFart's picture
Offline
Last seen: 4 months 2 weeks ago
Joined: 2010-11-30 14:09
Re: Do you create tests for your apps?

@walkero

Do you create tests for your apps?

Sometimes, when data handling is involved in the vein of a string of text that has to be parsed or an integer's value that requires further investigation and the rules of manipulation are unclear, I isolate the code/function involved and apply unit tests to it.
Furthermore I rely on using the software myself (for a considerable time) before an eventual release.

Huge parts of my code consist of code that I have 'BlackBoxed': code that has proven to work and can be used over and over again without modification. These parts typically involve (the generic parts of) WIndow, Gadget and Menu handling, DropZone handling and many other aspects. Most of these files are not simply copied, but made available in a project by a (soft-)link. This saves me from a lot of hassle like debugging due to duplication.
I also use considerable amounts of macro's as they make my life really easy. Many of them have been born due to a repetitive type oferror occurring.

OldFart

Hans
Hans's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2010-12-09 22:04
Re: Do you create tests for your apps?

@walkero

I have an extensive set of automated tests for Warp3D Nova. I'd like to do more testing for my other software, but it takes time to write.

I don't use any unit testing libraries (for C/C++).** Instead, I have a *.sh script that enters testing sub-directories and executes a "make runtests" in each. The test prints any failures, along with a final tally of successes & failures. The test program returns a status value in an ENV var to indicate success, failure, or warning. That way, the script can provide a final tally of how many test sets completed successfully.

Bear in mind that not everything should be tested. One mistake people can make with "Test-Driven Design" (TDD), is writing tests for internal implementation details rather than the intended behaviours. That's a bad idea, because you'll have to rewrite tests every time you change anything. Tests should check that API's work as documented, or that the application works as it should.

Hans

** NOTE: If I were writing code in Rust, Ruby, or other languages that have unit testing built-in, then I'd probably use that.

Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work

walkero
walkero's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2009-05-03 16:54
Re: Do you create tests for your apps?

Thank you guys for your replies.
I surely believe that any automatic testing is more necessary than having any. There are some libraries that help in this direction. I will see which one will be easier to use for my Amiga projects

Log in or register to post comments