2015-02-27 10 views
6

Sto aggiungendo una tabella di esempio a un passaggio in background in un file di feature cetriolo. Come procedo a fare questo?Come si aggiunge una tabella di esempio a uno sfondo in un file di feature cetriolo?

voglio fare qualcosa di simile:

Background: 
Given <username> has logged in 

Examples: 
|username| 
|User 1 | 
|User 2 | 

Scenario: ..... 
+1

per quanto ne so io non credo che sia possibile. Immagina di avere 1 tabella in background, quindi ogni scenario che condivide questo sfondo ha anche una tabella Outline, quindi sarebbe esponenziale. – hidro

+0

Ho bloccato con lo stesso requisito. qualsiasi soluzione su questo? –

risposta

1

Purtroppo, questo non è possibile.

il cetriolo docs

1

questo aiuterà voi ..

Feature: Passing background with multiline args 

Background: 
Given table |a|b| 
|c|d| 
And multiline string """ I'm a cucumber 
and I'm okay. I sleep all night and I test all day """ 

Scenario: passing background 

Then the table should be 
|a|b| 
|c|d| 

Then the multiline string should be """ I'm a cucumber and I'm okay. I sleep all night and I test all day 

""" Scenario: another passing background 

Then the table should be |a|b| |c|d| 

Then the multiline string should be """ I'm a cucumber and I'm okay. I sleep all night and I test all day 

Fare riferimento questo link per ulteriori scenari ..

https://www.relishapp.com/cucumber/cucumber/docs/gherkin/background

Problemi correlati