I'm working on writing functional tests for an web application I'm building. I'm fairly new to testing and trying to get to grips with best practices. The application has a moderate amount of complexity, and I'm trying to write a functional test for a process that is part of a bigger process.
The wider process:
-- The wider process:
user does A -> user does B (using the DB data generated from A) -> user does C (using the DB data generated from A and B)
The process I want to test:
user does B (using the DB data generated from A) -> generates the data required for C
An example scenario to illustrate:
Let's use the following example: An app that generates email templates for the user
A : user has registered and entered their personal data
B : user logs in and generates a template email with their name, address in the right places
When I'm testing on my local PC, I'm using LiveServerTestCase to create the DB and run a server I can test against with Selenium, and in the setup of my functional test, I create the appropriate initial data using my model code.
When I'm testing on staging, I'm using my local PC to interact with the up-and-running live server on the staging server, and not the one generated using LiveServerTestCase.
My questions:
1) Is it good practice to set up initial data for functional tests using model code (given it's supposed to be a black box test)?
2) During the staging test, how would I populate the DB with the required data? The only way I can think of now is by using Fabric to launch `python manage.py shell` but I feel it might not be the best way
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/82ca423b-85a0-4023-a810-25cd8f44b026%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment