setDefinition( [ new InputArgument('suite', InputArgument::REQUIRED, 'suite to scan for feature files'), new InputArgument('test', InputArgument::OPTIONAL, 'test to be scanned'), new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), ] ); parent::configure(); } public function getDescription() { return 'Fetches empty steps from feature files of suite and prints code snippets for them'; } public function execute(InputInterface $input, OutputInterface $output) { $this->addStyles($output); $suite = $input->getArgument('suite'); $test = $input->getArgument('test'); $config = $this->getSuiteConfig($suite); $generator = new SnippetsGenerator($config, $test); $snippets = $generator->getSnippets(); $features = $generator->getFeatures(); if (empty($snippets)) { $output->writeln(" All Gherkin steps are defined. Exiting... "); return; } $output->writeln(" Snippets found in: "); foreach ($features as $feature) { $output->writeln(" - {$feature} "); } $output->writeln(" Generated Snippets: "); $output->writeln(" ----------------------------------------- "); foreach ($snippets as $snippet) { $output->writeln($snippet); } $output->writeln(" ----------------------------------------- "); $output->writeln(sprintf(' %d snippets proposed', count($snippets))); $output->writeln(" Copy generated snippets to {$config['actor']} or a specific Gherkin context "); } }