Showing posts with label Software Testing. Show all posts
Showing posts with label Software Testing. Show all posts

Friday, September 8, 2023

Does it make sense to use the Page object in a project with API tests?

 



Udemy Course: Playwright TypeScript Automation Testing

There be more suitable approaches than using the Page Object pattern in an API test automation project. The Page Object pattern is used in end-to-end test automation testing(with libraries like Selenium, Cypress, and PlayWright). You abstract web pages into objects to make the test code more readable, maintainable, and reusable. It helps interact with and manipulate web elements like buttons, forms, and links.


In API testing, you deal with an application's backend, Sending HTTP requests and validating the responses. The concepts of web pages and UI elements do not apply in the same way as they do in UI automation testing. Instead, in API testing, you work with the following:


1. HTTP Requests: You send HTTP requests (e.g., GET, POST, PUT, DELETE) to specific API endpoints to interact with the backend services.


2. Response Validation: You confirm the responses received from the API endpoints. You check for expected status codes, headers, and response data structures.


3. Data Manipulation: You might need to manipulate and process data returned by the API. For example, you will extract values for further use or transform data to validate assertions.


In API testing, it's more common to organize your code around HTTP request libraries or frameworks (e.g., using tools like Postman, RestAssured, or Python's requests library). Yet, you can still apply some best practices listed to make your API tests maintainable:


Modularization: Organize your API requests and response validation code into reusable functions or modules. This makes it easier to maintain and update your tests.


Configuration Management: Store API endpoints, request headers, and other configuration settings in a central location or configuration files to ensure consistency and ease of maintenance.


Test Data Management: Handle test data from test code so you can change data inputs and expected outputs without modifying your test scripts.


Test Reporting: Implement a reporting mechanism to track test results and monitor the health of your API endpoints.


In summary, while the Page Object pattern is valuable for UI automation testing, it does not apply to API testing. Instead, prioritize organizing your API testing code to make it readable, maintainable, and efficient for working with HTTP requests and responses.

Monday, April 19, 2021

Introduction to Robot Framework, Test Automation and RPA Tool

What is Robot Framework

Robot Framework is a test automation framework. Robot Framework is a keyword-driven automation framework. It is written in Python but you can use it without knowing the language. Robot Framework is also known as RF.


Keywords in Robot Framework

To create automation scripts using Robot Framework, we utilize certain predefined keywords.

Some examples of keywords are

  • Click Button
  • Wait Until Element is Visible
  • And
  • Input Text


All of these keywords take parameters that are used to control their behavior.

For example, the keyword Click Button and the keyword Wait Until Element is Visible of Selenium Library allow us to supply the information about the button we want to click and the element we want to wait for. 


The Input text keyword lets us specify two things:

1. where we want to input text

2. what text do we want to input.


Many keyword libraries for Robot Framework are available. You can test almost any system using Robot Framework libraries. 


The numerous versatile libraries are the real superpower of Robot Framework. It is possible to create complete test automation and quality assurance solutions with Robot Framework. 




Advantages of Robot Framework

Robot Framework is Python-based, but unlike many other automation tools, you don’t need to take a programming course before you start to learn Robot Framework.

The requirement to learn a programming language such as Python, Java, or C# is the first barrier of entry for many QA professionals who want to learn test automation. Python Framework liberates you from this prerequisite.


We can use multiple IDEs to write Robot Framework tests. 

For example, IntelliJ PyCharm IDE, Microsoft Visual Studio Code IDE, and the open-source Robot IDE or RIDE. 

On an interesting side note, Robot Framework can also be used in a Java-based ecosystem through Jython and in .Net through IronPython.

Robot Framework can also be used for Robotic Process Automation(RPA). 


Where You Shouldn't Use Robot Framework

Robot Framework is not a record and playback-based test automation tool. It is more like  Lego for test automation. Many ready-made pieces are available for you to combine and make your own masterpiece.


The first version of Robot Framework was launched in 2005. Robot Framework has very strong community support. The Slack channel RobotFramework is very active.

Robot Framework version 7.1.1, which was released on October 19, 2024..

A lot of libraries are available to be used with Robot Framework.


Popular Robot Framework Libraries

A list of popular robot framework libraries is given below:

  • Selenium Library
  • Appium Library
  • Request
  • Soap Library
  • Database Library
  • Browser Library
  • Archive Library


Robot Framework is an easy-to-use, versatile, and extensive tool. It has survived the test of time and it is here to stay.


Let us proceed toward installing the tools needed to start using Robot Framework. 


All articles in the Robot Framework Series


  1. Introduction to Robot Framework, Test Automation, and RPA Tool
  2. Installing RobotFramework, RobotFrameworkSelenium, Python on your PC & updating Pip
  3. Robot Framework with VS Code and RF Language Server
  4. The role of browser driver in test automation and downloading Google ChromeDriver to use with Selenium and Robot Framework

Sunday, February 16, 2020

Disadvantages of automated functional testing



Disadvantages of Automated Functional Testing

  1. The machine used for running scripts gets occupied until the test automation activity is finished(true for Selenium, Appium, WinAppDriver, and CodedUI). 
  2. Small mistakes at the wrong time can fail your automated testing scripts. For example, hitting the enter key while UI automated testing is in progress might cause an unwanted popup or a form to submit, which could lead to a test failure.
  3. Automated black box testing (a.k.a functional UI testing) is slow. (true for Selenium, Appium, WinAppDriver, and CodedUI)
  4. Many resources are needed to run multiple tests in parallel(although it might not be possible to run specific tests in parallel due to application domain requirements).
  5. You can't pinpoint the cause of the fault, you only get to know the steps to reproduce, and the developers have to find the root cause of the bug later.
  6. Automated functional tests are flaky and fail due to small changes in the application UI. 

Automation testing is the buzzword of the day. But we must know that some types of test automation are less valuable than some other types of automated testing. 

Not all automated tests are created equal.

UI-driven testing, known as end-to-end or functional testing, is, on the surface, the easiest to get going. As a result, tools like Selenium, Appium, Coded UI, WinAppDriver, WebDriver.IO, and PostMan are in high demand. But there are still some disadvantages of automated UI testing, briefly summarized here for you. 


The best thing you can do is to automate unit testing and then integration testing. That's where you're going to get the most coverage. 


Saturday, January 11, 2020

Software testing and automated testing tools


Software testing is a quality control activity. It is considered to be a repetitive and labor-intensive task.
Computers in general are you know capable of doing such repetitive, boring, and labor-intensive tasks really well.
Appium WinAppDriver: Automated UI Testing Windows Apps in C#
Appium WinAppDriver: Automated UI Testing Windows Apps in C#
Learn more about automated testing of Windows applications by clicking the link below.
https://www.udemy.com/course/appium-winappdriver-automation-testing/?referralCode=ED22C3A4CE5BB5E22E53

This leads us to software test automation and automated testing tools.
Software Test Automation tools help us to delegate laborious;  repetitive tasks to the computers, because that’s what computers do best.
Making the machines do the software testing job frees up time for Homosepians!, allowing them to be creative; something the machines can’t do well. At least at the time when this course was being created.
Automated software tests can be broadly broken into two categories.

  • Automated white box testing, such as 
    • Unit tests
    • Integration tests
    • API tests(Postman is a popular API testing tool)
  • Automated black box testing which includes
    • Automated UI testing(Robot Process Automation, RPA is a relevant field)

Test automation can be divided in two major phases…

First is “Creating scripts intended to exercise various parts of the software system under test and assert the results shown by the System Under Test or SUT.”

The second is “Running the test scripts to exercise the system and display the results.”
Any programming language can be used to write these scripts. For example, we will use C# .Net and Java.
Once the test scripts are in place, proper tools are also available to run the scripts.
Tests are commonly executed by test run agents.
For Visual Studio Unit Testing Framework, these are called agents. For UIPath, these are called robots.


In general, when we run test scripts, they either pass or fail based on the response of the system under test.

We can see these reports to assess the correctness of the system in a “quantitative fashion.”
UI Path Orchestrator
A developer can run these tests on one machine or on many machines using test control systems like Microsoft TFS or UiPath Orchestrator.

Jenkins is another such tool popular in the Java community.
Several types of automated testing tools are available in the market
These tools facilitate the process of writing and running test scripts
These tools also commonly include utility software to record user actions and prepare test scripts based on those actions
Some popular test automation (and RPA) tools are

Selenium and rarely used Selenium Recorder.
Appium for iOS and Android automated testing
UiPath
Appium-based WinAppDriver for testing Windows applications
I hope you found this video to be useful. Please like it and share it with your QA friends.
Do subscribe to my channel as well.