processIntegrationRequest method
Future<void>
processIntegrationRequest(
- FileSystemEntity file,
- AnalysisContextCollection collection,
- PubspecData pubspecData, {
- required String className,
- required DartServerRepository dartServerRepository,
- int? index,
- required TestRunInfo testRunInfo,
Implementation
Future<void> processIntegrationRequest(FileSystemEntity file,
AnalysisContextCollection collection, PubspecData pubspecData,
{required String className,
required DartServerRepository dartServerRepository,
int? index,
required TestRunInfo testRunInfo}) async {
wtLog.startSpinner("Getting ready...");
try {
final testInputs = await _prepareIntegrationTestInputs(file, collection);
for (var test in testInputs) {
if (test.moduleName != className) continue;
for (var i = 0; i < test.testFlows.length; i++) {
if (index != null && i != index) {
continue;
}
final integrationGenerator =
IntegrationGenerator(dartServerRepository: dartServerRepository)
..init();
await integrationGenerator.generateForFlow(
testInput: test,
allTests: testInputs,
index: i,
pubspecData: pubspecData,
collection: collection,
testRunInfo: testRunInfo);
}
}
if (testRunInfo.failed == 0 && testRunInfo.created > 0) {
wtLog.stopSpinner(
message:
"✅ Succeeded. Please find the generated tests in `/integration_test` folder");
}
} catch (e, stackTrace) {
wtTelemetry.trackError(
severity: Severity.error, error: e, stackTrace: stackTrace);
wtLog.warning(
"Error 'generating' integration tests for file: ${file.path}");
wtLog.log(e.toString());
} finally {
wtLog.stopSpinner();
return;
}
}