Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
About the Author
About the Reviewers

Creating comments in your tests

Before we carry on further with Selenium, this is a good time to mention how to create comments in your tests. As all good software developers know, having readable code and having comments can make maintenance in the future much easier. Unlike in software development, it is extremely hard, almost impossible, to write self-documenting code. To combat this, it is good practice to make sure that your tests have comments that future software testers can use.

Adding Selenium IDE comments

To add comments to your tests, perform the following steps:

  1. In the test that was created earlier, right-click on a step. For example, the verify step.

  2. The Selenium IDE context menu will be visible as shown in the following screenshot:

  3. Click on Insert New Comment. A space will appear between the Selenium commands.

  4. Click on the Command textbox and enter in a comment so that you can use it for future maintenance. It will look like the following screenshot:

We just had a look at how to create comments. Comments will always appear as purple text in the IDE. This, like in most IDEs, is to help you spot comments quicker when looking through your test cases. Now that we know how to keep our tests maintainable with comments, let's carry on working with Selenium IDE to record/tweak/replay our scripts.