We're using RSpec to test our frontend, around 1000 test cases. Our test suite requires a variety of pre-populated data in various databases. Up until now we've been managing that data manually. Recently we've been running into more and more test failures due to data that has not been updated properly. We've decided on using example metadata to specify the data each example requires, collecting it before the test suite and use it for population. The solution looks something like this:
describe 'Test product purchases' do
product_params = [
{
name: 'widget1',
price: 100,
...
},
{
name: 'widget2',
price: 175,
...
}
]
example.metadata[:products] = product_params
Steps "A client purchases a product" do
...
...
end
end
One unexpected behavior that I've run into when using this approach is that setting the metadata this way causes new pending examples to be created. I've looked at the documentation for why this happens or how to apply an approach similar to this but couldn't find any.
Is there a different, better approach for managing a large set of test data that needs to be pre-populated? Or how can the metadata be set this way without creating these pending examples?
Aucun commentaire:
Enregistrer un commentaire