Time consuming Unit test for support for 100,000 records: Am I doing it right?

I am working on adding test coverage for an application that previously didn’t have any. One additional requirement that emerged is that one of the background processes should be able to process 100,000 rows at a time.

I’ve written a unit test that ensures that the background process is able to work with the 100,000 entities without crashing the interpretter (PHP) on a 4.0MB memory limit. But each test run takes close to 4 minutes to finish. All other tests take just 10 seconds to run.

Can this be approached differently than a unit test?

3

I’m not sure how you have your test cases structured, but that sounds more like a system test or acceptance test than a unit test to me.

In my opinion, unit tests should be concerned with testing that functionality works and exercising various code branches. An example of a unit test would be processing a single record, and you might have a few variations of this record to force your testing to go down certain paths and confirm your results are what is expected. Your unit tests can be used for regression and smoke testing as well – things that you run on a regular basis (nightly, after a build, locally in a development environment before a code review, and so on).

Your system level and acceptance tests aren’t run as frequently – running automated system tests nightly would be as frequent as I’d expect. These would be more intensive tests that would focus on system performance, memory consumption, timing, and behavior with other systems. Having it automated, much like your unit tests, are a good thing, but I wouldn’t want to bog down your unit test suite or regression test suite with such long-running activities.

This is more along the lines of a load test. Unit tests should be about whether the code produces correct results. Load tests are geared toward testing whether the system meets certain volume and timing requirements, and are typically run at a higher level of evaluation than unit tests.

If the system could only handle 99,000 records, what level of failure is that and what does it mean. What if it was desired to process 100,000 records in three minutes but your test indicates it took 4 minutes. Load tests are not so much about absolute failure or success. They are more aligned to testing minimum levels of performance and provide guidance toward needed scalability enhancements.

Edit:
Sorry, I guess I didn’t really answer your title question. I would say that this is a valuable test, but I think you are doing it wrong to consider this as part of your unit tests.

What you tried to do it for the functional testing.

Unit tests have to be FIRST (Fast Isolated Repeatable Self-verifying

The faster your tests run, the more often you’ll run them. Tests take half a minute to run? You’ll maybe run them every 5 minutes instead of every few seconds. Tests take over two minutes to run? You might run those tests once every half hour, and you can write a lot of questionable code in that time! Tests take ten, fifteen, or more minutes to run? Forget it. You’ll run those a few times per day at best.

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