How to prepare the site for automated testing?

Good day!
In the company where I work, automated testing is only just beginning to be implemented, and there is quite a lot of organizational issues. In particular, one of them is how to approach the creation of the test stand.

At the moment all tests are performed on an exact copy of the working draft, more precisely all the new features and fixes are placed on the test pad, and then it is moved to the production server. An obvious disadvantage in testing - no test data. For example, if you want to test editing a record, then that record must first be created. There are tests that do this, but if they fail, then test the edit recording will fail by default.

Hence the question, how to approach the organization of a test site? Should it with the calculations already contain all the necessary test data? Or more correctly to prepare test data before each test, for example, that the script added an entry, which we will edit in the tests, users will not going to do it, filled out the fields that we will compare?

There are some ready solutions to simplify this task?

Thanks in advance for answers and none of them have something like "hire a professional". (=

UPD: technology stack
tests: python - pytest - selenium - selenoid
jenkins - docker - networks
March 21st 20 at 11:37
3 answers
March 21st 20 at 11:39
Functional tests are written with the data
The test read data includes a record of their
It is not entirely clear. Meaning that for the functional tests of the data required for the test, must already be present? - tyrel.Hills commented on March 21st 20 at 11:42
@tyrel.Hills, the Test read data includes a record of their - shannon commented on March 21st 20 at 11:45
@shannon, OK. At what point do they need to record? - tyrel.Hills commented on March 21st 20 at 11:48
@tyrel.Hills,

Write in question about your technology stack

Class TestFrontPage:

 def test_can_add_some_stuff
 # some post data in html form
 # get redirect
 # test data is on page in proper place
- shannon commented on March 21st 20 at 11:51
March 21st 20 at 11:41
As we have written functional tests before executing fill data, and after the execution of mulching. This is logical, because different tests can ponadobit absolutely opposite data.
Read about the fixture. And for generating test data using faker.
March 21st 20 at 11:43
For the test data I recommend to have them in the database. Clever sovetuiu you in the face new test date know not what they do. The face is the slow (wait for the item, wait for this) and most risky (item does not exist in time and test collapsed). I recommend to use backend - API or something (look here). Otherwise it will happen, here's the problem: test 1 will be generated across the face of the test date for 5 seconds and everything will be OK, and then when these tests will be 1000, the generation of test dates will take 83 minutes (huh?).

In General, if you have Docker is, what's stopping you in the way a cast DB to fill?

Find more questions by tags Testing softwareAutomation