我即将在我的自动化项目上运行并行测试(我正在使用Jbehave),但我想知道我是否需要在我的代码中创建会话管理(线程管理),或者Jenkins是否可以为我执行此操作。谢谢!
答案 0 :(得分:0)
答案 1 :(得分:0)
您可以在构建流程作业的帮助下运行顺序和并行作业。
示例:
管道工作:
parallel(
build("job1")
build("job2")
)
平行工作:
+ (void)connectWithPOSTtoAPIURL:(NSString *)APIURLString
withParams:(NSDictionary *)params
withKeyObject:(NSString *)keyObject
andResponse:(void (^)(NSURLResponse *serviceResponse, id receivedData, NSError *error))responseHandler{
NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&jsonError];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", ParseRestAPIURL, APIURLString]];
NSMutableURLRequest *dataRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0];
[dataRequest setTimeoutInterval:30.0];
[dataRequest setHTTPMethod:@"POST"];
[dataRequest setValue:ParseApplicationID forHTTPHeaderField:@"X-Parse-Application-Id"];
[dataRequest setValue:ParseRestAPIID forHTTPHeaderField:@"X-Parse-REST-API-Key"];
[dataRequest setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[jsonData length]] forHTTPHeaderField:@"Content-Length"];
[dataRequest setHTTPBody:jsonData];
[NSURLConnection sendAsynchronousRequest:dataRequest
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
id receivedData;
if (connectionError) {
}
else {
NSError *jsonError;
receivedData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (jsonError) {
}else {
// NSLog(@"OUTPUT DATA: %@", receivedData);
}
}
responseHandler (response,receivedData,connectionError);
}];
}