How often QA engineers are responsible for developing Mock Objects for Unit Testing. So dealing with Mock Objects is just developer job ?. The reason i ask is i'm interested in QA as my career and am learning tools like JUnit , TestNG and couple of frameworks. I just want to know until what level of unit testing is done by developer and from what point QA engineer takes over testing for better test coverage ?


Edit : Based on the answers below am providing more details about what QA i was referring to . I'm interested in more of Test Automation rather than simple QA involved in record and play of script. So Test Automation engineers are responsible for developing frameworks ? or do they have a team of developers dedicated in Framework development ? Yes i was asking about usage of Mock Objects for testing from Test Automation engineer perspective.

  • I never had to use mock objects on higher levels of testing... At those levels I am testing actuals and not mocks.
    – c_maker
    Commented Feb 13, 2011 at 20:08
  • 1
    I've used mocks for component integration testing - use two concrete components, and mock the others. Usually the developer unit tests I see just cover one component at a time, so some integration testing between them can be good. Commented Feb 14, 2011 at 20:27

4 Answers 4


First question: do you want to use xUnit frameworks, mock frameworks, and write code?

If not, don't bother. 90% of jobs for testers doesn't include writing code, so if it is not something you are looking for, you can skip this set of knowledge.

On the other hand if you like writing code, somehow you don't think about being developer, there is possibility to work on test automation which will require coding skills. Particular programming language will depend on the toll/application stack but you will be required to write code.

As for xUnit frameworks, probably you won't write unit test (as mentioned dev job), but it is possible you will be using them as runner for your tests. For example Selenium that was mentioned here doesn't require coding skills if you use SeleniumIDE which is only one of products. If you use SeleniumCore - than you are using api that wraps around browser. In this case you write code that will perform tests on given application. And if you put this code into xUnit framework you will have runner, reports with it.

As for mock objects you will be using them in very rare situations. Maybe when you will be building automation framework for your app. But depending on the approach you can skip it.

EDIT As per new answers and edit of the main question. I agree with c_maker - you probably won't be writing unit tests for application code, but it is possible to write unit tests for your automation framework software is software iven if it is software testing other software. Here again as c_maker said, if you wrote gui level tests with selenium using Selenium - those are acceptance tests not unit tests.
Anyway check following links so you will now how work of test automation engineer may look:
- Quick overview
- Bigger explanation
- Inspiration for all above and few pdf describing it

  • @yoosiba edited my answer for more information.
    – SuperMan
    Commented Feb 13, 2011 at 18:10
  • @yoosiba Neat !!
    – SuperMan
    Commented Feb 13, 2011 at 21:22
  • 1
    Yes it is. :) First time I saw it I was amazed. Now it seems the only way to do test automation.
    – yoosiba
    Commented Feb 13, 2011 at 23:21
  • 3
    I work as an SDET, which is a job title for many coding-intensive test positions. I currently spend about 50% of my time on coding / development activities, setting up a framework for our organization. I actually use mocks for component integration testing, where I will mock most components but test for the interactions between just two or three components. I can do more setup-intensive tests for just one component as well, such as install / uninstall code that doesn't run quickly enough for unit tests. Commented Feb 14, 2011 at 20:34
  • @Evans u must have put ur comment as one of the answers ,i would have voted :)
    – SuperMan
    Commented Feb 14, 2011 at 20:57

Short answer: It depends on the organization.

Long Answer: Without polling tons of companies, it's hard to quantify how often QA teams get involved with writing tests that involve mock objects. In my experience, most small-to-medium software development companies tend to lean on their developers to write unit, integration, and UI tests. The QA departments in such firms usually test new features and enhancements as well as whether defects were fixed (ideally, your tests are doing this, but in practice, not every developer writes a test to check against the defect they just fixed).

Many larger companies will employ QA teams with programming experience. Such teams are known to write UI tests (such as Selenium for browser applications) as such tests don't require knowledge of the code to check functionality; UI tests typically check expected UI responses versus actual responses.

In some cases, the QA team will contribute to writing unit and integration tests as well, although in my experience it's rare to see QA being completely responsible for such tests. Typically-speaking, it's going to be easier for the developers to write tests. That said, a QA team member who illustrates understanding of the code and ability to write unit and integration tests (including utilization of mock objects for such tests) would quickly become a leader in such a department.

Recommendation: You should focus on learning good UI design and practices, testing for common and boundary cases, and obtaining an understanding about user experiences and expectations in general as a basis for your QA career. However, learning about the development side of QA (i.e. writing tests with and without mock objects) will definitely help your career. If you have the time, learn it.

  • Neat explanation, wish i can vote twice !!!
    – SuperMan
    Commented Feb 13, 2011 at 6:32

Here are a couple of points why QA cannot and should not write unit tests:

  • Unit tests are extremely close to production code. In order to write unit tests you need to understand what the code does exactly. QA people usually do not have the qualifications for this. If they did, they would be developers.
  • Unit tests also evolve with the code. They need to change when the code changes and they need to be committed to version control together. It would be a nightmare to commit something and wait until someone fixes up the unit test. This would mean that unit tests always fail. Imagine... you commit code, someone else does an svn up and tests fail. Continuous integration is also impossible this way.
  • Unit tests do so much more than just check whether the code works. In TDD, for example, unit tests help us achieve a better design.

Another thing to point out. Just because you write tests in a unit testing framework, it does not mean they are writing unit tests. Our team for example uses the Junit framework together with Selenium to write acceptance tests. It would be OK for QA to write these tests.


Developers should be the ones writing unit tests, since they are the ones most familiar with the code. Unit tests should be written before, during, or soon after code is written. As a result, the developers should also be creating mocks (and most people use a framework these days, so it is not really a time-consuming activity).

QA could possibly be responsible for different kinds of test doubles involved in larger system tests. For example, if an application depends on hardware devices, they could help with simulation software. However, I haven't personally noticed QA get that involved with programming tasks. QA can create integration tests, but they still usually depend on developers to write test fixtures for them to hook into.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.