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 Engine
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.
A Developer or a fellow developer (code reviewer) should document the Unit test cases which in a way should be based on the Code developed or the Technical Design. However, a QA test cases should be written by the functionl testers that should be based on Functional Design.
The fundamental difference here is that the UT covers logic, internal flow, performance, optimization whereas the QA covers the functional flow to mimick user experience.
I don't think it would be bad, I just don't think it would be possible. If the code wasn't written test first it probably isn't testable.
Is the QA person doing to refactor the code to make it testable?
If so, then that's fine, and I don't care what their title is. If they're not, then I doubt they'll be successful.
The developer has to write the unit tests. Otherwise it is like the developer doesn't have to care about the quality. In addition, unit tests help the developer to write better code.
Maybe you've heard about TDD? "Test Driven Development" is a really a good practice for development. Its main purpose is to develop unit tests before write the actual code (which is a strange thing, when we start using TDD, I admit)...
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.
Yes.
A developer writes the unittest te ensure that the "unit" does what it suppose to do. A QA person test the whole application.
Besides, a unit test is code, and developers write code. Most of the times QA engineers don't write code.