Book Image

Selenium 1.0 Testing Tools: Beginner's Guide

By : David Burns
Book Image

Selenium 1.0 Testing Tools: Beginner's Guide

By: David Burns

Overview of this book

<p>Selenium is a suite of tools to automate web application testing across many platforms. A strong understanding of using Selenium will get you developing tests to ensure the quality of your applications.</p> <p>This book helps you understand and use Selenium to create tests and make sure that what your user expects to do can be done. It will guide you to successfully implement Selenium tests to ensure the quality of your applications.</p> <p>The Selenium Testing Tools Beginner’s guide shows developers and testers how to create automated tests using a browser. You'll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as css, xpath, DOM to find elements on the page.</p> <p>Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.</p>
Table of Contents (18 chapters)
Selenium 1.0 Testing Tools Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
Index

Chapter 7 – Creating Selenium Remote Control Tests


  • Do you need to create a folder for your tests?

    • Answer: Yes. This will tell your IDE that you will keep test code in here. It will also make sure that we have separated concerns. This will allow us to create our web applications and keep our tests close by.

  • How does one export their Selenium IDE tests into a programming language?

    • Answer: From within Selenium IDE you go File | Export Tests As … and then chose from one of the different languages that is supported there.

  • Do you need to have Selenium JAR files as a dependency of your tests?

    • Answer: Yes. Selenium Remote Control works by having a client-server interface with Selenium Server accepting commands from your tests

  • How do you run your tests once the dependencies are correct?

    • Answer: It is a simple case of right-clicking and then clicking on Run Test. You could use the shortcut of Ctrl + Shift + F10.

  • How many parameters does the Selenium object take when using DefaultSelenium?

    • Answer: 4

  • What class do we need to extend when writing JUnit 3 style tests?

    • Answer: SeleneseTestCase

  • If we are running Selenium Server, can we use a different setUp() method?

    • Answer: If we call setUp() and pass in two parameters, the browser string and site URL, or if we pass in the siteURL it will make assumptions like the Selenium Server is on the same machine.

  • How do you start the browser?

    • Answer: Call the start() function

  • How do you stop the browser?

    • Answer: Call the stop() function

  • How do I do asserts and verifies in when writing tests in a programming language?

    • Answer: Verifies and asserts are done using the testing framework's asserts. If you want to do a Selenium Assert on a Element on the page it would be assertTrue(selenium.isElementPresent("elementLocator");. If you wanted do a Selenium Verify you would wrap the assert in a try{ } catch{ } block so that it can carry on even if the assert fails.

  • What is the Page Object design pattern?

    • Answer: The Page Object pattern gives us a way to abstract our tests away so that we can make these tests more maintainable. We can make tests that only require updating if new steps have been added otherwise it just requires the page object to be updated.