Chapter 8

Automated Testing

What's in This Chapter?

Understanding automated testing

Creating test projects

Testing through an HTTP interface

Interacting with a page under test through a browser

Limiting the scope of tests for presentation components

Calling the Sitecore API

Creating test data

This chapter introduces general concepts involved in automated testing, and then describes a number of techniques that you can use to create and invoke automated tests for your Sitecore solutions. These techniques address various challenges that you will face when designing tests for code that executes in the context of a third-party system — in this case, the Sitecore ASP.NET web content management system (CMS). This chapter describes these approaches, including their advantages and disadvantages to help you determine when each is appropriate.

After explaining some of the complexities involved in automated testing of Sitecore solutions, this chapter presents three specific testing techniques, each of which address some of those challenges. These techniques include the following:

  • Testing over HTTP — .NET code run on a remote system retrieves a web page from the Sitecore solution, parses that page, and then ensures that the parsed content meets expectations.
  • Testing with a web browser driver — .NET code run on a remote system instantiates a web browser to retrieve a web page from the Sitecore solution, and then ensures that the resulting representation of the page meets expectations.
  • Instantiating ...

Get Professional Sitecore Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.