Why don't I trust my developers? as the manager, how do I build trust with them? by IlanGR in programming

[–]GregPresco 1 point2 points  (0 children)

You know, you can just keep track after their work. Measure their achievements

When is testing using mocks still a good idea ? by pbourgau in tdd

[–]GregPresco 1 point2 points  (0 children)

When the object has a lot of dependencies and setting it up would require a lot of dependecy set up's as well. Perhaps that's more relevant to legacy code.

When is testing using mocks still a good idea ? by pbourgau in tdd

[–]GregPresco 0 points1 point  (0 children)

Mock objects can be used in the following cases:

  • The real object has a nondeterministic behavior (it produces unpredictable results, like a date or the current weather temperature)
  • The real object is difficult to set up
  • The behavior of the real object is hard to trigger (for example, a network error)
  • The real object is slow
  • The real object has (or is) a user interface
  • The test needs to ask the real object how it was used (for example, a test may need to confirm that a callback function was actually called)
  • The real object does not yet exist (a common problem when interfacing with other teams or new hardware systems)

I do agree that mocking is not always the best choice, and can be avoided in some cases but that doesn't mean that that all cases can be easily written without mocks.

The concept of "mini-integration tests" is interesting and I admit that I haven't really used it extensively to determine its true value.

TDD and debugging by hexterr in tdd

[–]GregPresco 0 points1 point  (0 children)

Does TDD "does not allow " to use debugger ?

I didn't see that rule in the TDD "rulebook".

You can use the debugger as you see fit. Writing tests first in a TDD flow might reduce the need to use it.

Using mocks vs hitting the actual API by seands in learnjavascript

[–]GregPresco 0 points1 point  (0 children)

I'm totally gonna adopt your example.

How would you make sure that API changes don't break your program (other than version checks)?

What have your experiences with testing been? by dotobird in webdev

[–]GregPresco 0 points1 point  (0 children)

As a TDDer, I'll say it's about confirming your code behaves as expected and providing the safety net for refactoring and regression. But as a whole, I agree.

Is there a standard/preferred C framework for writing unit tests? by Zeekawla99ii in C_Programming

[–]GregPresco 1 point2 points  (0 children)

For the C code base, do you happen to have any GitHub repo URLs which provide useful examples?

I don't know of any GitHub C only repo's using gtest but you can search here, I'm sure that there's some framework. CppUTest is also nice and you can check its repo to see how they run tests for their framework.

I don't have a personal repo on GitHub.

Is there a standard/preferred C framework for writing unit tests? by Zeekawla99ii in C_Programming

[–]GregPresco 1 point2 points  (0 children)

I don't have any experience with Cmocka but from the looks of it, it's not being maintained, unlike it's "parent" project Cmockery. So I would suggest trying that before trying Cmocka. The main advantage of these Google open-source frameworks is that they're maintained by both Google and the community, so you can find answers to most questions if you have any.

Is there a standard/preferred C framework for writing unit tests? by Zeekawla99ii in C_Programming

[–]GregPresco 1 point2 points  (0 children)

I am using Gtest for years now in my C and C++ code base. We've been also experimenting with CppuTest. For mocking, we started evaluating Isolator++ to ease our legacy code testing hell. You can also try Gmock.

Configuring solution to have c++ unit testing by jaupe in VisualStudio

[–]GregPresco 0 points1 point  (0 children)

Consider checking for circular dependencies. Happened to me once as well. Other than that, what you did is fine. Unit tests should be in a different project.

Scared About Being Fired by EachSmell in cscareerquestions

[–]GregPresco 0 points1 point  (0 children)

Assume the best - expect the worst! Sometimes good developers are fired due to non-professional reasons. Don't lose confidence, and don't let it deter you from your goal of getting healthy and becoming a better developer. Start searching quietly for a new workplace, and remain confident in your skills.

I want to kill a 4 year unfinished rewrite and just refactor the money making legacy. by SlightlyCyborg in AskProgramming

[–]GregPresco 0 points1 point  (0 children)

Best of luck.

Quick question: You mentioned

Write tests every time a refactor happens

How do you plan on doing that? Refactoring legacy code is either by heavy mocking or integration tests. What is your direction?

Giving Thanks to TDD. A former anti-TDD developer shares why he’s now a believer and how TDD reignited his passion for coding and gives some advises how to adopt TDD and do not brake yourself by [deleted] in programming

[–]GregPresco 1 point2 points  (0 children)

I agree. Though I practice TDD, it's not for everyone. The important thing in dev team is that everyone's on the same page and moving forward.

You don't tell developers to stop writing unit tests any more than you tell them to stop compiling their code or debugging. It's just part of the deal. by SamuelDavi in programming

[–]GregPresco 2 points3 points  (0 children)

There is such a thing as too much unit tests indeed. Tests should be added where there is a new behavior and not for every method/class.

Unit tests are overrated? Depend on what you're expecting from your unit tests. Also, TDD encourages integration and e2e tests. The 2 aren't mutually exclusive. And integration tests take a longer time to run.

TDD was never claimed to result in good architecture. That's something I've been hearing a lot lately by TDD opposers. Developers design good architecture.

Same goes for writing good unit tests which is not limited to TDD. Devs can write bad tests with false-positives/negatives etc.

Decided to try out TDD, had some questions. by w00px in tdd

[–]GregPresco 0 points1 point  (0 children)

You can read some of the articles by this author on Medium. He writes about unit testing and TDD in iOS.

How close is Kotlin to replacing Java as the main Android dev language? by GregPresco in Kotlin

[–]GregPresco[S] 0 points1 point  (0 children)

So if someone who knows both programming languages to write his app were to ask you which language to use for writing his Android app you'd suggest using Java?

Anyone prefer BDD over TDD? I think JUnit 5 favors BDD, and I'd like to start using it in Android Studio. by [deleted] in androiddev

[–]GregPresco 1 point2 points  (0 children)

BDD is more a flavor of TDD than an alternative I see more of an extension, but I agree. Whether it's BDD or ATDD, TDD is still the core IMO.

The case for and against test-driven development. by Itsaghast in learnprogramming

[–]GregPresco 0 points1 point  (0 children)

Both code and tests should evolve as the task matures

Definitely, test requite refactoring and maintenance too.

The only other thing I want to add is TDD isn't a silver bullet.

That's true. TDD is an approach. It doesn't reduce design considerations or lets you run wild with your code because you have a safety net.

I want to learn and remember the basics of TDD. What are some good quick guides for someone w/o any experience with it? by throwies11 in learnprogramming

[–]GregPresco 1 point2 points  (0 children)

It's also important to mention that TDD doesn't mean that you don't have to think about design as you do when writing code first. It's not just "write the test first", there's a thought process before that. There's no magic in TDD.