As I understood from some Q&A sessions (see this and this), unit tests should be written by developers.
At my previous workplace we tried to give this task to a QA Engineer, but it didn't work. May be because it was already a middle of a project and he didn't have a chance to do a significant code coverage or may be because of another reason.
Do you think it's a bad idea to free a developer from writing unit tests in a such way?
As the role of QA has evolved in the last few years, they not only perform functional and integration testing but also actively participating in unit testing.
Unit testing is a type of white-box testing. Integration testing is a type of black-box testing. It is performed by software developers or even by testers. It is performed by testers.
Unit tests are typically written and run by software developers to ensure that code meets its design and behaves as intended.
Unit Testing is typically performed by the developer. In SDLC or V Model, Unit testing is the first level of testing done before integration testing. Unit testing is such a type of testing technique that is usually performed by developers.
Generally, I think it is a bad idea. Unit tests guide the developer to write modular (and therefore useful, reusable) code because their code needs to work with both the production system and the test code.
There's a subtle but important difference between the intent of unit tests and QA tests: QA testing validates functionality; unit testing validates design. That is, the outer view contrasted with the inner view of the product.
QA people are unfamiliar with the internal design of the product, which is intentional because they have to mimic the user's perspective. Developers, on the other hand, know intimately the inner workings and it is to them a mechanism to validate design would be meaningful, if at all.
Hence, it is absolutely natural that developers not the QA folks write unit tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With