You can do both. Depends if you want to have the testing done in your main code tree or in a separate tree.
http://doc.qt.nokia.com/4.6/qtestlib-tutorial.html