github.com/raarceoml/godog@v0.7.9/features/formatter/cucumber.feature (about) 1 Feature: cucumber json formatter 2 In order to support tools that import cucumber json output 3 I need to be able to support cucumber json formatted output 4 5 Scenario: Support of Feature Plus Scenario Node 6 Given a feature "features/simple.feature" file: 7 """ 8 Feature: simple feature 9 simple feature description 10 Scenario: simple scenario 11 simple scenario description 12 """ 13 When I run feature suite with formatter "cucumber" 14 Then the rendered json will be as follows: 15 """ application/json 16 [ 17 { 18 "uri": "features/simple.feature", 19 "id": "simple-feature", 20 "keyword": "Feature", 21 "name": "simple feature", 22 "description": " simple feature description", 23 "line": 1, 24 "elements": [ 25 { 26 "id": "simple-feature;simple-scenario", 27 "keyword": "Scenario", 28 "name": "simple scenario", 29 "description": " simple scenario description", 30 "line": 3, 31 "type": "scenario" 32 } 33 ] 34 } 35 ] 36 """ 37 38 Scenario: Support of Feature Plus Scenario Node With Tags 39 Given a feature "features/simple.feature" file: 40 """ 41 @TAG1 42 Feature: simple feature 43 simple feature description 44 @TAG2 @TAG3 45 Scenario: simple scenario 46 simple scenario description 47 """ 48 When I run feature suite with formatter "cucumber" 49 Then the rendered json will be as follows: 50 """ application/json 51 [ 52 { 53 "uri": "features/simple.feature", 54 "id": "simple-feature", 55 "keyword": "Feature", 56 "name": "simple feature", 57 "description": " simple feature description", 58 "line": 2, 59 "tags": [ 60 { 61 "name": "@TAG1", 62 "line": 1 63 } 64 ], 65 "elements": [ 66 { 67 "id": "simple-feature;simple-scenario", 68 "keyword": "Scenario", 69 "name": "simple scenario", 70 "description": " simple scenario description", 71 "line": 5, 72 "type": "scenario", 73 "tags": [ 74 { 75 "name": "@TAG1", 76 "line": 1 77 }, 78 { 79 "name": "@TAG2", 80 "line": 4 81 }, 82 { 83 "name": "@TAG3", 84 "line": 4 85 } 86 ] 87 } 88 ] 89 } 90 ] 91 """ 92 Scenario: Support of Feature Plus Scenario Outline 93 Given a feature "features/simple.feature" file: 94 """ 95 Feature: simple feature 96 simple feature description 97 98 Scenario Outline: simple scenario 99 simple scenario description 100 101 Examples: simple examples 102 | status | 103 | pass | 104 | fail | 105 """ 106 When I run feature suite with formatter "cucumber" 107 Then the rendered json will be as follows: 108 """ 109 [ 110 { 111 "uri": "features/simple.feature", 112 "id": "simple-feature", 113 "keyword": "Feature", 114 "name": "simple feature", 115 "description": " simple feature description", 116 "line": 1, 117 "elements": [ 118 { 119 "id": "simple-feature;simple-scenario;simple-examples;2", 120 "keyword": "Scenario Outline", 121 "name": "simple scenario", 122 "description": " simple scenario description", 123 "line": 9, 124 "type": "scenario" 125 }, 126 { 127 "id": "simple-feature;simple-scenario;simple-examples;3", 128 "keyword": "Scenario Outline", 129 "name": "simple scenario", 130 "description": " simple scenario description", 131 "line": 10, 132 "type": "scenario" 133 } 134 ] 135 } 136 ] 137 """ 138 139 Scenario: Support of Feature Plus Scenario Outline With Tags 140 Given a feature "features/simple.feature" file: 141 """ 142 @TAG1 143 Feature: simple feature 144 simple feature description 145 146 @TAG2 147 Scenario Outline: simple scenario 148 simple scenario description 149 150 @TAG3 151 Examples: simple examples 152 | status | 153 | pass | 154 | fail | 155 """ 156 When I run feature suite with formatter "cucumber" 157 Then the rendered json will be as follows: 158 """ 159 [ 160 { 161 "uri": "features/simple.feature", 162 "id": "simple-feature", 163 "keyword": "Feature", 164 "name": "simple feature", 165 "description": " simple feature description", 166 "line": 2, 167 "tags": [ 168 { 169 "name": "@TAG1", 170 "line": 1 171 } 172 ], 173 "elements": [ 174 { 175 "id": "simple-feature;simple-scenario;simple-examples;2", 176 "keyword": "Scenario Outline", 177 "name": "simple scenario", 178 "description": " simple scenario description", 179 "line": 12, 180 "type": "scenario", 181 "tags": [ 182 { 183 "name": "@TAG1", 184 "line": 1 185 }, 186 { 187 "name": "@TAG2", 188 "line": 5 189 }, 190 { 191 "name": "@TAG3", 192 "line": 9 193 } 194 ] 195 }, 196 { 197 "id": "simple-feature;simple-scenario;simple-examples;3", 198 "keyword": "Scenario Outline", 199 "name": "simple scenario", 200 "description": " simple scenario description", 201 "line": 13, 202 "type": "scenario", 203 "tags": [ 204 { 205 "name": "@TAG1", 206 "line": 1 207 }, 208 { 209 "name": "@TAG2", 210 "line": 5 211 }, 212 { 213 "name": "@TAG3", 214 "line": 9 215 } 216 ] 217 } 218 ] 219 } 220 ] 221 """ 222 Scenario: Support of Feature Plus Scenario With Steps 223 Given a feature "features/simple.feature" file: 224 """ 225 Feature: simple feature 226 simple feature description 227 228 Scenario: simple scenario 229 simple scenario description 230 231 Given passing step 232 Then a failing step 233 234 """ 235 When I run feature suite with formatter "cucumber" 236 Then the rendered json will be as follows: 237 """ 238 [ 239 { 240 "uri": "features/simple.feature", 241 "id": "simple-feature", 242 "keyword": "Feature", 243 "name": "simple feature", 244 "description": " simple feature description", 245 "line": 1, 246 "elements": [ 247 { 248 "id": "simple-feature;simple-scenario", 249 "keyword": "Scenario", 250 "name": "simple scenario", 251 "description": " simple scenario description", 252 "line": 4, 253 "type": "scenario", 254 "steps": [ 255 { 256 "keyword": "Given ", 257 "name": "passing step", 258 "line": 7, 259 "match": { 260 "location": "suite_context.go:64" 261 }, 262 "result": { 263 "status": "passed", 264 "duration": 0 265 } 266 }, 267 { 268 "keyword": "Then ", 269 "name": "a failing step", 270 "line": 8, 271 "match": { 272 "location": "suite_context.go:47" 273 }, 274 "result": { 275 "status": "failed", 276 "error_message": "intentional failure", 277 "duration": 0 278 } 279 } 280 ] 281 } 282 ] 283 } 284 ] 285 """ 286 Scenario: Support of Feature Plus Scenario Outline With Steps 287 Given a feature "features/simple.feature" file: 288 """ 289 Feature: simple feature 290 simple feature description 291 292 Scenario Outline: simple scenario 293 simple scenario description 294 295 Given <status> step 296 297 Examples: simple examples 298 | status | 299 | passing | 300 | failing | 301 302 """ 303 When I run feature suite with formatter "cucumber" 304 Then the rendered json will be as follows: 305 """ 306 [ 307 { 308 "uri": "features/simple.feature", 309 "id": "simple-feature", 310 "keyword": "Feature", 311 "name": "simple feature", 312 "description": " simple feature description", 313 "line": 1, 314 "elements": [ 315 { 316 "id": "simple-feature;simple-scenario;simple-examples;2", 317 "keyword": "Scenario Outline", 318 "name": "simple scenario", 319 "description": " simple scenario description", 320 "line": 11, 321 "type": "scenario", 322 "steps": [ 323 { 324 "keyword": "Given ", 325 "name": "passing step", 326 "line": 11, 327 "match": { 328 "location": "suite_context.go:64" 329 }, 330 "result": { 331 "status": "passed", 332 "duration": 0 333 } 334 } 335 ] 336 }, 337 { 338 "id": "simple-feature;simple-scenario;simple-examples;3", 339 "keyword": "Scenario Outline", 340 "name": "simple scenario", 341 "description": " simple scenario description", 342 "line": 12, 343 "type": "scenario", 344 "steps": [ 345 { 346 "keyword": "Given ", 347 "name": "failing step", 348 "line": 12, 349 "match": { 350 "location": "suite_context.go:47" 351 }, 352 "result": { 353 "status": "failed", 354 "error_message": "intentional failure", 355 "duration": 0 356 } 357 } 358 ] 359 } 360 ] 361 } 362 ] 363 """ 364 365 # Currently godog only supports comments on Feature and not 366 # scenario and steps. 367 Scenario: Support of Comments 368 Given a feature "features/simple.feature" file: 369 """ 370 #Feature comment 371 Feature: simple feature 372 simple description 373 374 Scenario: simple scenario 375 simple feature description 376 """ 377 When I run feature suite with formatter "cucumber" 378 Then the rendered json will be as follows: 379 """ 380 [ 381 { 382 "uri": "features/simple.feature", 383 "id": "simple-feature", 384 "keyword": "Feature", 385 "name": "simple feature", 386 "description": " simple description", 387 "line": 2, 388 "comments": [ 389 { 390 "value": "#Feature comment", 391 "line": 1 392 } 393 ], 394 "elements": [ 395 { 396 "id": "simple-feature;simple-scenario", 397 "keyword": "Scenario", 398 "name": "simple scenario", 399 "description": " simple feature description", 400 "line": 5, 401 "type": "scenario" 402 } 403 ] 404 } 405 ] 406 """ 407 Scenario: Support of Docstrings 408 Given a feature "features/simple.feature" file: 409 """ 410 Feature: simple feature 411 simple description 412 413 Scenario: simple scenario 414 simple feature description 415 416 Given passing step 417 \"\"\" content type 418 step doc string 419 \"\"\" 420 """ 421 When I run feature suite with formatter "cucumber" 422 Then the rendered json will be as follows: 423 """ 424 [ 425 { 426 "uri": "features/simple.feature", 427 "id": "simple-feature", 428 "keyword": "Feature", 429 "name": "simple feature", 430 "description": " simple description", 431 "line": 1, 432 "elements": [ 433 { 434 "id": "simple-feature;simple-scenario", 435 "keyword": "Scenario", 436 "name": "simple scenario", 437 "description": " simple feature description", 438 "line": 4, 439 "type": "scenario", 440 "steps": [ 441 { 442 "keyword": "Given ", 443 "name": "passing step", 444 "line": 7, 445 "doc_string": { 446 "value": "step doc string", 447 "content_type": "content type", 448 "line": 8 449 }, 450 "match": { 451 "location": "suite_context.go:64" 452 }, 453 "result": { 454 "status": "passed", 455 "duration": 0 456 } 457 } 458 ] 459 } 460 ] 461 } 462 ] 463 """ 464 Scenario: Support of Undefined, Pending and Skipped status 465 Given a feature "features/simple.feature" file: 466 """ 467 Feature: simple feature 468 simple feature description 469 470 Scenario: simple scenario 471 simple scenario description 472 473 Given passing step 474 And pending step 475 And undefined 476 And passing step 477 478 """ 479 When I run feature suite with formatter "cucumber" 480 Then the rendered json will be as follows: 481 """ 482 [ 483 { 484 "uri": "features/simple.feature", 485 "id": "simple-feature", 486 "keyword": "Feature", 487 "name": "simple feature", 488 "description": " simple feature description", 489 "line": 1, 490 "elements": [ 491 { 492 "id": "simple-feature;simple-scenario", 493 "keyword": "Scenario", 494 "name": "simple scenario", 495 "description": " simple scenario description", 496 "line": 4, 497 "type": "scenario", 498 "steps": [ 499 { 500 "keyword": "Given ", 501 "name": "passing step", 502 "line": 7, 503 "match": { 504 "location": "suite_context.go:64" 505 }, 506 "result": { 507 "status": "passed", 508 "duration": 0 509 } 510 }, 511 { 512 "keyword": "And ", 513 "name": "pending step", 514 "line": 8, 515 "match": { 516 "location": "features/simple.feature:8" 517 }, 518 "result": { 519 "status": "pending" 520 } 521 }, 522 { 523 "keyword": "And ", 524 "name": "undefined", 525 "line": 9, 526 "match": { 527 "location": "features/simple.feature:9" 528 }, 529 "result": { 530 "status": "undefined" 531 } 532 }, 533 { 534 "keyword": "And ", 535 "name": "passing step", 536 "line": 10, 537 "match": { 538 "location": "suite_context.go:64" 539 }, 540 "result": { 541 "status": "skipped" 542 } 543 } 544 ] 545 } 546 ] 547 } 548 ] 549 """ 550 551