Skip to content

Latest commit

 

History

History
 
 

fundamentals__dynamic-tests-from-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Dynamic tests from fetched data

Sometimes you want to generate tests dynamically from data fetched from the external API. Because we cannot add more tests after the spec has already started, we need to fetch the test data before the spec file starts.

We can do this from the setupNodeEvents function. We can call the external API server, parse the returned list of test objects, and then set the list of records in the config.env object. This config object will be available in each spec file. You then can get the list of test records before the tests are created, see the users-spec.cy.js

Dynamic tests