taverntesting / tavern

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax
https://taverntesting.github.io/
MIT License
1.02k stars 193 forks source link

Tavern test in 2 separate yaml files, first one containing several stages common to many specific stages in 2nd file; be able to use saved variables from the first file. #807

Open bharatidesai opened 1 year ago

bharatidesai commented 1 year ago

Chaining stages in 2 separate files, for example: test_setup.tavern.yaml - to be used by many other tests in different/separate yaml files, saves some variables test_execution.tavern.yaml - depends on test_setup.tavern.yaml to be executed first, and be able to use the saved variables in test_setup.tavern.yaml

Read about reusable code, but would like to have more stages in the reusable file, that is included.

michaelboulton commented 1 year ago

You can't 'chain' stages in 2 separate files, you would have to put those stages in a configuration file and then include those stages into every test which requires those stages.

bharatidesai commented 1 year ago

Thank you.

We are using Tavern, copany-wide! I am using version 1.23.3 and read about sharing stages, in configuration files. I have about 20 stages that are common for several tests.

Do I have to create 20 stages with unique ids? Can there be mulliple stages in the configuration file?

By any chance, did your version 0.33.0 allow using chaining tavern.yaml files in one py.test command; the saved variable from 1st file could be used in the 2nd file? For example:

py.test. test_setup.tavern.yaml test_use_saved_vars.tavern.yaml

Thank you.


From: michaelboulton @.> Sent: Saturday, October 1, 2022 5:21 AM To: taverntesting/tavern @.> Cc: Desai, Bharati @.>; Author @.> Subject: Re: [taverntesting/tavern] Tavern test in 2 separate yaml files, first one containing several stages common to many specific stages in 2nd file; be able to use saved variables from the first file. (Issue #807)

NOTE: This message is from an EXTERNAL SENDER - be CAUTIOUS, particularly with links and attachments. Please contact Information Security team for suspicious content/activity.

You can't 'chain' stages in 2 separate files, you would have to put those stages in a configuration filehttps://urldefense.com/v3/__https://tavern.readthedocs.io/en/latest/basics.html*sharing-stages-in-configuration-files__;Iw!!CHTgRmCF!DbiGDRN9M82fjWoUef3PLuWnn6LxqXlYQQpvMshBjy-PLbv1IVobOoZr5s2ZElrOXyD9K9z6a18pO8Nlry_k6F6TPHIiWJWl$ and then include those stages into every test which requires those stages.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/taverntesting/tavern/issues/807*issuecomment-1264349208__;Iw!!CHTgRmCF!DbiGDRN9M82fjWoUef3PLuWnn6LxqXlYQQpvMshBjy-PLbv1IVobOoZr5s2ZElrOXyD9K9z6a18pO8Nlry_k6F6TPKwMorQ7$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/A3LFS4NXGK6H6ZSQDW6OHVLWBAUEJANCNFSM6AAAAAAQZJGRPY__;!!CHTgRmCF!DbiGDRN9M82fjWoUef3PLuWnn6LxqXlYQQpvMshBjy-PLbv1IVobOoZr5s2ZElrOXyD9K9z6a18pO8Nlry_k6F6TPGb_GVVC$. You are receiving this because you authored the thread.Message ID: @.***>

NVOCC Services are provided by CEVA as agents for Pyramid Lines Singapore Pte. Ltd. This e-mail message is intended for the above named recipient(s) only. It may contain confidential information that is privileged. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail by error, please immediately notify the sender by replying to this e-mail and deleting the message including any attachment(s) from your system. Thank you in advance for your cooperation and assistance. Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

michaelboulton commented 1 year ago

You can put multiple stages in a configuration file, it sounds like you want to put all 20 stages into a configuration file, and they will need separate IDs.

Chaining stages in different files was never supported