iOS??????????д ??
???????????? ???????[ 2016/7/12 11:23:29 ] ????????iOS ???????
??????????????У???????????testModelConvert
????????????????????json???????????????
- (void)testModelConvert
{
NSString * json = @"{"name":"SindriLin"??"age":22??"flags":987654321}";
NSMutableDictionary * dict = [[NSJSONSerialization JSONObjectWithData: [json dataUsingEncoding: NSUTF8StringEncoding] options: kNilOptions error: nil] mutableCopy];
LXDTestsModel * model = [[LXDTestsModel alloc] initWithDictionary: dict];
XCTAssertNotNil(model);
XCTAssertTrue([model.name isEqualToString: @"SindriLin"]);
XCTAssertTrue([model.age isEqual: @(22)]);
XCTAssertEqual(model.flags?? 987654321);
XCTAssertTrue([model isKindOfClass: [LXDTestsModel class]]);
model = [LXDTestsModel modelWithName: @"Tessie" age: dict[@"age"] flags: 562525];
XCTAssertNotNil(model);
XCTAssertTrue([model.name isEqualToString: @"Tessie"]);
XCTAssertTrue([model.age isEqual: dict[@"age"]]);
XCTAssertEqual(model.flags?? 562525);
NSDictionary * modelJSON = [model modelToDictionary];
XCTAssertTrue([modelJSON isEqual: dict] == NO);
dict[@"name"] = @"Tessie";
dict[@"flags"] = @(562525);
XCTAssertTrue([modelJSON isEqual: dict]);
}
????????
????????????????????????н??е??????????????????????????????????????????????????????
????????while()??????????????
//waitForExpectationsWithTimeout????????????????????????С?
#define WAIT do {
[self expectationForNotification:@"RSBaseTest" object:nil handler:nil];
[self waitForExpectationsWithTimeout:30 handler:nil];
} while (0)
#define NOTIFY [[NSNotificationCenter defaultCenter]postNotificationName:@"RSBaseTest" object:nil]
-(void)testRequest{
// 1.????????????
AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html"??nil];
// 2.????GET????
[mgr GET:@"http://www.weather.com.cn/adat/sk/101110101.html" parameters:nil success:^(AFHTTPRequestOperation *operation?? id responseObject) {
NSLog(@"responseObject:%@"??responseObject);
XCTAssertNotNil(responseObject?? @"???????");
NOTIFY //???????
} failure:^(AFHTTPRequestOperation *operation?? NSError *error) {
NSLog(@"error:%@"??error);
XCTAssertNil(error?? @"???????");
NOTIFY //???????
}];
WAIT //???
}
?????????????????? ???GCD?????
- (void)downloadImageURLWithString:(NSString *)URLString
{ dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
NSURL *url = [NSURL URLWithString:URLString];
__unused Photo *photo = [[Photo alloc] initwithURL:url
withCompletionBlock:^(UIImage *image?? NSError *error) {
if (error) {
XCTFail(@"%@ failed. %@"?? URLString?? error);
}
dispatch_semaphore_signal(semaphore);
}];
dispatch_time_t timeoutTime = dispatch_time(DISPATCH_TIME_NOW?? kDefaultTimeoutLengthInNanoSeconds);
if (dispatch_semaphore_wait(semaphore?? timeoutTime)) {
XCTFail(@"%@ timed out"?? URLString);
}
}
??????? ??????
?????????????????????YYModel??AFNetworking??Alamofire?????????ж????????д?????????????д??Щ???????????????????????????Ρ?
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
iOS???????mocha??chai??sinon??istanbul???????????????????????????????????????д?????Java????????7??????Android?????????Robolectric3.0????(?)???Kiwi?????????????????????????????????Python?????????????????????????????????????Controller????????д?????????10???????????????????Angular????????????Component??Directive??Pipe ???ServiceAndroid????????????????????????????????--Mockito??????iOS UnitTest???????Vue?????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????