CHAPTER 14

image

Debugging Test Scripts

Debugging usually means analyzing and removing bugs in the code. In the context of automated functional testing, debugging is to find out why a test step did not execute as expected and fix it.

Print text for debugging

Console.WriteLine("Now on page: " + driver.Title);String app_no = driver.FindElement(By.Id("app_id")).Text;Console.WriteLine("Application number is " + app_no);

Here is the output from executing that test from the command line:

Now on page: Assertion Test PageApplication number is 1234

When the test is executed in a continuous integration server, output is normally captured and shown. This can be ...

Get Selenium WebDriver Recipes in C#, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.