Automated testing of our web page

Although we only have a few moments left working on this example, I would like to take this opportunity to discuss testing of your Splunk Apps. As we know, if you are still using Splunk as your development platform, you will be generating internal log files that will be indexed automatically and available to query with Splunk and be able to set up alerting around any errors that you may experience. When your experience progresses, especially when you start to move your development to an external website, it could be wise for you to set up an automated test environment as part of your development process.

Your testing is something that should be discussed and planned when your initial project planning occurs, as you should have a clear idea of how the process should be. As features and bug fixes are added to the project, tests should be outlined and set up before the development work occurs so that there is a clear consensus on when the task is considered to be complete. In the last part of this chapter, we will have a look at Selenium to set up a quick, automated test to ensure that our company's web page loads.

We are going to very briefly touch on this subject to give you an idea on how to set up something like this, but if you are interested in getting some further information, you should look at the Selenium documentation at the following location: http://www.seleniumhq.org/docs/.

In the following example, we are going to be working from our command line to install and run our tests. If you are not working on either Linux or Mac, please consult the documentation for details on installation on your environment: http://selenium-python.readthedocs.io/installation.html.

If you have not used Selenium before, it is a scripting tool that allows testers and developers to automate interaction with web pages. Selenium supports multiple languages, but in the next example we are going to use Python to code our test, as we are able to use the unittest library that comes by default with our installation of Python. As long as you have Python already installed on your development environment, you will be able to use easy_install to add Selenium into your environment. The following command will install it for you:

sudo easy_install selenium

I have also found that the default Firefox browser does have some issues with newer versions of the application, so I have been using ChromeDriver in my Selenium tests. To download the latest version of ChromeDriver to use as part of our example, go to the following URL: https://sites.google.com/a/chromium.org/chromedriver/downloads.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.15.1