allure-framework / allure1

Allure 1 isn't supported any more, please consider using Allure 2 https://github.com/allure-framework/allure2 instead
Apache License 2.0
713 stars 169 forks source link

Gherkin tables #804

Closed andye2004 closed 7 years ago

andye2004 commented 8 years ago

Hey guys, I'm wondering if Allure can report on gherkin tables, not example tables which I know get reported as multiple steps but a data table as in the example below.

Scenario: Cover Type is TPO
    Given I have a TPO renewal policy
    When I request a renewal document
    Then the certificate title should be displayed exactly as below and on page 1:
      | titleLineNumber | certificateTitlePart |
      | 1               | Third party          |
      | 2               | property damage      |

When cucumber passes the match for the 'Then' step, in this instance it will also have three rows, representing the title and two data rows. Is there a way I can pass this information via an event and have Allure render it in the resulting report?

Many thanks, Andy.

smecsia commented 8 years ago

@andye2004 I believe you can attach any information to the testcase or step as an attachment. Btw, are you using allure-cucumber or allure-cucumber-jvm?

andye2004 commented 8 years ago

@smecsia, thanks for the response!

We're using cucumber-jvm but due to the parallel execution issue in allure-cucumber-jvm I'm actually using the kirlionik cucumber plugin but this is not reporting the tables so was thinking about implementing my own. That was really why I was asking the question.

I've spent the last couple of days writing a proof-of-concept and having proved it would work for us I put it live in out Teamcity CI environment today but almost as soon as I had someone pointed out that it was not reporting tables.

What these types of table is effectively provide a shorthand way of saying x and y and z. Using the example in my previous post, it is basically saying:-

Then page 1 should have a title that consists of 2 lines And line 1 should have the words 'Third Party' And line 2 should have the words 'property damage'

The tables I'm describing are actually passed to the cucumber test step as method parameters and I was hoping there was a way of getting these to display in the report. Not sure we could do that by way of an attachment though.

If not then maybe we just need to come up with an agreement internally on how we process these kind of tables.

andye2004 commented 8 years ago

I guess they could maybe be passed as child steps to the when step as formatted string maybe???

azohra commented 8 years ago

@andye2004, the ruby adapter (allure-cucumber) supports data tables, they are attached to the test step as a file with the name 'multi-line argument'.so what you want is possible! This should be easy to add to cucumber-jvm if it is missing as cucumber DOES pass the data-table to the formatters.

However, I am working on getting it to show in the actual test step which will look nicer -- but that will just be for the ruby based allure-cucumber.

andye2004 commented 8 years ago

@tk8817 thanks for that, I'll take a look in the ruby adapter for some inspiration! I like the idea of putting it into a test step, that's what made me think about adding child steps to the 'Then' step. I was assuming that anything added here would be displayed be default and would hopefully look nice as well. Guess that's tomorrows task now.......I'll post with my findings.

andye2004 commented 8 years ago

Just reporting back for anyone else who might be interested in this. On version 1.4.x it seems this can be done either as an attachment or as sub/child steps. Sub steps look ugly as they have the timestamp etc on them. I think that an attachment, whilst not ideal, is the best I can get at the moment.

There is an enhancement #708 scheduled for 1.5 which will allow markdown to be used in step title, as long as the step title can also move onto multiple lines (see note), it may be possible to get a better result when 1.5 is available. It 's RC2 at the moment so it might be worth trying out at some point.

Note: In issue #708 there is a comment from @baev that Allure doesn't support multiline step titles :(

andye2004 commented 8 years ago

Further follow up, I've had a look at RC2 and I can't see that the enhancement in #708 has been added :(

baev commented 7 years ago

moved to allure2 (https://github.com/allure-framework/allure2/issues/77)