Quote Originally Posted by Noren View Post
-> do I made a .cpp and a .h for my test class ? Or putting all on the .cpp ?
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).

Quote Originally Posted by Noren View Post
-> I my class need to be in antoher project ? Or in the same project ? If i need to make another project, how to link both ?
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.

Quote Originally Posted by Noren View Post
-> do i need to importe .cpp of the class i need to test or the .h ? Or both maybe ?
including the .cpp is also possible, but very uncommon.

Quote Originally Posted by Noren View Post
It's really a simple code which actually don't test anything, but i've some issues i didn't understand what can I do... There are the issues:
Qt Code:
  1. error: undefined reference to `Carre::Carre()'
  2. error: undefined reference to `Position::Position(int, int)'
  3. :-1: error: collect2: error: ld returned 1 exit status
To copy to clipboard, switch view to plain text mode 
Linker error, saying that it can't find the code backing these functions.
See your second question.

Quote Originally Posted by Noren View Post
It's really strange because methods work pretty well in my project and don't have any problems... I put NameOfMyClass:: for each method on my project, and it work ! So i don't understand why i have problems like that ...
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,
_