Can unit testing software be used to unit test itself?

QUnit advertises itself on its web page like this:

…capable of testing any generic JavaScript code, including itself!

Can you really use unit testing software to test itself? Wouldn’t defects in the software mean that the results are unreliable?

2

Yes, it can. JUnit has an extensive test suite to test its own features, and ask any of the authors you like – they will tell you that this is essential to their productivity in extending the project. Probably most testing tools do the same.

The trick is that there is no particular need for a test of a new feature to be actually using the new feature itself – it merely has to exercise it and test the result. In this way, confidence in part of the functionality of a system can be used to establish confidence in a much larger part. This is similar to the way self-hosting compilers are bootstrapped, and it is a fundamental technique in computing theory.

1

Kent Beck’s book “Test Driven Development By Example” does precisely this: as an example of TDD he bootstraps a test framework that right from the beginning is used to develop itself.

2

You are correct, defects in the software do mean that the results are unreliable. However, there is a way to work around it, and build a reliable suite of tests.

The idea is to build a small testing harness that tests the very basic “core” functionality of each component of the testing system (usually, it consists of at least a framework and a runner). If testing framework is flexible enough, you should be able to plug that harness straight into your system, for example, by implementing an interface or by providing a required set of methods in the implementation of your harness.

The rest of the functionality should be tested relying solely on the “core” functionality, which is already tested using the harness. If you take care of using only the functionality from the “core” to test the non-core functionality, you would have a set of tests that you can trust.

I don’t know about qunit, but I have worked several projects where previous versions of a solution were used to validate later versions so I don’t view it as an invalid approach.

Any unit test package in a vacuum with not integration or UAT testing is going to be susceptible to a flaw in the test package itself as well as all the usual integration issues a unit test suite cannot cover so I am not certain I would even go as far as saying self testing on the same version is any more flawed than trusting new unit tests in any other project.

From briefly reading the project’s linked site it more sounds like they are pointing out that there is nothing special case about the test scenario or the targets you can test than they are advertising that a self testing library is a perfect solution.

No you can’t test software with itself, at least not in a way that would be acceptable in an audit situation. Independent verification has become a well established norm because it is far less likely that two different X(people, frameworks, tools) will both make the same mistake/ have the same bugs. This doesn’t guarantee that whatever you test is actually correct, but it does mean there is a lesser chance of incorrectly passing any test. Testing something with itself can’t actually increase your confidence that it works correctly, but it can be useful as a quick and dirty check to reduce the time it takes to receive feedback.

1

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