Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is your language? the answer can be rspec, junit, selenium, etc based on the language and framework.

basically unit testing is on the function/class/module basis.

you break your design into modules, each having a clear role, and make them plug into each other in a way that you can "mock" the "rest of the world" (e.g. other objects) and test only that part.

to give an example, let's say you create a car, the unit test is to take a wheel, and spin it as if it's on the road, but without a car. take the lights, and plug them in as if they are in the car, take the engine and run it as if it's connected to the transmission, etc. in a car it's a bit more difficult, but in code, if your view needs a model, it doesn't matter if it was created from a database, a text file, or coded, as long as the interface fits.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: