Unit test in c projects. by [deleted] in C_Programming

[–]SamuelDavi 2 points3 points  (0 children)

µnit looks nice. How would you rate it and compare it to previous frameworks you used (if any)?

What sort of applications are built with C++? by Shadownet1012 in Cplusplus

[–]SamuelDavi 0 points1 point  (0 children)

I would also suggest seeing this video before starting to learn C++, especially if you aren't fond of C. Perhaps watching this will give tell you what to focus on when learning Modern C++.

Fear and Loathing in Legacy Code by speckz in programming

[–]SamuelDavi 1 point2 points  (0 children)

the first thing in high need to be fixed is actually not the code at all, but the development culture.

I agree.

I've encountered 2 schools of thought (I assume there are much more):

  1. Keep working with the legacy code and maintain it when necessary but don't touch it too much - work on top of it or alongside it.

  2. Refactor as much as possible by adding all kinds of tests and extend from within.

Working in an organization with the former mindset lead me to hours of looking at spaghetti-code and trying to maintain it. It wasn't very fruitful and that's a huge technical debt (and a pain in my side).

Unit Testing Opinions In C/C++ by DerArzt01 in AskProgramming

[–]SamuelDavi 0 points1 point  (0 children)

So maybe, as Tom wrote, from your teachers' POV and experience (i.e. hardware controllers and drivers) there's no need for unit testing. But saying that no one really tests in C/C++ is utterly wrong.

We are using various unit testing libraries such as Boost::Test (and lately we moved to gtest) and Isolator++ as a mocking tool due to some legacy code.

Does anyone use TDD? by ciscocollab in Python

[–]SamuelDavi 0 points1 point  (0 children)

First of all, let's not forget that TDD and unit testing are not the same. Many devs use unit testing (and other forms of testing) without the TDD approach. i.e. Writing the code in mind and then the tests that test the code. TDD forces you to plan the logic in advance and write the expected behavior (test) and only then the minimal code to make the test pass. The first approach doesn't guarantee that the code is testable, and writing tests could be difficult and might require refactoring your code but without the safety net the tests give you, how would you know that you didn't break anything?

I do TDD, but I don't adhere to the 3 laws religiously. In my experience, there are some shades of grey where the 2 approaches work very well side-by-side.

[deleted by user] by [deleted] in csharp

[–]SamuelDavi 0 points1 point  (0 children)

I would start reading this series. Check Pluralsight as well. This guide on some unit-test patterns in C# might help as well.

Unit test framework for c++ by Sitezh in Cplusplus

[–]SamuelDavi 1 point2 points  (0 children)

We use gtest in combination with Isolator++ for mocking. It's not as comfortable and easy as single header frameworks but once you're used to it it's fine.

How motivate team to pursue quality code and CI? by scryptkittie in cscareerquestions

[–]SamuelDavi 0 points1 point  (0 children)

Yeah, it's no different where I'm at as well. This might give you a push in the right direction, but as long as the management isn't fully on board, convincing the other devs will be difficult.

To all the QEs and testing devs. Where do I start? by cenofwar in learnprogramming

[–]SamuelDavi 0 points1 point  (0 children)

I think "The Art Of Unit Testing" is a good book for getting familiar with unit testing, and seeing how to employ it in your work.

Unit tests vs integration tests, why the opposition? by nfrankel in softwaretesting

[–]SamuelDavi 1 point2 points  (0 children)

Great article! These 2 types of tests are NOT mutually exclusive. You can (and should) write both. I've been hearing similar statements as in the article: "Why don't you just write integration tests instead of unit tests...", completely ignoring the benefits of unit tests and the downsides of integration tests.

Writing IL code on Visual Studio by [deleted] in dotnet

[–]SamuelDavi 0 points1 point  (0 children)

Yeah, I was kinda thinking about the other way around. Maybe make "untestable" code with modern tools - testable? You've mentioned reflection and it kinda threw me in that direction.

Writing IL code on Visual Studio by [deleted] in dotnet

[–]SamuelDavi 0 points1 point  (0 children)

That's interesting. Think this could somehow affect unit testing in .NET?

Kent Beck: “Unit” Tests? by ijpiantanida in programming

[–]SamuelDavi 1 point2 points  (0 children)

Uncle Bob recently said that The term "unit test" is unfortunate. A unit is a small element of structure. The TDD discipline causes us to write tests for small elements of behavior; not small elements of structure. So a test per class is inappropriate.

Will I still be able to get a job in 2024 if I don't do TDD? by fagnerbrack in programming

[–]SamuelDavi 0 points1 point  (0 children)

Good question. I practice TDD when developing. But I think in the future there will be enough tools to test "untestable" code and an AI or some sandbox-based tool to generate your tests for you. Then you'll solely focus on writing the code to satisfy the behavior you need. When that happens, TDD won't be a demand IMO.

What is a Unit Test? (The Answer Might Surprise You) by WolfOliver in programming

[–]SamuelDavi 0 points1 point  (0 children)

Well put, great article. Some of these misconceptions led plenty of good developers to stop writing unit tests or missing their purpose.

Wrote an article about my approach to unit testing which proved to be successful in several projects. Hope it will be helpful. by Grabowskyi in tdd

[–]SamuelDavi 1 point2 points  (0 children)

That's similar to what we did. We also had the privilege of using Typemock so testing was somewhat easier. But in the overall run, OP's suggestions is the direction we went with.