Both work, for simple tests just a .cpp is usually less work.
In case of just having a .cpp you need to include the "moc" file at the end of the file (see your current example).
You can either build the unit (the class you test) as part of the test (add its .cpp to SOURCES and its .h to HEADERS) or you put them in a library that both your application and your tests uses in their respective .pro file's LIBS variable.
including the .cpp is also possible, but very uncommon.
Linker error, saying that it can't find the code backing these functions.
See your second question.
Your main project most likely builds the class as part of its SOURCES or you have it in a library that the main project's LIBS points to.
Cheers,
_
Bookmarks