Thoughts and discussions on how to apply TDD to duwamish

Source: Internet
Author: User

At present, I have studied TDD and read a good book "test driven development: by example". it's not over yet. :) the first half of this book is still messy. Maybe it's because I haven't reached the level of English.
Our company currently uses the duwamish five-layer architecture development. For a simple function, such as the creation of a customer, there will be five classes to support. How can I write the test code ??

Currently, almost all examples I have seen are completed in a class, such as the nunit built-in example and account, which corresponds to an accounttest class. I want to analyze the five-layer architecture and ask you for advice. How can I write the test code?

1. There seems to be no good test on the bottom data layer?

2. dataaccess is difficult to test at this layer. Why? Each class has certain function calls to process crud operations of related business entities.

3. The businessrule layer verifies the database field length, whether the email address is valid, and whether the customer exists.

4. businessfacade, also known as the businesssystem layer, acts as a proxy and seems to have nothing to test?

5. On the web layer, the page is displayed. The pagebase method is used. Specifically, here we add a customer and make some simple page control.

In conclusion, I think the test is only performed at the businessrule layer.

Through a recent study, I have understood the limitations between the test code and the real code.

For example, email Verification
In actual code, I want to check whether the email is correct. Of course, I also need to provide the corresponding error message! If it is correct, what will happen? Errors, etc.

Then, I put some valid addresses and invalid addresses in the test code and run this code to check whether the expected values in the actual code are obtained!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.