In agile development, we write high-level test cases before coding even starts. This is a good practice no matter what development methodology you're using. Testers are skilled at helping business experts clarify their requirements for a particular feature or piece of functionality, and using those to provide the big picture for what the code needs to do.
When coding starts, it's time for testers to turn the examples of desired behavior that they've elicited from customers into executable tests that will let the team know when the functionality is "done". If these tests aren't automatable, the programmers are unlikely to actually run them. However, as we write tests that will be automated, we also think ahead to the important exploratory testing we'll need to do as coding is completed.
Throughout this process, one or more testers will work together with one or more programmers to write tests, write code, write more tests, write more code, test some more, as many tiny iterations as needed until the appropriate business value is achieved.
When your team plans releases and iterations, think about the tests you'll need to help guide coding. Write appropriate task cards to write the test cases, automate them, and do the manual exploratory testing. Write appropriate task cards to design code for ease of test automation.
A universal complaint among software teams is "we never have time to finish testing" and "testing gets squeezed to the end". The usual cause? The team plans too much work in one iteration. Testers must actively participate in the planning. Your team needs to be realistic and plan only the functionality that they can code and fully test before the end of the iteration. No story is done until it's tested!