Closed ajilo297 closed 5 years ago
Currently not at the moment. I would think we could create a reporter that produces an intermediate output that a HTML reporter could then interpret. PR's are always welcome
@jonsamwell Is there anyway this can be done...? Maybe there could be something I can build...?
@ajilo297 see https://github.com/jonsamwell/flutter_gherkin/pull/17
Once the PR is merged in with the new Gherkin engine you will be able to generate HTML reports
@ajilo297 this can now be achieved by using the JsonReporter then passing that json file to https://www.npmjs.com/package/cucumber-html-reporter see https://github.com/jonsamwell/flutter_gherkin#reporting
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'hooks/hook_example.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..reporters = [
ProgressReporter(),
TestRunSummaryReporter(),
JsonReporter(path: './report.json')
] // you can include the "StdoutReporter()" without the message level parameter for verbose log information
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
..restartAppBetweenScenarios = true
..targetAppPath = "test_driver/app.dart"
..exitAfterTestRun = true;
return GherkinRunner().execute(config);
}
@ajilo297 this can now be achieved by using the JsonReporter then passing that json file to https://www.npmjs.com/package/cucumber-html-reporter see https://github.com/jonsamwell/flutter_gherkin#reporting
import 'dart:async'; import 'package:flutter_gherkin/flutter_gherkin.dart'; import 'package:gherkin/gherkin.dart'; import 'package:glob/glob.dart'; import 'hooks/hook_example.dart'; import 'steps/given_I_pick_a_colour_step.dart'; import 'steps/tap_button_n_times_step.dart'; Future<void> main() { final config = FlutterTestConfiguration() ..features = [Glob(r"test_driver/features/**.feature")] ..reporters = [ ProgressReporter(), TestRunSummaryReporter(), JsonReporter(path: './report.json') ] // you can include the "StdoutReporter()" without the message level parameter for verbose log information ..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()] ..restartAppBetweenScenarios = true ..targetAppPath = "test_driver/app.dart" ..exitAfterTestRun = true; return GherkinRunner().execute(config); }
thanks it really hepled I was able to generate a beautiful bootstrap html report
Awesome!
@jonsamwell I am trying to generate html report but facing issue. Please help me
import 'dart:async'; import 'package:flutter_gherkin/flutter_gherkin.dart'; import 'package:gherkin/gherkin.dart'; import 'package:glob/glob.dart'; import '../stepDefinitions/login_stepDef.dart';
Future
return GherkinRunner().execute(config); }
Index.js
var reporter = require('cucumber-html-reporter');
var options = { theme: 'bootstrap', jsonFile: './report.json', output: './cucumber_report.html', reportSuiteAsScenarios: true, scenarioTimestamp: true, launchReport: true, metadata: { "App Version":"0.3.2" } };
reporter.generate(options);
Getting following error
apple@apples-MacBook-Pro test_driver % node index.js node:internal/fs/utils:345 throw err; ^
Error: ENOENT: no such file or directory, scandir './report.json'
at Object.readdirSync (node:fs:1401:3)
at isValidJsonFile (/Users/apple/node_modules/cucumber-html-reporter/lib/reporter.js:511:48)
at Object.generate (/Users/apple/node_modules/cucumber-html-reporter/lib/reporter.js:540:9)
at Object.generateReport [as generate] (/Users/apple/node_modules/cucumber-html-reporter/index.js:30:21)
at Object.
Looks like you just have the wrong path your check where the report.json is being saved to and error the js script is pointing to the right place
Is there any way we can generate an HTML report at the end?