📜 ⬆️ ⬇️

JDI UI Testing Framework: How and Why to Use

Once upon a time, testers lived in a galaxy far far away. They tested everything that was possible, and it took a lot of time. The era of automated testing has arrived, and with it the frameworks. Many said that it is no longer possible to make the work of testers more efficient and easier. But the JDI developers didn't think so.

Why did you create JDI when there are several frameworks for testing user interfaces anyway? How is it different from others and how to use it?

The automated testing engineers at EPAM, JDI developers - Roman Iovlev and Alexey Girin - answered the questions about the framework that they were asked most often.
')


What is JDI?


JDI is a framework for UI testing. The name stands for Just do it: the main idea of ​​JDI is to make it easy to test and maintain tests using it. This is an open source framework, you can download it from GitHub or from the JDI website . JDI supports Java and C #. We are currently working on Python support.

Why did you create JDI?


New projects are constantly coming to EPAM, and testers need a ready-made solution that allows you to quickly write tests, log all actions in a language understandable to the user, and create visual reports. The tools available for testing UI were not enough for us to work effectively. In Selenium, logging is low-level, and there are no typed elements. In HTML Elements from Yandex, they are there, but this framework is sharpened by the layout of HTML pages. In addition, it has not been updated for a long time . We decided to combine the best that is on the market into one framework. JDI includes practices that are useful wherever you need to test the UI. Including, if we are talking about mobile devices and desktop applications.

But there are a lot of frameworks. How is JDI different from others?


We are often asked which is better: JDI or Selenide, JDI or Cucumber? To compare them is wrong: they can interact perfectly and help each other. Selenium or Selenide are, more likely, drivers for JDI, they are well combined with it, but not competing. But they do not work with typed elements — the level of abstraction that JDI has. Frameworks like Cucumber, which implement BDD, are, on the contrary, above JDI on this scale and implement an additional layer of abstraction. By the way, we recommend using BDD and CI layers together with JDI.

JDI is such an interlayer that allows you to describe Page Objects and works with typed elements that are visible to the user: buttons, forms, tables, dropdowns, and so on. When it comes to typed elements, I mean the idea of ​​an element. For example, what is a button, and that it should be able to, regardless of the specific UI. The button can be in the web or in the mobile application, the layout can be different, it is already a question of implementation. The main thing - there is an idea about the button: it can not be confused with the table or dropdown.

When working with JDI, you do not need to describe low-level actions like searching in a table, filling out a form, or choosing something from the menu: this is already in the framework. JDI elements do exactly what is expected of them: you can click a button, but you cannot write text on it.

When working with JDI, it is additionally necessary to describe only those actions that are associated with a particular business or customer. For example, "buy a product." Typed elements do not know what “buy a product” is, and this should be described on UI objects.



How can the elements be described? Using the FindBy annotation, which is in Selenium, or using JFindBy, which expands the possibilities: you can search by text, by value (value), by type (type). You can describe elements using constructors or interfaces. The latter method has several advantages. For example, you can change the implementation of a button, make a button for the web instead of a mobile, and run tests for the web that you wrote for mobile devices. The tester does not have to change Page Objects and the test script, if the logic has not changed. This is another difference JDI from other frameworks - it is not tied to a specific layout. This is what we lacked in the HTML Elements framework from Yandex. It also uses typed elements, but the framework is focused on the layout of HTML-pages.

Working with simple typed elements - buttons, text - allows you to make tests more intuitive. And working with complex elements - dropdowns, tables, checklists - makes it possible to reduce the amount of code that the tester needs to write. The necessary information about the element (locators, methods) is located in one place, and such code is easier to maintain.

In addition, JDI has already implemented logging and configured integration with reporting systems, which further simplifies the support of such tests.

How to test with JDI?


To get started, JDI needs to be downloaded from GitHub or from the site . You download the archive, where the framework is already fully configured: no need to think about how to start the driver, set up logging and reporting. If you yourself want to customize the project, you can add JDI as dependency to it.

As a default JDI engine uses Selenium. But you can use another engine (even your own), it is easy to configure.

Is it hard to test with JDI?


To start writing tests on JDI, just look at our presentations or examples that are on GitHub. You can come to the testing automation courses that are held by EPAM in St. Petersburg. We teach them to work with JDI, even the students master the framework.

Sometimes testers want to add something to JDI, not knowing that it is more complex inside than outside. Senior level developers will be able to understand the "insides" of the framework.

Do JDI testers use it?


JDI has been used in more than 50 projects in EPAM, and in several dozen projects outside the company.

How is JDI developed?


The framework has been in the public domain for about five years, all this time, developers have eliminated shortcomings and added new features. JDI now has about two dozen active contributors.

On July 25, in St. Petersburg, JDI committees will meet with users. Developers will tell how to implement JDI, what problems they faced and how they were solved.

If you are interested in learning how to work with the framework, register here and follow the news in the JDI group VKontakte .

At Selenium Camp, Roman explained in detail how to use JDI. Here is a video of his speech:



Source: https://habr.com/ru/post/332560/


All Articles