News for hackers. Stuff that matters.
Re:It's not what programming languages do, it's what they sh... by pjc50 on Friday March 27, 2020 @02:35AM (#22700810)
> This is only true in a case where you don't spin up and tear down your program per test case.

Well, yes, but then the unit tests end up taking twenty minutes.

Re:It's not what programming languages do, it's what they sh... by nybble41 on Friday March 27, 2020 @07:02PM (#22707679)
Not only that, you also can't trust that the test results will apply to any situation where the user doesn't restart the program after every action—i.e., to normal operation.

Don't restart the program between tests. Randomize the order of the test cases between runs. Try running the same test multiple times on occasion.

Re:It's not what programming languages do, it's what they sh... by taeric on Friday March 27, 2020 @11:53PM (#22709088)
You shouldn't have your tests artificially limit the life cycle of parts. Either for artificial reuse or artificial termination.

To that end, if you have variables that live as long as your program, or longer, have your tests reflect that.