MCPcopy Create free account
hub / github.com/cucumber/cucumber-cpp / invokeStep

Method invokeStep

src/CukeEngineImpl.cpp:45–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void CukeEngineImpl::invokeStep(
46 const std::string& id, const invoke_args_type& args, const invoke_table_type& tableArg
47) {
48 InvokeArgs commandArgs;
49 try {
50 for (const std::string& a : args) {
51 commandArgs.addArg(a);
52 }
53
54 if (!tableArg.empty() && !tableArg.front().empty()) {
55 Table& commandTableArg = commandArgs.getVariableTableArg();
56 for (const auto& arg : tableArg[0]) {
57 commandTableArg.addColumn(arg);
58 }
59
60 for (std::size_t i = 1; i < tableArg.size(); ++i) {
61 Table::row_type row;
62 for (const auto& arg : tableArg[i]) {
63 row.push_back(arg);
64 }
65 commandTableArg.addRow(row);
66 }
67 }
68 } catch (...) {
69 throw InvokeException("Unable to decode arguments");
70 }
71
72 InvokeResult commandResult;
73 try {
74 commandResult = cukeCommands.invoke(convertId(id), &commandArgs);
75 } catch (...) {
76 throw InvokeException("Uncatched exception");
77 }
78 switch (commandResult.getType()) {
79 case SUCCESS:
80 return;
81 case FAILURE:
82 throw InvokeFailureException(commandResult.getDescription(), "");
83 case PENDING:
84 throw PendingStepException(commandResult.getDescription());
85 }
86}
87
88void CukeEngineImpl::endScenario(const tags_type& /*tags*/) {
89 cukeCommands.endScenario();

Callers 2

execStepMethod · 0.45
runMethod · 0.45

Calls 6

convertIdFunction · 0.85
addArgMethod · 0.80
addColumnMethod · 0.80
addRowMethod · 0.80
getTypeMethod · 0.80
invokeMethod · 0.45

Tested by

no test coverage detected