Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ build/
# Scratchpad
scratchpad.dart

# pubspec.lock
pubspec.lock
#


# test_coverage generated files
coverage
Expand Down
20 changes: 12 additions & 8 deletions acceptance_tests/lib/src/hooks/mock_server_hook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ class MockServerHook extends Hook {
Iterable<Tag> tags,
) async {
try {
var tagParts = tags.firstWhere((element) => element.name.startsWith('@contract=')).name.split('=');
var tagParts = tags
.firstWhere((element) => element.name.startsWith('@contract='))
.name
.split('=');

var contract = tagParts.skip(1).first;

// await Future.delayed(Duration(seconds: 3));

var res = await http.get(Uri.parse('http://localhost:8090/init?__contract__script__=$contract'));
var res = await http.get(Uri.parse(
'http://localhost:8090/init?__contract__script__=$contract'));

// check for 200 response and fail scenario if not 200

Expand All @@ -35,8 +39,8 @@ class MockServerHook extends Hook {
int myData = 0;

@override
Future<StepResult?> onAfterStep(
covariant PubNubWorld world, ScenarioRunnable scenario, String step, StepResult stepResult) async {
Future<StepResult?> onAfterStep(covariant PubNubWorld world,
ScenarioRunnable scenario, String step, StepResult stepResult) async {
// print(
// 'Hook step: $step, result: ${stepResult.result} ${stepResult.resultReason}');

Expand All @@ -58,12 +62,12 @@ class MockServerHook extends Hook {
// '[Hook] x ${failedExp.length}, . ${pendingExp.length}, v ${succeededExp.length}');

if (failedExp.isNotEmpty) {
return StepResult(
stepResult.elapsedMilliseconds, StepExecutionResult.fail, 'Failed expectations: $failedExp.');
return StepResult(stepResult.elapsedMilliseconds,
StepExecutionResult.fail, 'Failed expectations: $failedExp.');
}
} catch (e) {
return StepResult(
stepResult.elapsedMilliseconds, StepExecutionResult.error, 'Unable to verify expectations: $e.');
return StepResult(stepResult.elapsedMilliseconds,
StepExecutionResult.error, 'Unable to verify expectations: $e.');
}
}

Expand Down
3 changes: 2 additions & 1 deletion acceptance_tests/lib/src/reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class PubNubReporter extends Reporter {
print('');
print(' $scenarioCount scenarios executed');
print('${Color.PASS}✓${Color.RESET} $passedScenarioCount scenarios passed');
print('${Color.FAIL}x${Color.RESET} ${scenarioCount - passedScenarioCount} scenarios failed');
print(
'${Color.FAIL}x${Color.RESET} ${scenarioCount - passedScenarioCount} scenarios failed');
}
}
Loading