Don't tell me you are one of those people that do not write unit tests user

Don't tell me you are one of those people that do not write unit tests user.

Most of the projects I have been put to work on that do not have unit tests have failed horribly.

What do you mean by "write unit tests"?
I test all my functions if that's what you mean.

WTF is a unit test?

Cost Estimate? Technical Specs?

How do you test your functions?

Same as everything else; isolate them and give them all kinds of imaginable inputs and see if it explodes or not. Writing test code to test same functionality over and over again seems a bit redundant and time that could have just been put to several regular testing sessions.

But that's all test code is. Wouldn't you rather save that work you've done to test the function and automate checking it after revisions to your codebase (in case you restructure or refactor some logic)?

I write good code, instead

This is a very dangerous approach to testing and I would advise you to do some research on it.

Yes, with the horrible IBM RTRT...

No. I'm just a hobbyist, and will just try to break it with different input then call it a day.

>not using BDD as your way to develop
Why live?

Fuck bdd/tdd. Write good code, if it's going to stick around write some tests for it. Why is that so difficult? Why do these stupid programming memes gain so much clout?

Reliability. Why guess that your software is correct when you can prove it is correct through a systematic approach.

Tests are such a fucking pain. Every time I need to make a change to a codebase 30% of the time is on the change itself and 70% of the time is fixing the old tests.

Some numale wanted to get rich so he wrote books and made millions in consultancy fees to large companies that fell for his "techniques".
Namely, repeatedly testing working code over and over is a waste of resources.

They also like to use the term "code coverage", insisting that every single function must be tested.

>people who have been in the industry for 40+ years
>numales

Because time is money and writing tests before logic leaves you with bloated shitware. I'm pretty sure most people support this time suck so that they can look busy on github or rip off clients by billing 2-3x the hours that they should have. Automated testing is great, but tdd is garbage and retarded for 99% of projects. It's up there with using reactjs for your blog.

>unit tests
>code coverage
>code smell
>code correctness
>type safety
>unsafe code
>raw pointers
>raw memory
>agile storyboard
>10x programmer
>full stack developer
>rockstar developer

I program exclusively in Common Lisp and Clojure. I don't need unit tests. I simply load the function in REPL, and give it tons of parameters in for example loop macro and maybe run trace on it.

Explain how that actually differs from unit testing. I'm curious. I kinda know what unit testing is and that seems awfully lot like unit testing, just with live code and without compiling.

I was always scared of the phrase "unit testing" because I didn't know what it was, I got my first job without knowing and quickly realized "unit testing" is just a buzzword for making sure your code works.

Time is money and fixing bugs after development and module integration is a lot more expensive (in time and money) than detecting bugs as you prepare to commit code.

That's unit testing, it's just not automated.

And you think the time spent writing those tests and fixing them after every change to the codebase is free?

Unit testing does exactly what you're doing, but you run one command and all your saved tests run one after the other. You do this every time you change, refactor or add functionality to make sure nothing broke that you tested last week, saw that it worked and moved on from. Also certain frameworks allow you to estimate code coverage, ie what percent of your code is examined when you run your unit tests. The more the better obviously.

If you have to change the tests frequently, you're writing poorly organized code. If you split things into specific functions, you know there's only so many correct results when you run resetTimestamp(). If you write that as an undifferentiated part of some 200 line main() of course it's going to be hell to test.

Why do you need to test something as simple as resetTimestamp? What if you need to change the format of the timestamp? Then you have to go into every other test that uses resetTimestamp and update the expectations.

Depends on the project.

For something like Haskell, I build in static protection

For something like python, I use unit testing (because there's no other way to make python code work well)

For other projects (especially very complicated ones) I mostly rely on manual testing.

It's because of scripting languages like python that are so rotten to the core that you need to plaster on 20 layers of bdd testing to make sure you didn't typo a variable name

>ITT: neets who have only coded Fizzbuzz

Unit tests are a massive help in developing evolving, increasingly complex software. TDD is boner-inducing anyway

That makes sense if you're constantly rewriting the same code over and over but if you're actually working on something interesting and new your code is going to be unorganized before its finished.

The cost of writing new tests earlier in the development cycle is much lower than fixing bugs later in the development cycle. Guaranteed.

Enjoy writing all those mockup classes

This

You don't unit test spiked code, and you use TDD to make sure everything is organized

Only until the requirements change, and now all your code and tests are thrown away.

>unit tests
why does this even exist?

If you don't trust the other devs on your project, you pepper your code with static_asserts.

Otherwise, you isolate specific functions and write code to simulate worst case scenario input.

You unit test it when it's not 'spiked code' anymore. Why throw it away when you can evolve it? See tdd is all about wasting time and pretending to be productive. It's not pragmatic at all.

>evolve spiked code
You have not worked on an organized large piece of work

>wasting time
>what is scalability and long-term effect
You have not worked on an organized large piece of work

The company I used to work at before had the majority of their projects without tests, and 1 large project with tests. It was VERY easy to understand the importance of tests when we needed to add to the large project, whereas the other projects were painful to make even the slightest changes

>unit tests are the same thing as tests

Unit tests is how numale cucks feel useful in a software company where all the important design decisions are handed to the college educated CS hires.

When I say 'tests', I was referring to unit tests

Ahh yes. You make on tiny change that you know is harmless and now have to go fix the 400 tests that failed.

>400
I said organized code. And we also said unit tests, not e2e. Otherwise your unit tests aren't 'unit' anymore

If your system is so ill-defined that you're expecting to change requirements often DURING development, then I understand the hesitation in writing formal tests. The prototyping approach to development is understandable until you've got enough knowledge to formalize your specs. After that, you better be sure that the specs change in minor details.

Oh right. Let me just write a 200 line class to "mock" out this dependency in a unit test.

Not sure why you'd mock an entire class. Having that much of a dependency is not organized

Have you ever written anything more complicated than a fizzbuzz?

I totally didn't believe you until I clicked through to see the whole thread. Christ these idiot children.

I don't unit test though. Because my job is maintaining a pretty massive chunk of hoary archaic code that is pretty resistant to being broken up conveniently. Maybe in six months we won't be running from one fire to another, but until then we're stuck with this.

Yes, the project I worked on involves about 20-30 programmers, ships weekly and is automatically tested through Jenkins a couple times an hour, about every code push. Why?

I get you. Unit testing a monolithic untested piece of work is not fun. I decided not to do it for those old projects, but thankfully left the company for one that let me start things from fresh and had unit tested projects already

If I could redesign it, I'd refactor it into an MVC architecture.

>not proving your code correct by construction and extracting formally verified modules

Have fun proving your XML driven server to client communication works.

While you're at it, prove that your disk can't fail at any moment.

>doing dumb, archaic shit
this is Cred Forums alright

>Have fun proving your XML driven server to client communication works.
What's the problem?
>prove that your disk can't fail at any moment.
Why don't you go ahead and write a unit test for that? The point is not to prove that the program behaves correctly it all times, but also that it handles failure, be it software or hardware, gracefully.

Whoops, I thought this was a thread about unit testing, which is one of the most archaic processes in the history of programming.

>unit testing is archaic
lmao

Repeating the same test results in your programs is not always the best option. Consistency is not key when you're not making the same program.

>What's the problem?
The problem is that the server is best effort. How are you going to prove things then?

statistics my man.

Proves that it is best efforts.
>We are not working with text books no more
>You need to ensure it is best efforts and not a bandwidth slut.