Ideally, studying shouldn't happen just before a test. It should be a natural part of the student's routine while taking any given course.
You can't rely on homework to cover all the necessary material. From a student point of view, when you do that, you're essentially handing all power to the instructor and relying on that person to cover every important issue and topic in the subject. But teachers and professors aren't perfect. They run into time constraints and conflicting demands just like everyone else. As a result, some material can be glossed over or skipped entirely. And some students will need more time with particular topics than others.
The point of studying, beyond assigned homework, is to ensure you understand the material covered and expand your knowledge. I would argue that by the undergraduate level the most successful students are the ones who study because they enjoy it and want to know more than just that which is covered in the lectures. Hence, they read additional material, try problems outside of those assigned, and attempt to apply the basic concepts covered in courses in new ways to 'think outside the box.'
Before a test it's a good idea to review relevant material covered in lectures. In an ideal scenario, the student shouldn't be learning anything new at this point. But from a practical point of view this is often the time to fill in holes and spend time nailing down any material you haven't understood.