Who should be responsible to write test cases? [duplicate]

Should tests in some project be written by the actual person that does the coding (usually senior in our team) or it can be done by junior coders with less experience?

12

There is no single answer to this question. Obviously, if you’re a business with a single developer then the developer should write the tests. If you’re an organization of a thousand developers, the answer will be different.

Assuming a “normal” team with a few developers and possibly a few people dedicated to testing, it goes something like this:

  1. developers write unit tests
  2. developers and/or QA write integration tests
  3. QA writes acceptance tests

In the scrum model, there is no distinction between “developer” and “QA”. The team as a whole is responsible for the quality of the software, and the team decides on a case-by-case basis who should be doing the testing.

Many smart people think developers should write all their tests. I’ve worked in organizations like that, and we always delivered exceptionally high quality software. In those companies, not only should senior devs write tests, they must.

Other very smart people believe that developers should not test their own code because they have blinders on. “I don’t need to test X, my changes couldn’t possibly have affected it”. To combat that you should always have someone else write the tests. I’ve worked in those types of organizations, and there, too, we also delivered high quality code.

The bottom line is that if you’re a developer, you are ultimately responsible for the quality of the code you produce. That means you should be writing tests — regardless of organizational structure — and if you have other team members, then you should work with them to make sure the code is properly tested.

In practical terms, the only people who can answer this for you is you and your team. It’s perfectly reasonable for senior level programmers to write tests (and if they are good programmers, you won’t ever have to ask them to do it because that’s just part of the job). It’s also perfectly reasonable for junior people to write tests — this is a good way for them to learn the software.

In either case, there is no should. You should do whatever allows your team to create software with an appropriate level of quality.

4

Edit: I read the title as unit tests:

I have heard this idea before, and IMHO I think it is a terrible idea to force unit testing solely on junior developers.

You would be creating an unnecessary division in your team.

Developers should write unit tests for their own code. Both the code and unit tests will then in the future be updated by other developers as features changes and bugs are discovered depending on resource availability.

Not trusting juniors with real features is not the best way to manage projects. Start them on smaller or easier features, let them unit test them, and they can work their way up to bigger, harder features.

2

Ideally, in test driven design, the test is written before a single line of code is written. Someone writes the failing test, someone writes the code (that passes).

In this model, it doesn’t matter too much who writes the test (or who does the code). What is required is that the test accurately describes the functionality to be written before writing code. If this understanding of the requirements requires a senior programmer, then that is who writes it.

However, once the test is written, if it was well written, anyone should be able to write the code for it that passes the test. If anything, this points to that seniors should be writing the all tests and then delegating out the coding of the guts of the code to other people who can do it.

After the fact unit testing is.. less than ideal. Unfortunately, when this happens this is often left to the juniors to “get the required coverage.” Such endeavors are often difficult because they are tedious and don’t fully test the code in question (leaving bugs that get scapegoated on the person who wrote the test for not catching it).

It is great having junior programmers gain experience with the code base. Forcing them to write after the fact unit testing isn’t the way to do it.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật