ios - OCUnit test cases not running -


if create new project includes unit tests, test cases called. when i'm adding tests existing project i'm getting following in log:

2013-05-21 19:41:08.814 otest[51593:7e03] unknown device type. using uiuserinterfaceidiomphone based on screen size test suite '/users/impadmin/library/developer/xcode/deriveddata/smartdiary-frrybdtgyyjgewbialqsmxkwvlxs/build/products/debug-iphonesimulator/testsmartdiary.octest(tests)' 

started @ 2013-05-21 14:11:09 +0000 test suite 'testshowcontacts' started @ 2013-05-21 14:11:09 +0000 test suite 'testshowcontacts' finished @ 2013-05-21 14:11:09 +0000. executed 0 tests, 0 failures (0 unexpected) in 0.000 (0.000) seconds

i've added sentestkit frameworks, , added testing bundle via add target. going wrong?

let me add method , test case here:

//the method tested

-(ibaction)addtask{     if(!([mpriority.text isequaltostring:@"1"] ||[mpriority.text isequaltostring:@"2"] ||[mpriority.text isequaltostring:@"3"] ||[mpriority.text isequaltostring:@"4"] ||[mpriority.text isequaltostring:@"5"]))     {         nslog(@"enter valid priority value");     }     else if ([mtaskname.text isequaltostring:@""]) {             nslog(@"task name can't blank");         }         else{     sqlite3_stmt    *statement;     const char *dbpath = [mdatabasepath utf8string];     //[[appviewcontroller returnobject].mdatabasepath utf8string];      if (sqlite3_open(dbpath, &mdiary) == sqlite_ok)     {         nslog(@"%@",mpriority.text);          nsstring *insertsql2=[nsstring stringwithformat:@"insert todo values(\"%@\",\"%@\",\"%@\",\"%@\",\"%@\")",mstartdate.text,menddate.text,mtaskname.text,mtaskdescription.text,mpriority.text];         nslog(@"%@",insertsql2);         const char *insert_stmt2 = [insertsql2 utf8string];         sqlite3_prepare_v2(mdiary, insert_stmt2,                            -1, &statement, null);         nslog(@"%@",mpriority.text);         if (sqlite3_step(statement) == sqlite_done )         {              mstartdate.text=@"";             menddate.text=@"";             mtaskname.text=@"";             mtaskdescription.text=@"";             mpriority.text=@"";         }         else {              nslog(@"failed add");         }         sqlite3_finalize(statement);         sqlite3_close(mdiary);         }     }   } 

//here's test:

-(void)testaddtask {     addtaskviewcontroller *obj;     obj = [[addtaskviewcontroller alloc]init];     obj.mtaskname.text = @"t1";     obj.mtaskdescription.text = @"t2";     obj.mstartdate.text = @"56987";     obj.menddate.text = @"55425";     obj.mpriority.text = @"3";      [obj addtask];     sqlite3_stmt *statement;     const char *dbpath = [obj.mdatabasepath utf8string];     if (sqlite3_open(dbpath,&mdiarytest)== sqlite_ok) {         nsstring *selectsql = [nsstring stringwithformat:@"select * todo mtaskname = \"%@\"",obj.mtaskname.text];         const char *query_stmt = [selectsql utf8string];         if (sqlite3_prepare_v2(mdiarytest,                                query_stmt, -1, &statement, null) == sqlite_ok)         {             if(sqlite3_step(statement) == sqlite_row)             {                 teststring = [[nsstring alloc]initwithutf8string:(const char *) sqlite3_column_text(statement, 1)];             }         }     }     sqlite3_finalize(statement);     sqlite3_close(mdiarytest);     nslog(@"%@",teststring);     stassertequals(teststring,@"t2",@"should equal");  } 

i found in target dependencies project unchecked. checked , tested again, whereupon i'm getting following errors:

undefined symbols architecture i386:   "_objc_class_$_addtaskviewcontroller", referenced from:       objc-class-ref in testaddtask.o   "_sqlite3_close", referenced from:       -[testaddtask testaddtask] in testaddtask.o   "_sqlite3_column_text", referenced from:       -[testaddtask testaddtask] in testaddtask.o   "_sqlite3_finalize", referenced from:       -[testaddtask testaddtask] in testaddtask.o   "_sqlite3_open", referenced from:       -[testaddtask testaddtask] in testaddtask.o   "_sqlite3_prepare_v2", referenced from:       -[testaddtask testaddtask] in testaddtask.o   "_sqlite3_step", referenced from:       -[testaddtask testaddtask] in testaddtask.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) 

i know going off topic, since original question entirely different, can please tell me why these errors coming? i've added necessary frameworks.

as testing uikit dependent stuff, want run application tests. make sure have set bundle loader , test host build settings (refer documentation).

further have link libsqlite3.0.dylib against tests target too, because using sqlite functions in unit tests.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -