February 3, 2011

A Guide Through the Layers of Automated Testing

 

With automated testing comes many different layers of testing. For new developers this can be a bit overwhelming. Take for example the other day at work when a developer came to me and asked what type of test should they write for a code change they did.

This question got me thinking, with all the different layers of testing out there, how does someone new to automated testing know what tests to create?

So I decided to sit down lay out what the different layers of testing are and when you should use them. This isn’t a complete list, however I feel this is a good base for a new developer to get started in automated testing.

Test Types

  • Unit test – Testing an individual method’s logic, by removing all outside dependencies. You would use frameworks like NUnit and VS Unit Testing Framework to accomplish this.
  • Integration Test – Testing two or more methods together, testing the dependencies between the methods. You would use frameworks like NUnit and VS Unit Testing Framework to accomplish this.
  • Functional Test – Testing a scenario end-to-end from the presenter to the database and back again. This type of test tests the entire application just below the GUI. You would use frameworks like Cucumber and MSpec to accomplish this.
  • GUI Test – Testing the user interface of a form. GUI test should just test the GUI, not the underlying business logic. You would use frameworks like Selenium and Coded UI Tests to accomplish this.

When to Use

Here are some scenarios you may encounter and what tests you would use.

Method Change in Service Data Access Layer

  • Unit Test - need to be written against the method
  • Integration Test (Optional) – written to verify that the data coming back from the database is valid

Method Change in Data Access Layer

  • Unit Test – need to be written against the method
  • Integration Test – written from the data access layer to the service layer and below

Method Change in a Presenter (MVP model)

  • Unit Test – need to be written against the method.
  • Integration Test – written from the method to the data access layer and below.
  • Functional Test (Optional) - If the method is in a presenter, then a cucumber test will need to be written that will do an end to end test from the method.

Change to a Form (Strictly a UI change)

  • GUI Test – against the change.

Conclusion

Deciding to begin testing you code is a very rewarding experience. It can also be a very overwhelming experience. Armed with this information I wish you well on your wonderful journey into automated testing.

16 comments:

  1. If you're new to testing, the attitudes are as important as the nuts and bolts of testing.

    When you make code changes or add code ask yourself, "How do I prove that this works as expected?" and "How do I prove that this didn't break anything else?"

    Testing also saves time over the life of a project. It's worth it.

    ReplyDelete
  2. Excellent sharing Thanks for share i am sure its must help me. thanks for doing this.

    Scrum Process

    ReplyDelete
  3. Thanks for your informative article on software testing. Your post helped me to understand the future and career prospects in software testing. Keep on updating your blog with such awesome article. Best software testing training institute in Chennai | Software Testing Training in Chennai | Software testing course in Chennai

    ReplyDelete
  4. Nice information about the load testing!!! I prefer Loadrunner automation testing tool to validate the performance of software application/system under actual load. Loadrunner Training in Chennai | Loadrunner training institute in Chennai

    ReplyDelete
  5. I am happy to found such helpful and fascinating post that is written in well manner.
    Regards..
    QTP Training in Chennai | Software Testing Training in Chennai

    ReplyDelete
  6. Your post helped me to understand the future and career prospects in software testing. best fire and safety college in chennai |nebosh course in India

    ReplyDelete
  7. Your blog is awesome..You have clearly explained about it ...Its very useful for me to know about new things..Keep on blogging..
    Software testing training in chennai

    ReplyDelete
  8. Really i enjoyed very much. And this may helpful for lot of peoples. So you are provided such a nice and great article within this.

    SAP Training in Chennai

    ReplyDelete


  9. First is to thank you for all this informative posts you give us for free; i bet all of us are happy.
    Such a great idea of yours! You have been a big help for me. Thanks a lot. more post for interesting topic. Great!

    SAP training in Chennai

    ReplyDelete
  10. Testing now a days has become as importnant as developing of an application. With the help of testing, we can find out the potential bugs which would affect the application. Fixing this at a very early stage would help the application to run without any problem.
    Software testing training in Chennai | Software testing training institute in Chennai | Software testing courses in Chennai

    ReplyDelete
  11. First is to thank you for all this informative posts you give us for free; i bet all of us are happy.
    Such a great idea of yours! You have been a big help for me. Thanks a lot. more post for interesting topic. Great!

    SAP training in Chennai

    ReplyDelete
  12. very nice information providing on blog
    http://hadooptraininginhyderabad.co.in/salesforce-training-in-hyderabad/

    ReplyDelete
  13. Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info! , Regards, servicenow training in hyderabad

    ReplyDelete
  14. I am a regular reader of your blog. the blog is very interesting and will be much useful for us.
    Seo Company in Chennai

    ReplyDelete