samedi 26 août 2017

Django/Testing: How do I populate the initial DB data when functional testing against staging server

I'm trying to run functional test for a Django webapp. The test is for a step in the middle of a process, so it requires the user to already have some data in the DB.

When I'm testing on my local PC, I use LiveServerTestCase to spin up the server and interact with it through Selenium, generating the data in the setUp function using model code from the concerned app.

When I'm testing against the staging server however, and I interact with it through Selenium on my local PC, the setUp code does nothing since it's running on my local PC.

My questions: 1) is it best practice to use model code to initialize a functional test (since it's supposed to be blackbox)? 2) how would I populate the DB when running against the staging server?

Aucun commentaire:

Enregistrer un commentaire