The simplicity thesis
The simplicity thesis
My thoughts on automation engineering
What I consider antipatterns
There are many things that in my opinion should be avoid when implementing a new test framework based on WebDriver. Of course I‘m writing here about my personal preferences. But even so, my preferences are not only based on my real experience using WebDriver but also on discussions and talks that I had over the past years with people involved in the Selenium community.
The use of WebDriver core library
• WebDriver is a core library. Its main goal is to act as a building block for other APIs and tools.
• In my opinion, any final implementation using the Webdriver core directly, doesn‘t follows the WebDrivers philosophy, which is to have a solid kernel that others could build on. Instead, as a normal user, you should be using a tool that abstracts the WebDriver API providing an easy way to interact with browser elements.
• But perhaps you‘re planing to create your own tool. If so, then the WebDriver core library is the right option.
The use of heavily and statically typed programing language
• Test scripts for web automation are quite different than test scripts that interact with the system‘s code. When writing WebDriver based tests scripts we are interacting with the system through it‘s web interface and we are not able to manipulate system‘s internal objects. And actually we don‘t want to do that. Rather, we want to perform actions in a random and unpredictable manner and observe the output. That‘s all.
• The use of heavily and statically typed programing language like Java or C# for writing test scripts can be quite time consuming, since we need to define the data type of input and output variables for every action we are going to model. Dynamically typed language system‘s run-time checks can potentially be more sophisticated than those of statically typed languages, as they can use dynamic information as well as any information from the source code. If we have look at the mathematical model of a finite state machine we will understand why any input should be modeled as an alphabet (a finite, non-empty set of symbols) without any references to its data type.
• When poking with a new web interface, it is extremely important to have fast feedback if WebDriver is working properly. Statically typed programing language needs to be compiled first and the whole test needs to be executed. Sometimes this procedure is anything other than fast.
• Test scripts should be executed on demand. We should be able to choose which test we want to execute and which parameters we want to use without the need of configuring any XML of configuration file for performing that. The use of heavily build managers like Maven or Ant for running a single test script should be avoided.
• The need of setting up and maintaining a development environment that is tight to global environment variables and path configurations is impracticable. As a normal user I want to be able to set up my environment only once and my environment should be fully independent of my operational system‘s rights.