Friday, January 27, 2023
HomeSoftware TestingTake a look at Automation Framework for Testing Your UI with Java

Take a look at Automation Framework for Testing Your UI with Java


Beforehand, I’ve written an article about testing API companies with Java. I believe that it might be a pleasant concept to jot down an article about extra basic check framework, which is able to include components for testing Net UI, be succesful to work together with DB and has logging and superior reporting.

Creator: Oleksandr Podoliako

I’ve a couple of necessities to check object: – it ought to have Net UI and API – it ought to have DB – it must be open supply and free – deploy must be native and straightforward

I’ve chosen KanBoard as a result of it fulfills all the necessities. KanBoard is open supply, free software program, which permits to create Kanban boards with duties.

Deploy will be accomplished with only one command, docker compose up, from the folder, which accommodates docker-compose.yml. For the check framework the file is put in a root folder. I can’t describe the way to set up docker, this info will be gotten right here. By default the KanBoard will probably be out there by the hyperlink http://127.0.0.1/login , consumer has creds admin/admin.

Test Automation Framework for Testing Your UI with Java

The framework was written with java. Maven, Lombok, TestNG, Relaxation Assured, Cucumber, JDBI, Attract and Selenide are used. The framework consists of web page objects; definitions, assertions and hooks; and options layers. Moreover, the check framework has Config, Knowledge era, Shared information, API and DB elements.

Test Automation Framework for Testing Your UI with Java

For example, the consumer can create job check was automated. A consumer, a challenge is created by API as a part of preconditions. All these entities are eliminated by API as a part of postconditions. Moreover, the duty, which is created throughout the check by UI interactions, is eliminated by API in postconditions. Creating and eradicating testing entities will increase exams isolation and improves check’s reliability.

Test Automation Framework for Testing Your UI with Java

Config element has two lessons EnvProperties and PropertiesReader. Part takes information from maven cli parameters. If a parameter isn’t supplied, the element will take the parameter from the env.properties file. Higher to get delicate info from cli as a result of storing delicate info in repo is a foul apply.

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Knowledge era element has DataProvider class and makes use of Faker library. Part generates objects with faux information. Id fields are an exception.

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Shared information has two lessons SharedDataSingelton and SharedData. Sharing information between steps is an issue for cucumber. Thread Singleton can be utilized to resolve the issue. Thread Singleton offers assurance that each thread may have only one container object, which will probably be used to share information.

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

KanBoard has untypical API, which primarily based on HTTP. Publish technique, with particular utility technique (for instance getAllProjects) inside physique, is used. Extra details about API will be gotten by the hyperlink. API element makes use of modified generics method from the earlier article. The objective of the method is to make use of one technique, which will probably be typed in exams. Object illustration of request and response has sophisticated two degree construction. The primary degree consists of RequestWrapper and ResponseWrapper, which accommodates HTTP metadata (Like headers) and utility information. The second degree consists of APIRequestModel, APIResponseArrayModel and APIResponseEntityModel, which accommodates utility metadata (Like jsonrpc) and information(like duties).

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

DB element is used to work together with DB and get object represented outcomes. DB element has TaskDBController, DBController and DBConnection lessons. DBConnection is constructed with utilizing Thread Singleton. It was accomplished to attenuate sources spends. I don’t advocate to make use of DB element to create check information due to information consistency.

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

UI element is used to work together with UI. UI element consists of web page objects. Wrapper strategies, which looking components by textual content is used as a result of some components shouldn’t have good locators. In actual tasks it is strongly recommended so as to add check ids([@testId = ‘taskLabel’]) to pages as an alternative of utilizing looking by textual content.

Test Automation Framework for Testing Your UI with Java

All elements are utilized in definitions, assertions, and hooks. It permits to separate logic and cut back duplication of code.

TestCasesRunnerForTasksFeatures is created to run exams. The category ought to include path to characteristic recordsdata and path to steps. Moreover, eventualities technique is added, which permits to run exams in parallel. Rely of threads will be arrange by altering threadCount choice in maven surefire plugin part in pom.xml file. Native run with intellij concept requires to put in cucumber plugin and modify Run configuration with two choices Principal class: io.cucumber.core.cli.Principal, Glue: steps.hooks steps.definitions steps.assertions.

Test Automation Framework for Testing Your UI with Java

Regression.xml file is created for cli check run. Regression.xml has hyperlink to TestCasesRunnerForTasksFeatures class. Regression.xml must be added as a price to suiteXmlFile choice in maven surefire plugin part in pom.xml file. After that the exams will be run with a command mvn clear check.

Test Automation Framework for Testing Your UI with Java

Attract is used as a reporting device. Attract establishing requires to change choices argLine and attract.outcomes.listing in maven surefire plugin part in pom.xml file. Additionally, attract cli must be put in. The folder goal/allure-results with exams outcomes will probably be created after exams run. Attract report will be deployed regionally with command attract serve goal/allure-results. ReportHooks is used so as to add screenshots.

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Test Automation Framework for Testing Your UI with Java

Slf4j-simple and Relaxation Assured in-built performance is used to do logging on definitions, assertions, and hooks degree.

The complete code will be discovered by the hyperlink.

Concerning the Creator

Oleksandr Podoliako has been working in several software program tasks as a check automation engineer since 2017. His primary know-how stack is the Java stack. He has handed greater than 5 IT certifications. He has written a couple of testing associated matters and has performed greater than 30 interviews in several languages with candidates from everywhere in the world.

This text was initially printed on https://oleksandr-podoliako.medium.com/test-automation-framework-for-ui-testing-with-java-fddd1e3fd75b and is re-published right here with permission.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments