runTestProcess method
The process for asserting and return AsserestResult
to determine
accessibility of AsserestProperty.url
.
Implementation
@override
Future<AsserestResult> runTestProcess() async {
try {
// 300 for enabled handling redirection, 400 for not.
final int httpErrCond = handleRedirect ? 300 : 400;
if (property.accessible) {
// Accessible
for (int count = 0; count < property.tryCount!; count++) {
int respCode = await _makeRespWithStatus();
if (respCode < httpErrCond) {
return AsserestResult.success;
}
}
return AsserestResult.failure;
} else {
// Inaccessible
return await _makeRespWithStatus() >= httpErrCond
? AsserestResult.success
: AsserestResult.failure;
}
} on ClientException {
return AsserestResult.failure;
} catch (_) {
return AsserestResult.error;
}
}