Ivailo, I looked at your file, as first MyServer work it seems very good. These are some comments:
> File *tfile; // test file, i also tried with ofile ( o - object ), but every > time i mistyped 'f' with 'v' ... I don't understand this comment :) > CPPUNIT_TEST( test_createTemporaryFile ); Please avoid to use underscore for functions names, we decided to name functions like: thisIsAFunction If there are functions in the MyServer source code with underscore in their name then they must be changed. > void setUp ( ) { tfile = new File; f = "/tmp/myserver_test_file.txt"; } Don't hardly code the path. It will not work under Windows. To generate a safe temporary file name you can use: void FilesUtility::temporaryFileName (u_long tid, string &out); The first parameter is the caller thread ID, in the test suite it can be safely 0. the file object must be created as: tfile = new File (filename, 0); Probably it is better to remove the default constructor, it is not useful and can leave the File object in a not consistent way leaving the file descriptor to 0 (stdout). > CPPUNIT_ASSERT( 0 == tfile->writeToFile ( buf, ( sizeof (buf) / sizeof > (char) ), &nbw ) ); Please test equality with CPPUNIT_ASSERT_EQUAL. > // it should be > 0, because we wrote before ( and what happens when > nothing is written ? no file ? > CPPUNIT_ASSERT( 0 < tfile->getFileSize ( ) ); Why don't put constants on the right? "tfile->getFileSize () > 0" has the same meaning but IMO it is easier to read. > void test_readFromFile ( char*, u_long, u_long ) > { > char buffer[8]; > u_long nbr; > CPPUNIT_ASSERT( 0 == tfile->readFromFile ( buffer, 8, &nbr ) ); > } It is better to don't depend from the result of other tests and in the order they are executed. A test case is very useful as documentation too, as you can immediately understand how a method works. In this specific case it is better to write something before, do a seek at the beginning of the file and finally read from it. Giuseppe