TDD Data Access Layer

In TDD, I have been testing business logic by simulating data access functions.
But in fact I also need to implement the layers below the business layer to make the application work properly.

Should I use TDD to implement the data access layer?
According to the discussion I have seen on the Internet, unit tests should not be connected to any external resources, such as databases, web services, etc. If they are connected, then they will become integration tests.

May I ask someone I understand this.

Thank you very much.

You are right

In TDD, I have been testing business logic by simulating data access functions.
But in fact I also need to implement the layers below the business layer to make the application work properly.

Should I use TDD to implement the data access layer?
According to the discussion I have seen on the Internet, unit tests should not be connected to any external resources, such as databases, web services, etc. If they are connected, then they will become integration tests.

May I ask someone I know something about this.

Thank you very much.

You are right, contact the outside world to make integration testing, but This connection is also important for testing. When using TDD, the contact surface should be as small as possible. This can be achieved by using a wrapper for each record or similar method.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2318 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.