In this small publication I will talk about the groundwork that allows you to prepare settings for cross-browser testing of web applications / cross-platform and simply launching mobile applications to perform a test - within the framework described. At once I will say that a feature can be perceived ambiguously due to certain reasons. Some of them are completely objective and I will mention them at the very end of the article. ')
This post somehow visualizes the Configuration chapter of my own documentation (for now this is a wiki on the github page ), which will be updated in the near future. Here will be presented a simple example of how to prepare the settings, as well as an example of how I intend to use my format in the context of test automation using Selenium and Appium. The article contains an interesting and visual, I think, video.
Plan: “What problem did I try to solve?” - simple demonstration - Demonstration on the example of cross-browser test - What is missing - Announcement The overlooked solution is entirely on github .
Go!
What kind of problem did I try to solve?
To begin with, I have a significant background of work with such a tool as TestComplete. Below is an example of how this solution offers to customize an instance of a project with autotests.
This is a suite editor, setting variables. He offers 1. Create a variable 2. Specify its type 3. Specify default value. 4. Specify a local value. 5. If you want - add a description.
More details about 3 and 4. If there is no local value, then the default value is applied, otherwise it is overlapped by the local value.
What is the drawback of these settings? Yes, in general, it is not. But. Not to say that rarely, but there were such moments when for one (let's call it that) test sessions, we needed several different values (logically) of the same variable. Due to the peculiarities of the framework (I would not say that it was bad), conventional test parameterization tools did not always help. In such cases, the list of variables and, accordingly, their local and default values began to grow.
On the current project, where tests are written in Java, I observe a different picture. The set of variables is the same, and their values are great. And all this is written in files * .properties . Each * .properties file stores 1 or more sets of values for the same parameters. The set of parameters is the same from file to file, and values in part too (largely). In my opinion - not convenient and redundant!
So. The examples above lack, in my opinion, the fact that in the PLO is called inheritance / overlap.
I decided for the described work out to come up with my own way of setting up with blackjack and with the following properties:
Format:
a) the format should allow grouping data, and the number of elements included in the group is not limited b) the format should be able to easily typify the stored data c) the format should not be redundant. It should be easy to read, intuitive, easily editable ...
So, * .properties somehow disappeared. XML is also (point in , IMHO - the format is redundant). I stopped at JSON . But perhaps this is not the most interesting moment.
Organization:
a) it is necessary to provide for the possibility of the existence of a common setting in which all default values are recorded to the maximum b) it is necessary to provide for the possibility of both overlapping default values and using them in the case when the required parameters are not specified in a specific (non-default) setting.
Java:
a) come up with one or several classes that allow you to access the setting as a whole. In my opinion the best treatment is to specify the group and the desired parameter. How to map 'y. b) to come up with one or several abstract classes, the heirs of which could be used to facilitate data access, transform the stored data into more complex objects, if necessary.
In the end, I got something that will be demonstrated below. I know that this is one of the solutions to the described task. Surely full of projects that solved a similar task. Someone probably got something better.
I suggested that the feature can be used for different design needs. But by default it is launching various browsers, mobile applications, setting time outs, various Webdriver options, etc.
So…
Simple demonstration
In this video, I demonstrate the way of preparing the settings and the principle of their joint work on a very simple example.
From myself I want to make a small remake ... The list of types can be expanded. An extension to enums would be useful ( ENUM , let's call it that). With objects of other classes everything is difficult. This and the presence of different variants of non-default constructors. This is an assumption, for example, that you need to use frameworks like Spring and you need to work with bins ...
Below is an example of a slightly more complicated situation.
Demonstration on the example of cross-browser test
Show time! Below I want to demonstrate an example of using features to launch browsers (the same works for mobile applications). This time everything is extremely simple. A user enters a Google search engine, gains something - for example, Hello World Wikipedia - a copy-paste of tests that I drive in front of the builds, and looks that Google has found something. Go!
Objectively, at the moment there is not enough infrastructure around this feature, not counting the launch of Webdriver. What I mean?
Such settings can be used in maven profiles. Need maven plugin. Such settings could be used by systems of continuous integration - the minimum is Jenkins, TeamCity, others as needed. Such settings could be used by frameworks that run tests — for example, for parameterization. Therefore, it would be nice to have plugins, listeners, runners and other plugins for JUnit, TestNG, JBehave and Cucumber JVM. Since there are some rules, format and prepared names of groups and settings, it would be very nice to have a plug-in for IDE (for example Eclipce or IDEa), which has an ergonomic interface that allows you to configure predefined groups and parameter values, as well as create your own .
All this I just did not have time to do. If it makes sense to develop a framework, then they can be made. I will be glad to criticism and suggestions to know where and how to develop the feature. As well as ishama and pull requests.
Announcement
I hope the material did not seem boring to you. I tried my best. I would like to make two more topics. In the following, I would describe the really interesting (killer) features associated with Webdriver and Page / Screen objects. After - chill out, where I would demonstrate some experimental developments, but also interesting.