2

I have a couple of scripts (two in Python, one in Java) that use Selenium to drive a browser and download files from a website.

I need to do some major refactoring before I do a major expansion, so I want to start by writing tests, but I don't know how to go about doing it. All my search results lead to articles about using Selenium to test websites, and I want to test the Selenium script itself.

In particular, I don't want running my tests to create a significant load on the target website.

The offline parts of it I can test pretty easy, but I need to know how to test the actual browser driving itself.

Any ideas?

3

The ideal way to test this without creating any load on the target site would be to create a duplicate of that target web site on your own web server. The duplicate should be a simulation which behaves as similar as possible as the target web site itself. However, if the target site is a complex third party site, this may be impractical or nearly impossible.

So another approach is to implement a "testing mode" into your selenium script which omits any steps which can produce heavy load. For example, instead of really downloading files from the site, in testing mode the script could just create some "dummy test files" in the target folder instead of downloading anything. That way, you can test major parts of the script without producing heavy load. Only when you know that all these parts are working fine, you disable testing mode and test the (hopefully) small remaining part which is responsible for executing the real download.

  • The target site is a large Microsoft Dynamics CRM, so I will definitely not be reproducing it for testing purposes. I like the testing mode idea, but I got permission this morning that as long as I'm targeting the test server I can do what I want. – TBridges42 Feb 10 '16 at 14:18
  • 1
    @TBridges42: a testing mode may be still of use, either. For example, it can speed up your test cycles. – Doc Brown Feb 10 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.