DEV Community

Discussion on: Why We Test – Do things faster with Test-Driven Development

Collapse
 
rainerhahnekamp profile image
Rainer Hahnekamp

Thanks Hila. I am currently teaching programming for "intermediate beginners" and my exercises are only handed out in the form of unit tests. So the students get used to work against unit tests from their first line of code.

I know that Unit Testing is teached in universities or similar but it is considered to be more an advanced topic. So you learn it, if you have already experience in programming.

In my opinion it is really hard if you introduce Unit Tests at a later stage, because this usually means that the thinking/approach/mindset needs to be changed.

Coming back to your question: Yes, they should teach it. Absolutely.

Collapse
 
hilaberger92 profile image
Hila Berger

I think it's great you're teaching unit testing!
I agree that it's harder to learn at a later stage. I am a student myself, and my university doesn't teach unit testing.
When I started working I needed to learn about unit testing and it was very hard for me. It took me a while to understand it.
Which language do you teach? do you teach about unit testing frameworks as well?

Thread Thread
 
rainerhahnekamp profile image
Rainer Hahnekamp

Yeah, currently I am teaching Angular and Spring. So TypeScript and Java as programming language. Both have superior testing frameworks like Jasmine/Jest and JUnit & Friends (Mockito, Hamcrest,...).

Honestly, I think that all modern unit testing frameworks share the same mindset. So if you know how to write unit tests and handle mocks/spies properly in one language you can easily do the same in any other language.

Thread Thread
 
hilaberger92 profile image
Hila Berger

I agree, if you understand the principles of unit testing, you can write it in any language.
Have you heard about Typemock maybe? it's a mocking framework for C# and C++. My team and I are working with it and I'm looking for some feedback...

Thread Thread
 
rainerhahnekamp profile image
Rainer Hahnekamp

For C# I am using Moq. Is there any particular reason why you have chosen Typemock?

Thread Thread
 
hilaberger92 profile image
Hila Berger • Edited

We use Typemock Isolator. It's a user-friendly tool, that allows us to mock almost anything we need- private and static methods, constructors, ref and out parameters etc...it also integrates with a lot of unit testing frameworks such as NUnit and MSTest.
So far we are satisfied with the product, but I wanted to hear other people's opinions as well...