Fetching tags from a feature file using cucumber -
is there command line option list tags in cucumber test suite?
for example, want like: cucumber --show-tags foo.feature
that give me like:
@ci @development @regression @wip
the syntax have tried "cucumber -f tag_cloud foo.feature" , giving me "cannot load tag_cloud(load_error)"
i wanted know how exactly.
do need install api's additionally?? or how is?
kindly me
i believe --show-tags
option deprecated. instead, have use custom formatter.
nat ritmeyer had custom formatter task - https://gist.github.com/natritmeyer/2995205.
1) copy following "list_tags.rb" file in "features/support" directory:
=begin copyright (c) 2012, nathaniel ritmeyer rights reserved. redistribution , use in source , binary forms, or without modification, permitted provided following conditions met: 1. redistributions of source code must retain above copyright notice, list of conditions , following disclaimer. 2. redistributions in binary form must reproduce above copyright notice, list of conditions , following disclaimer in documentation and/or other materials provided distribution. 3. neither name nathaniel ritmeyer nor names of contributors software may used endorse or promote products derived software without specific prior written permission. software provided copyright holders , contributors ``as is'' , express or implied warranties, including, not limited to, implied warranties of merchantability , fitness particular purpose disclaimed. in no event shall copyright holders or contributors liable direct, indirect, incidental, special, exemplary, or consequential damages (including, not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) caused , on theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in way out of use of software, if advised of possibility of such damage. =end require 'cucumber/formatter/console' require 'cucumber/formatter/io' module cucumber module formatter class listtags include io include console def initialize(step_mother, path_or_io, options) @io = ensure_io(path_or_io, "list_tags") @all_tags = [] end def tag_name(tag_name) @all_tags << tag_name end def after_features(features) @all_tags.uniq.sort.each {|tag| @io.puts tag} end end end end
2) run cucumber using:
cucumber -d -f cucumber::formatter::listtags
this (dry) run of features , formats results using custom formatter. results list of tags. example:
@feature1 @feature2 @scenario1 @smoke1 @smoke2
Comments
Post a Comment