Arachnidium home-made framework for testing web and mobile applications. Part 2. A little about the settings

    Hello again!

    According to the results of a survey that I left in my previous article, “Arachnidium home-made framework for testing web and mobile applications. Get started! ” the majority voted “FOR”. Well, show must go on!

    In this small publication, I will talk about developments that allow you to prepare settings for cross-browser testing of web applications / cross-platform and just launch mobile applications to run the test - within the framework of the described framework. I must say right away that a feature can be perceived ambiguously for certain reasons. Some of them are quite objective and I will name them at the very end of the article.

    This post somehow visualizes the Configuration chapter of my own documentation (while this is a wiki page on github ), which will be updated in the near future. Here we will present a simple example of preparing the setup, 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.

    - What kind of problem did I try to solve?
    - A simple demonstration
    - A demonstration on the example of a cross-browser test
    - What is missing
    - Announcement

    The entire solution is reviewed on github .


    What problem did I try to solve?

    To begin with, I have a significant background for working with a tool such as TestComplete. Below is an example of how this solution suggests setting up a project instance with autotests.


    This is a Suite editor, setting up variables. He suggests
    1. Create a variable
    2. Indicate its type
    3. Indicate the default value
    4. Indicate the local value
    5. If you want, add a description.

    Read more 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 disadvantage of these settings? Yes, in general, it is not. But. Not to say that it’s rare, but there were times when for one (let’s call it that) test session, several different values ​​(logically) of the same variable were needed. Due to the peculiarities of the framework (I would not say that it was bad), the usual means of parameterizing the test 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 there are a great many of their values.
    And all this is recorded in * .properties files .
    Each * .properties filestores 1-several sets of values ​​of the same parameters. The set of parameters is the same from file to file, values ​​are partially the same (to a large extent).
    In my opinion - not convenient and redundant!

    So. The examples above lack, in my opinion, what OOP calls inheritance / overlap.


    I decided for the described operating time to come up with my own way of tuning with blackjack and with the following properties:

    a) the format should allow grouping the data, and the number of elements included in the group is not limited
    b) the format should be able to simply typify the stored data
    c) the format should not be redundant. It should be easy to read, intuitive, easy to edit ...

    So * .properties somehow disappeared. XML too (point in , IMHO - the format is redundant). I settled on JSON . But perhaps this is not the most interesting moment.

    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 their use when the required parameters are not specified in a specific (non-default) setting.

    a) come up with one or several classes that allow you to access the configuration as a whole. In my opinion, the best option is to specify the group and the desired parameter. How to Map .
    b) come up with one or several abstract classes, the descendants of which could be used to facilitate access to data, transform 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 options for solving the described problem. Surely full of projects in which a similar problem was solved. Someone, for sure, did something better.

    I suggested that the feature can be used for different project needs. But the default is to launch various browsers, mobile applications, set timeouts, various Webdriver options, etc.


    Simple demonstration

    In this video, I demonstrate a way to prepare settings and the principle of their collaboration using a very simple example.

    From myself I want to make a small remark ... The list of types can be expanded. An extension to enumerations would be useful ( ENUM , let's call it that). With objects of other classes, everything is complicated. This and the presence of different options for 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.

    Cross-browser test demo

    Show time! Below I want to demonstrate an example of using a feature to launch browsers (the same thing works for mobile applications). This time everything is extremely simple. A user goes into a Google search engine, types something - for example, Hello World Wikipedia - a copy paste from the tests that I drive in front of builds, and looks that Google has found something. Go!

    Similar examples are available on github:

    What is missing.

    Objectively, at the moment there is not enough infrastructure around this feature, apart from launching Webdriver. What I mean?

    Such settings can be used in maven profiles. Need a maven plugin.
    Such settings could be used by continuous integration systems - at least it is Jenkins, TeamCity, others as necessary.
    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 blotches for JUnit, TestNG, JBehave and Cucumber JVM.
    Since there are some rules, format, and prepared names for groups and settings, it would be very nice to have a plug-in for IDEs (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 in order to know where and how to develop the feature. As well as ishams and pull requests.


    I hope the material didn’t seem boring to you. I tried my best.
    I would like to make two more topics. In the following, I would describe really interesting (killer) features related to Webdriver and Page / Screen objects. After - chill out, where I would demonstrate some experimental developments, but also interesting.

    Only registered users can participate in the survey. Please come in.

    But is it necessary?

    • 94.1% yes +1 16
    • 11.7% no -1 2

    Also popular now: