#Test-classes best practice

23 messages · Page 1 of 1 (latest)

wooden minnow
#

What’s the best practice for writing test-classes while the project is still developing a lot?

#

Do you keep updating it for every new iteration of the program or do you just ignore it and do a full rework at the end

nimble socket
#

What exactly do you mean by “test class”

wooden minnow
wooden minnow
#

So just some code with Test cases however you want to call it

granite sierra
#

but I'm a big hater of tests in general

#

if it's actually hard and complex I write tests for the actual logic

wooden minnow
#

Then ima leave it fs

#

I hate it too💀

granite sierra
#

It's not even about just hating it but I don't see the point in most tests

nimble socket
#

I write tests that ensure the behavior is what I want it to be. This way if I change the implementation the tests will still be valid since the behavior likely isn’t going to change

wooden minnow
nimble socket
#

Do you know how a set part of your code will behave? X goes in Y comes out? You can test that

#

Check that when X goes in that Y comes out, that’s a test

#

If your code base is so unstable that you can’t pin down anything that’s consistently going to be X->Y then maybe you don’t have a clear enough picture of what you’re trying to build

wooden minnow
#

But thank you guys I was familiar with the theory behind it but I was just wondering wether and/or how people actually implement it, also watched some videos additionally

boreal current
#

I am New (A Beginner), I Hope You Can Help Me Run My Project

nimble socket
tardy flame
#

Just about the tests, IMO it only makes sense, when you work with multiple departments or a bigger group on one codebase.
If you build directly modular and entity based (like with classes e.g.) you should test each part individually, so... why writing a test for that? xD After you tested it, it wont be changed. if you run into an error, its not properly entity based and you need to fine tune the architecture.

I think most groups(i include companys in this) use tests, because the project started to be coded before the proper architecture was thought about.

So in short, make a good ground work/build a good base and (most) tests unnecessary.
(also implementing a proper exception ahndeling will do the trick too xD)