P
P
Pavel Bezrukov2016-07-07 16:45:45
Test Driven Development
Pavel Bezrukov, 2016-07-07 16:45:45

Where should I write field validation of the generated form result?

Good afternoon.
This is my first experience with Codeception testing framework.
I write tests to validate forms.
To do this, I created a stepobject in a set of acceptance tests and endowed it with methods for filling, validating fields, submitting a form, checking a confirming alert.
Now I need to write a field check in the database, for example, the city id should be turned into a string name, and I need to test it.
Tell me, is it possible to use the framework API to check fields in the database in acceptance tests, or should this be taken out in some other set of tests? It's just that if it's not clear how to build the sequence, the acceptance test should work first, and then only the verification test in the database.
In the documentation, I saw examples of acceptance tests where the BD module is used for verification, so I see no reason why using the product API may not fit into the ideology. But since I hesitate, I want to know the opinion of experts who have filled their hands.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-07-07
@sim3x

IMO
, the acceptance test should not know that you have a database, it is more about interacting with a black box
. The test functions have a page / gui through which it perceives the software
. You filled out the form, sent it, and then you have to find a new position in the list with your The data that the API has just sent
(as REST) ​​is perfectly fine to use in acceptance tests.
But not in the form "I posted the form, now I will get the id by the line, and I will find the object by the id"
But in the form "I have posted it in the form, go to the api and rake out the list and see if the data is visible in the api"
When the test knows that you have a database, which means it is already closer to the code and it is either a unit test or a unit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question