<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>QA &#8211; Nearshore Software Development Company &#8211; IT Outsourcing Services</title>
	<atom:link href="https://nearshore-it.eu/tag/quality-assurance/feed/" rel="self" type="application/rss+xml" />
	<link>https://nearshore-it.eu</link>
	<description>We are Nearshore Software Development Company with 14years of experience in delivering a large scale IT projects in the areas of PHP, JAVA, .NET, BI and MDM.</description>
	<lastBuildDate>Wed, 02 Apr 2025 10:55:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>

<image>
	<url>https://nearshore-it.eu/wp-content/uploads/2023/01/cropped-inetum-favicon-300x300-1-32x32.png</url>
	<title>QA &#8211; Nearshore Software Development Company &#8211; IT Outsourcing Services</title>
	<link>https://nearshore-it.eu</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PyTest + AWS Lambda function. Introduction to Python Unit Testing</title>
		<link>https://nearshore-it.eu/technologies/pytest-aws-lambda-introduction-to-python-unit-testing/</link>
					<comments>https://nearshore-it.eu/technologies/pytest-aws-lambda-introduction-to-python-unit-testing/#respond</comments>
		
		<dc:creator><![CDATA[Sebastian Barej]]></dc:creator>
		<pubDate>Thu, 15 Feb 2024 15:24:55 +0000</pubDate>
				<category><![CDATA[Technologies]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=26905</guid>

					<description><![CDATA[In today's fast-developing cloud environment, developers need tools for building scalable and flexible serverless applications. However, to maintain the high quality of code and application functionality, the effective unit testing of serverless functions is crucial. If you are working in an AWS environment and wondering how to effectively perform unit testing for AWS Lambda with the PyTest framework, you should find some tips in my article. Let’s take a look at some practical examples of testing AWS Lambda code.]]></description>
										<content:encoded><![CDATA[
<p></p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#AWS-Lambda-at-a-glance">1.  AWS Lambda at a glance  </a></li>
                    <li><a href="#The-testing-challenge.-Why-do-you-need-to-test-serverless-applications?">2.  Why is test coverage within a Lambda function so important?  </a></li>
                    <li><a href="#Why-is-test-coverage-within-a-Lambda-function-so-important?">3.  Why is test coverage within a Lambda function so important?  </a></li>
                    <li><a href="#What-exactly-is-PyTest?">4.  What exactly is PyTest?  </a></li>
                    <li><a href="#Practical-applications-of-unit-testing">5.  Practical applications of unit testing </a></li>
                    <li><a href="#Techniques-of-testing-AWS-Lambda-functions">6.  Techniques of testing AWS Lambda functions  </a></li>
                    <li><a href="#How-to-start-unit-testing-with-the-PyTest-framework">7.  How to start unit testing with the PyTest framework  </a></li>
                    <li><a href="#Practical-application-of-more-advanced-unit-testing-and-mocking-of-AWS-services-for-Lambda-">8.  Practical application of more advanced unit testing and mocking of AWS services for Lambda </a></li>
                    <li><a href="#How-to-interpret-tests">9.  How to interpret tests  </a></li>
                    <li><a href="#FAQ">10.  FAQ </a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="AWS-Lambda-at-a-glance--">AWS Lambda at a glance</h2>



<p>Let&#8217;s start with the fact that serverless services are currently some of the most advanced features of cloud computing. Today, every cloud provider has <strong>function-as-a-service </strong>solutions in their offer. In the project I am involved in, we use AWS Lambda (read more about its capabilities in this article: <a href="https://nearshore-it.eu/articles/aws-lambda-serverless-applications/" target="_blank" rel="noreferrer noopener">AWS Lambda Functions).</a>&nbsp;</p>



<p>In a nutshell, AWS Lambda is a serverless service provided by Amazon Web Services that allows developers to run code in the cloud in response to various events. The serverless model means that infrastructure management is on the cloud provider&#8217;s side. This makes it just perfect for developing applications requiring rapid scaling and efficient resource management.&nbsp;</p>



<p>Also read:&nbsp;</p>



<ul class="wp-block-list">
<li><a href="https://nearshore-it.eu/articles/selenium-python-vs-selenium-java/" target="_blank" rel="noreferrer noopener">Automation testing tools: Selenium + Python vs Selenium + Java&nbsp;</a>&nbsp;</li>



<li><a href="https://nearshore-it.eu/articles/technologies/python-pandas-tutorial-check-our-complete-introduction-to-pandas/" target="_blank" rel="noreferrer noopener">Python libraries &#8211; Pandas&nbsp;</a>&nbsp;</li>
</ul>



<h2 class="wp-block-heading" id="The-testing-challenge.-Why-do-you-need-to-test-serverless-applications?">The testing challenge. Why do you need to test serverless applications?</h2>



<p>What do standard applications and serverless applications have in common? Both should pass unit tests. Testing serverless Lambda function code is quite a challenge. Using my project as an example, I would like to present the challenges we face as a team in the context of the unit testing of our application.&nbsp;<br>&nbsp;<br>Firstly, AWS Lambda functions are often tightly integrated with <strong>other cloud resources, </strong>such as databases or message queues. This can cause problems if developers want to isolate unit tests, as we <strong>need to create tests independent of other components.</strong> In any scenario, we need to ensure that our unit tests do not affect the state of other services (such as changing records in a database).&nbsp;</p>



<p>Another challenge is handling asynchronous communication. In many scenarios, our application responds to asynchronous events such as processing an incoming message from a queue. Testing such cases requires appropriate strategies to <strong>keep control of the data flow</strong> and ensure that the application behaves as we expect.&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="Why-is-test-coverage-within-a-Lambda-function-so-important?">Why is test coverage within a Lambda function so important?</h2>



<p>Before getting into the practical aspects of unit testing, let&#8217;s see why it is so important, especially in the context of Lambda functions.&nbsp;</p>



<h3 class="wp-block-heading">Keeping functions working correctly&nbsp;&nbsp;</h3>



<p>Lambda functions are often small pieces of code invoked by specific events. Unit tests help ensure that these functions behave as expected in different scenarios.&nbsp;&nbsp;</p>



<h3 class="wp-block-heading">Quick error detection&nbsp;&nbsp;</h3>



<p>AWS Lambda can respond to various events. If your unit tests are well-written, it can quickly detect errors in the code while the product is still being developed. Unit testing is crucial, as it allows you to avoid introducing errors into the production environment and thus ensures that the application is reliable at this stage.&nbsp;</p>



<h3 class="wp-block-heading">Shortening the development cycle&nbsp;&nbsp;</h3>



<p>Unit testing enables developers to iterate quickly when making changes to code. By shortening the development cycle, the application is developed faster and the value is delivered quicker. &nbsp;<br>&nbsp;<br>Now that we know why unit testing is important, let&#8217;s consider how to do it effectively with the PyTest framework.&nbsp;</p>



<h2 class="wp-block-heading" id="What-exactly-is-PyTest?">What exactly is PyTest?</h2>



<p>PyTest is a tool for testing code in Python which allows you to write both simple and complex tests. Among the available tools, Selenium, <a href="https://nearshore-it.eu/articles/end-to-end-testing-with-cypress/" target="_blank" rel="noreferrer noopener">Cypress</a>, Playright, or Robot Framework are popular (we have already discussed them for you in other articles and on webinars). It&#8217;s time to take a closer look at PyTest, which is particularly useful in an AWS Lambda function environment, as it allows local testing before deployment.&nbsp;</p>



<p>What is more, thanks to its integration with mocking libraries such as <strong>Moto</strong>, you can simulate (&#8220;mock&#8221;) AWS services directly in your local environment. This will allow you to test your code thoroughly before deploying to the AWS cloud.&nbsp;</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="PyTest + AWS Lambda function. Introduction to Python Unit Testing 1"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="Practical-applications-of-unit-testing">Practical applications of unit testing</h2>



<h3 class="wp-block-heading">1. Handling expected errors&nbsp;</h3>



<p>Let&#8217;s assume we are developing a Lambda function to process online orders. The unit tests may include error-handling scenarios, such as no connection to the database or a problem with a third-party payment provider. By ensuring that the function handles these situations correctly, we can increase the system&#8217;s resilience to failures.&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># An example of code for error-handling 

 

def test_error_handling():  

 

 # We simulate a database communication error  

 

 event = {"order_id": "123"}  

 

 result = process_order(event, None)  

 

  

 

 assert result == {"statusCode": 500, "message": "Internal server error"}  </pre>



<h3 class="wp-block-heading">2. Validation of input data&nbsp;&nbsp;</h3>



<p>Lambda functions are often called by events, and the input data is crucial for the function to work correctly. Unit tests can cover different instances of input data. You gain confidence that the function validates them correctly and responds as expected.&nbsp;</p>



<p></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> #Example of a unit test for validating input data
def test_input_validation():  

 

 event = {"customer_id": "123", "order_total": 50.0}  

 

 result = process_order(event, None)  

 

 assert result == {"statusCode": 200, "message": "Order processed successfully"}  

# We test invalid input data
 
 event_invalid = {"customer_id": "abc", "order_total": "invalid"}  

 

 result_invalid = process_order(event_invalid, None)  

 

 assert result_invalid == {"statusCode": 400, "message": "Invalid input data"}  
</pre>



<h3 class="wp-block-heading">3. Integrations with AWS services&nbsp;&nbsp;</h3>



<p>Lambda functions often use other AWS services, such as the storage service S3 or the NoSQL database service DynamoDB. We can use mocking techniques to avoid actual calls to these services while testing. PyTest offers the pytest-mock module, which makes it easy to create mocks for selected services.&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pytest  

 

from my_module import process_s3_event  

# An example of a unit test using pytest-mock to mock an AWS service 

def test_s3_upload(mocker):  
 # We create a mock of the S3 client 

 

 s3_client_mock = mocker.Mock()  

 

 # We update the (“patch”) "boto3.client" function in such a way that it returns our mock  

 

 mocker.patch("boto3.client", return_value=s3_client_mock)  

 

  

 

 # We create an example of an event  

 

 event = {"data": "example"}  

 

 # We call the function that processes the event  

 

 result = process_s3_event(event, None)  

 

  

 

 # We check if the function has returned the expected result  

 

 assert result == {"statusCode": 200, "message": "S3 event processed successfully"}  

 

 # We check that the "upload_file" method on the S3 client's mockup was called exactly once 

 

 s3_client_mock.upload_file.assert_called_once_with("source_file", "bucket", "destination_key")  
</pre>



<h3 class="wp-block-heading">4. Multi-layer applications&nbsp;&nbsp;</h3>



<p>In a <a href="https://nearshore-it.eu/articles/technologies/microservices-architecture-explained-is-it-still-a-revolution-or-already-standard-in-it-projects/" target="_blank" rel="noreferrer noopener">microservice architecture</a>, where Lambda functions act as microservices, unit testing becomes even more complex. A unit testing framework like PyTest allows you to create layered tests that check integrations between various microservices.&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pytest  

 

from my_module import process_microservices  

 

  

 

# An example of a multi-layer unit test 

 

def test_microservices_integration(mocker):  

 

 # We create a mock for Lambda A function  

 

 lambda_a_mock = mocker.Mock()  

 

 # We create a mock for Lambda B function  

 

 lambda_b_mock = mocker.Mock()  

 

  

 

 # We define what data will be passed between microservices 

 

 event_a_to_b = {"data": "example_data_from_A_to_B"}  

 

 event_b_to_a = {"data": "example_data_from_B_to_A"}  

 

  

 

 # We determine what should be returned by mocks of the Lambda function  

 

 lambda_a_mock.return_value = {"statusCode": 200, "message": "Response from Lambda A"}  

 

 lambda_b_mock.return_value = {"statusCode": 200, "message": "Response from Lambda B"}  

 

  

 

 # We patch the imports in the process_microservices function to use our mocks 

 

 mocker.patch("your_module.lambda_a_function", lambda_a_mock)  

 

 mocker.patch("your_module.lambda_b_function", lambda_b_mock)  

 

  

 

 # We call the process_microservices function with sample data 

 

 result = process_microservices(event_a_to_b, None)  

 

  

 

 # We check if the function has returned the expected result after the integration of microservices 

 

 assert result == {"statusCode": 200, "message": "Microservices processed successfully"}  

 

  

 

 # We check that Lambda functions A and B were called with the right data 

 

 lambda_a_mock.assert_called_once_with(event_a_to_b, None)  

 

 lambda_b_mock.assert_called_once_with(event_b_to_a, None)  
 
</pre>



<h2 class="wp-block-heading" id="Techniques-of-testing-AWS-Lambda-functions">Techniques of testing AWS Lambda functions</h2>



<h3 class="wp-block-heading">1. Fault tolerance testing&nbsp;&nbsp;</h3>



<p>This is a key component of AWS Lambda function testing. Fault tolerance testing covers scenarios in which one of the AWS services working with the function is unavailable or returns errors. An example of the test may look like this:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pytest  

 

from unittest.mock import patch, Mock  

 

  

 

  

 

# Example of a fault-tolerance test  

 

def test_error_resilience(mocker):  

 

 # We mock a service that returns an error  

 

 external_service_mock = mocker.Mock()  

 

 external_service_mock.side_effect = Exception("Service unavailable")  

 

  

 

 mocker.patch("boto3.client", return_value=external_service_mock)  

 

  

 

 event = {"data": "example"}  

 

 result = process_event(event, None)  

 

 assert result == {"statusCode": 500, "message": "Internal server error"}  

 

  

 

  

 </pre>



<h3 class="wp-block-heading">2. Test-Driven Development (TDD) tests&nbsp;</h3>



<p>The practice of TDD means writing unit tests before implementing functions. This allows for a more informed code design and ensures that tests cover every line of code.&nbsp;</p>



<p>Below is an example of TDD for a Lambda function:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pytest  

 

  

 

# Example of unit testing with TDD  

 

def test_tdd():  

 

 event = {"data": "example"}  

 

 result = process_event(event, None)  

 

 assert result == {"statusCode": 200, "message": "Event processed successfully"}  

 

  

 

 # We add a new functionality and write a test for it first 

 

 new_feature_result = new_feature(event)  

 

 assert new_feature_result == {  

 

 "statusCode": 200,  

 

 "message": "New feature processed successfully",  

 

 }  
  

 </pre>



<h3 class="wp-block-heading">3. Using Fixture in PyTest&nbsp;&nbsp;</h3>



<p>PyTest Fixtures are functions that run before tests (and optionally after them) that can prepare the necessary resources. For example, a fixture can create a fake input or configure a mock of any AWS resource before running tests. This way, each test runs in an isolated and controlled environment.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import boto3  

 

import pytest  

 

from moto import mock_s3  

 

  

 

@pytest.fixture()  

 

def mock_s3_resource():  

 

 with mock_s3():  

 

 # We use Moto library to simulate the S3 service  

 

 import boto3  

 

  

 

 s3 = boto3.resource("s3", region_name="us-east-1")  

 

 # Crearing mock – AWS S3 resource 

 

 s3.create_bucket(Bucket="mocked-bucket")  

 

 yield s3  

 

 # Teardown (resource cleansing) is not required, Moto performs automatic cleansing  

 

  

 

# We use a decorator to turn on S3 simulation for the test  

 

@mock_s3  

 

def test_s3_operations(mock_s3_resource):  

 

 s3 = mock_s3_resource  

 

  

 

 # Perform requested operations on S3  

 

 s3.Object("mocked-bucket", "test.txt").put(Body="Hello, World!")  

 

  

 

 # Check if the performed operations were successful  

 

 obj = s3.Object("mocked-bucket", "test.txt").get()  

 

 assert obj["Body"].read().decode("utf-8") == "Hello, World!"  </pre>



<h3 class="wp-block-heading">4. Parameterization of tests&nbsp;</h3>



<p>Parameterization allows you to run the same test with different input data sets. Using the @pytest.mark.parametrize decorator, you can specify different data sets for a single test function. This way, you can easily verify the performance of Lambda functions in different scenarios without writing multiple similar tests.&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">@pytest.mark.parametrize(  

 

 "input, expected",  

 

 [  

 

 ({"data": "example1"}, {"statusCode": 200, "message": "Success"}),  

 

 ({"data": "example2"}, {"statusCode": 400, "message": "Error"}),  

 

 ],  

 

)  

 

def test_lambda_function(input, expected):  

 

 result = lambda_handler(input, None)  

 

 assert result == expected  </pre>



<h2 class="wp-block-heading" id="How-to-start-unit-testing-with-the-PyTest-framework">How to start unit testing with the PyTest framework</h2>



<h3 class="wp-block-heading">PyTest installation&nbsp;</h3>



<ol class="wp-block-list" start="1">
<li>Make sure you have Python installed on your system.&nbsp;&nbsp;</li>



<li>Open a terminal or command line.&nbsp;&nbsp;</li>



<li>To install PyTest, type the following command:&nbsp;</li>
</ol>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install pytest  </pre>



<p>3. If you plan to use libraries like Moto for more advanced testing, of course, you will need to install them as well – for example:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install moto  </pre>



<p><strong>Test preparation&nbsp;</strong>&nbsp;</p>



<ol class="wp-block-list" start="4">
<li>Prepare your unit tests in Python (.py) files that contain test functions. Your tests should be organized following the PyTest convention, in which test function names start with &#8220;test_&#8221;.&nbsp;&nbsp;</li>
</ol>



<p><strong>Running tests&nbsp;</strong>&nbsp;</p>



<ol class="wp-block-list" start="5">
<li>In the terminal, navigate to the directory where your test files are located, or, if they are in the same directory as the terminal, you can skip this step.&nbsp;</li>
</ol>



<ol class="wp-block-list" start="6">
<li>To execute all defined tests from a given file, use the following command, specifying the name of the test file:&nbsp;</li>
</ol>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pytest file_name.py  </pre>



<p>For example, if your tests are in the my_tests.py file, the command will look like this:&nbsp;&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pytest my_tests.py  </pre>



<p>If you want to test all files located in the current directory, use the command:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pytest .  </pre>



<h3 class="wp-block-heading">Test results analysis&nbsp;</h3>



<ol class="wp-block-list" start="8">
<li>Once the tests are executed, PyTest will provide detailed information about the test run and its results. You will see which tests succeeded, which failed, and why.&nbsp;</li>
</ol>



<h2 class="wp-block-heading" id="Practical-application-of-more-advanced-unit-testing-and-mocking-of-AWS-services-for-Lambda-">Practical application of more advanced unit testing and mocking of AWS services for Lambda&nbsp;</h2>



<p>Now that you know what the PyTest framework is, what unit tests are for, and how they can be used with various techniques, it&#8217;s time to move on to a more advanced, practical application of unit testing and AWS service mocking for Lambda functions. When developing serverless event-driven applications using AWS Lambda, the best practice is to validate individual components and services.&nbsp;&nbsp;</p>



<p>Now let&#8217;s get into an example of a function for handling notifications in the cloud. Imagine that we have an application that needs to quickly notify users about various events – from a meeting reminder to a sale notification.&nbsp;&nbsp;</p>



<p>That&#8217;s where AWS SNS, a service that allows you to send notifications in the form of messages to a wide range of subscribers, comes in. We can think of it as a cloud-based instant messaging system. Here, the AWS Lambda function acts as an intermediary – it accepts specific requests and forwards them to SNS, which then handles the distribution of messages.&nbsp;</p>



<h2 class="wp-block-heading">How does it work? The process is simple:&nbsp;&nbsp;</h2>



<ol class="wp-block-list" start="1">
<li><strong>Message preparation: </strong>The Lambda function takes two key elements – the identifier of the SNS subject (to whom we want to send the notification) and the message content.&nbsp;&nbsp;</li>



<li><strong>Sending the message: </strong>The function communicates with the SNS using a special API to deliver the message to the specified subject.&nbsp;</li>
</ol>



<p>You may be wondering: how can we trust that this function works properly? The answer lies in <strong>unit testing</strong> itself.<strong> We run test scenarios to make sure our code does exactly what it&#8217;s supposed to do in different situations</strong>. We simulate (&#8220;mock&#8221;) the operation of the SNS service to see how the function behaves when everything goes successfully, and how it handles any errors.&nbsp;</p>



<p>Before writing the first unit test, we will look at an example of the AWS Lambda function we want to test:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">main.py:  

 

import boto3  

 

import json  

 

  

 

def send_notification(sns_topic_arn, message):  

 

 if not message:  

 

 raise ValueError("Message cannot be empty")  

 

 try:  

 

 sns_client = boto3.client("sns")  

 

 response = sns_client.publish(TopicArn=sns_topic_arn, Message=message)  

 

 return response  

 

 except boto3.exceptions.Boto3Error as e:  

 

 print(f"Error sending notification: {e}")  

 

 raise  

 

  

 

def lambda_handler(event, context):  

 

 # Parsowanie zdarzenia wejściowego  

 

 sns_topic_arn = event.get("sns_topic_arn")  

 

 message = event.get("message")  

 

  

 

 # Validation of input data  

 

 if not sns_topic_arn or not message:  

 

 return {"statusCode": 400, "body": json.dumps("Missing sns_topic_arn or message")}  

 

  

 

  try:  

 

 # Calling function sending notification  

 

 response = send_notification(sns_topic_arn, message)  

 

 return {"statusCode": 200, "body": json.dumps("Notification sent successfully")}  

 

 except Exception as e:  

 

 return {"statusCode": 500, "body": json.dumps(str(e))}  

 

  

  

 

import pytest  

 

import boto3  

 

from moto import mock_sns  

 

from unittest.mock import patch  

 

from main import lambda_handler # Importing from a handler  

 

  

 

# Preparing test environment  

 

@mock_sns  

 

class TestLambdaFunction:  

 

 # Test to see if we correctly handle the situation when input is missing 

 

 def test_missing_data(self):  

 

 response = lambda_handler({"sns_topic_arn": "", "message": ""}, None)  

 

 assert response["statusCode"] == 400  

 

 assert "Missing sns_topic_arn or message" in response["body"]  

 

  

 

 # Test to see if the function sends the notification correctly 

 

 @patch("main.boto3.client")  

 

 def test_send_notification_success(self, mock_boto3_client):  

 

 mock_sns_client = boto3.client("sns")  

 

 mock_boto3_client.return_value = mock_sns_client  

 

 mock_sns_client.publish.return_value = {"MessageId": "12345"}  

 

  

 

 response = lambda_handler(  

 

 {  

 

 "sns_topic_arn": "arn:aws:sns:region:123456789012:testTopic",  

 

 "message": "Test message",  

 

 },  

 

 None,  

 

 )  

 

 assert response["statusCode"] == 200  

 

 assert "Notification sent successfully" in response["body"]  

 

  

 

 # Test to check how the functions cope with SNS errors  

 

 @patch("main.boto3.client")  

 

 def test_sns_error(self, mock_boto3_client):  

 

 mock_sns_client = boto3.client("sns")  

 

 mock_boto3_client.return_value = mock_sns_client  

 

 mock_sns_client.publish.side_effect = boto3.exceptions.Boto3Error  

 

  

 

  response = lambda_handler(  

 

 {  

 

 "sns_topic_arn": "arn:aws:sns:region:123456789012:testTopic",  

 

 "message": "Test message",  

 

 },  

 

 None,  

 

 )  

 

 

 assert response["statusCode"] == 500  </pre>



<h2 class="wp-block-heading" id="How-to-interpret-tests">How to interpret tests</h2>



<ul class="wp-block-list">
<li><strong>test_missing_data: </strong>We check if the function responds correctly when we do not provide the required data. We expect a response with<strong> error code 400,</strong> meaning the query was invalid.&nbsp;&nbsp;</li>



<li><strong>test_send_notification_success: </strong>Here we simulate a situation in which everything goes successfully (the so-called &#8220;happy path&#8221;). We use <strong>mock_boto3_client </strong>to simulate the interaction with SNS, and then check if the function returns a success code of 200 and the corresponding message.&nbsp;&nbsp;</li>



<li><strong>test_sns_error: </strong>We test how the function will behave when the SNS reports an error. Again, we simulate interactions with the SNS and check if the function handles the error correctly, returning a status code of <strong>500.&nbsp;</strong></li>
</ul>



<p>Remember, these tests are just examples. You may want to test more scenarios to make sure a function works as it should in all possible situations. Unit tests can greatly improve the quality and reliability of your code, so it&#8217;s worth paying proper attention to them!&nbsp;</p>



<h2 class="wp-block-heading" id="FAQ">FAQ – frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-1708004990425" class="rank-math-list-item">
<h3 class="rank-math-question ">What and how should we test in AWS Lambda functions?  </h3>
<div class="rank-math-answer ">

<p>Testing AWS Lambda functions should cover all key aspects, such as business logic, error handling, interactions with AWS services, and performance. It&#8217;s also a good idea to test functions with different inputs to make sure they behave correctly in various scenarios.  </p>

</div>
</div>
<div id="faq-question-1708005047427" class="rank-math-list-item">
<h3 class="rank-math-question ">Why should you test your AWS Lambda functions?  </h3>
<div class="rank-math-answer ">

<p>Testing AWS Lambda functions is key to maintaining high-quality code and application functionality. Through unit testing, developers can quickly identify and eliminate errors, resulting in more reliable and efficient applications. </p>

</div>
</div>
</div>
</div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">AWS cloud function testing in Python – summary&nbsp;&nbsp;</h2>



<p>Unit testing of AWS Lambda functions with PyTest is more than just a code validation process! It&#8217;s also an opportunity to develop more stable, reliable, and efficient applications. Practical usages of unit testing include error handling, input validation, integration with AWS services, performance optimization, and fault tolerance testing. Advanced techniques, such as using PyTest fixtures and test parameterization, allow you to keep even tighter control of code quality. Unit testing is not only a pre-implementation step, but also a key part of continuous application improvement in the dynamic world of the cloud.&nbsp;&nbsp;</p>



<p>I hope this article has helped you understand how we can use unit testing and AWS service mocking to ensure the reliability and correctness of our AWS Lambda functions.</p>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/technologies/pytest-aws-lambda-introduction-to-python-unit-testing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Non functional testing – all you need to know</title>
		<link>https://nearshore-it.eu/technologies/non-functional-testing/</link>
					<comments>https://nearshore-it.eu/technologies/non-functional-testing/#respond</comments>
		
		<dc:creator><![CDATA[Tomasz Nykiel]]></dc:creator>
		<pubDate>Thu, 11 Jan 2024 05:08:00 +0000</pubDate>
				<category><![CDATA[Technologies]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=26712</guid>

					<description><![CDATA[What is non functional testing and why is it common in projects? Get to know various non-functional tests, their associated risks when skipped.]]></description>
										<content:encoded><![CDATA[
<p>Functional testing is considered standard and is carried out in the vast majority of projects. The need for functional testing is intuitive – the programmer adds a new functionality, and the tester checks if it works properly. But how can we justify the need for non-functional testing, and what are non-functional tests? In this article, I will try to take a more detailed look at the types of non-functional tests and the risks of skipping them in projects. How is the functional testing of software testing done? Why is it important to verify the non-functional requirements of a software system?</p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#functional-requirements">1.  Functional testing – functional requirements</a></li>
                    <li><a href="#Non-functional-testing">2.  Non-functional testing</a></li>
                    <li><a href="#Importance-of-non-functional-tests">3.  Importance of non-functional tests</a></li>
                    <li><a href="#Non-functional-tests">4.  Non-functional tests</a></li>
                    <li><a href="#Test-cases">5.  Test cases for the non-functional type of software testing</a></li>
                    <li><a href="#Non-functional-testing-tools">6.  Non-functional testing tools</a></li>
                    <li><a href="#key-takeaways">7.  Testing non-functional requirements – key takeaways</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="functional-requirements">Functional testing – functional requirements</h2>



<p>Functional testing focuses on the most basic requirements. This type of testing aims to check whether the functional aspects of software applications work as intended. The project team gets the requirements ready, and the client or employer knows more or less exactly what they want to get. During the process itself, these requirements may change. Nevertheless, we still have the target in front of our eyes and know where we are headed. A tester, programmer, business analyst or even the end user can test the application against the functional requirements, and there is usually no need to acquire complex theoretical knowledge about how to test. The application needs to be &#8220;clicked through,&#8221; checking whether it works according to the business requirements.</p>



<p>Also read:</p>



<ul class="wp-block-list">
<li><a href="https://nearshore-it.eu/articles/a-minimalist-test-case/">Test case </a></li>



<li><a href="https://nearshore-it.eu/articles/end-to-end-testing-with-cypress/">Testing tools: Cypress vs Selenium</a></li>
</ul>



<h2 class="wp-block-heading" id="Non-functional-testing">Non-functional testing</h2>



<p>Non-functional tests are also referred to as quality tests. This aspect is more complicated than in the case of functional tests. Most often, the scope they check is defined by a short sentence: &#8220;How the system works&#8221;. Let&#8217;s start with a breakdown based on the <a href="https://www.istqb.org/" target="_blank" rel="noopener">ISTQB </a>Test Analyst syllabus.</p>



<p>Non-functional tests can check non-functional aspects such as:</p>



<div class="wp-block-media-text has-media-on-the-right is-stacked-on-mobile" style="grid-template-columns:auto 62%"><div class="wp-block-media-text__content">
<ul class="wp-block-list">
<li><strong>usability</strong></li>



<li><strong>security</strong></li>



<li><strong>reliability</strong></li>



<li><strong>performance</strong></li>



<li><strong>maintainability</strong></li>



<li><strong>portability</strong></li>



<li><strong>compatibility</strong></li>
</ul>
</div><figure class="wp-block-media-text__media"><img fetchpriority="high" decoding="async" width="756" height="340" src="https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_1.png" alt="non functional testing" class="wp-image-26721 size-full" title="Non functional testing – all you need to know 2" srcset="https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_1.png 756w, https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_1-300x135.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_1-495x223.png 495w" sizes="(max-width: 756px) 100vw, 756px" /></figure></div>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading" id="Importance-of-non-functional-tests">Importance of non-functional tests</h2>



<p>Only those companies that are aware of the issue and the risks related to not testing decide to carry out non-functional tests and check non-functional requirements. However, not everything can be predicted or found. From time to time, even giants like LinkedIn (from which the data of <a href="https://www.forbes.com/sites/leemathews/2021/06/29/details-on-700-million-linkedin-users-for-sale-on-notorious-hacking-forum/" target="_blank" rel="noopener">700 million users, 93% of accounts</a>, was leaked and put up for sale) can also learn that the hard way. Facebook (and the related applications such as WhatsApp, Messenger, and Instagram), which <a href="https://www.nytimes.com/2021/10/04/technology/facebook-down.html" target="_blank" rel="noopener">in October 2021</a> experienced its biggest-ever outage and was inaccessible for almost 6 hours, has also faced similar problems. That failure generated losses of about $6 billion! The public projects case is particularly interesting. Although they seem to be subject to several legal requirements, and therefore much more difficult to implement, they are frequently subject to failure, such as: </p>



<ul class="wp-block-list">
<li><strong>Security vulnerabilities</strong> – such as a vulnerability in the e-Toll system which allowed for the downloading of user data. </li>



<li><strong>Performance problems</strong> – such as those faced by government servers.</li>



<li><strong>Unsuitability for user</strong>s – the low intuitiveness of the system hinders the operation of applications for tolling on highways, which has brought about criticism from many drivers. So why aren&#8217;t non-functional tests performed? In small (e.g., up to 10 people) and short-term projects, even if awareness of non-functional testing is high, the reason for overlooking them is obvious: the costs involved.</li>
</ul>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="Non-functional-tests">Non-functional tests</h2>



<h3 class="wp-block-heading">Performance tests</h3>



<p>Among the non-functional tests mentioned earlier on, the awareness of 2 types of tests in particular is increasing, and they are worth looking into.</p>



<p>The first, with a lower entry level, is performance testing. The subject seems quite complicated, but after learning a few tools (e.g., JMeter, Gatling), it turns out that you can relatively quickly start running basic performance tests that will catch serious problems in an application. The following types of performance tests can be distinguished:</p>



<ul class="wp-block-list">
<li><strong>Load testing </strong>– testing the performance of the system according to different load levels, falling within the assumed range,</li>



<li><strong>verloading </strong>– testing performance beyond the maximum expected load or with resource availability lower than the minimum requirements,</li>



<li><strong>Scalability testing</strong> – checking the system&#8217;s ability to increase or decrease the resources used depending on the load,</li>



<li><strong>Spikes </strong>– testing the system&#8217;s ability to process a spike in load and then return to a typical load,</li>



<li><strong>Endurance </strong>– testing the stability of the system under a given load over a period that is adequate and proportional to production realities,</li>



<li><strong>Concurrency </strong>– testing the situation in which the same action is performed simultaneously,</li>



<li><strong>Throughput </strong>– determining the maximum load the system can handle while meeting performance requirements.</li>
</ul>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="756" height="275" src="https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_2.png" alt="non functional testing" class="wp-image-26727" title="Non functional testing – all you need to know 3" srcset="https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_2.png 756w, https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_2-300x109.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/01/nearshore_2024.01.11_graphic_2-495x180.png 495w" sizes="(max-width: 756px) 100vw, 756px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Requirements for performance testing</h3>



<p>When developing new applications, it is difficult to give exact requirements for performance tests. They are usually based on defining production profiles or on predictions or experience with similar applications that are already running. It is easier to define requirements when implementing a newer version of the software, because here one can refer to production data, such as the number of queries per second, bandwidth, or computing power. One of the risks in performing performance tests is inappropriate execution (e.g., by inexperienced people without the requisite competences). This can even lead to a lack of analysis of key system components or the misinterpretation of results. Another big risk is conducting tests on test environments, which are usually not the same as production environments due to configuration, data volume and capacity.</p>



<h3 class="wp-block-heading">Safety tests</h3>



<p>The second, much broader field is security. Security tests check whether the system sufficiently protects data and functionality from third-party attacks. The importance of such tests is constantly growing. Who hasn&#8217;t heard of various hacks, leaks, frauds or thefts resulting from insufficient security or low user awareness?</p>



<p>However, it isn&#8217;t easy to find a tester who deals with functional testing on a daily basis, in addition to being able to conduct security tests from time to time. That&#8217;s why security audits are most often (if not always) outsourced after a system (or part of it) has been developed. This aspect is very broad, and it&#8217;s a good idea to start learning by exploring the <a href="https://owasp.org/www-project-top-ten/" target="_blank" rel="noopener">OWASP </a>Top 10 – a document that lists the 10 most common security risks. Some types of security tests are as follows:</p>



<ul class="wp-block-list">
<li><strong>Vulnerability scanning</strong> – performed using tools that scan a program to look for known vulnerabilities in its components,</li>



<li><strong>Security scanning</strong> – focuses on the security of application configurations, networks and other systems,</li>



<li><strong>Penetration testing</strong> – a process that simulates an actual attack,</li>



<li><strong>Security audit</strong> – an extensive, structured application inspection process that follows defined standards,</li>



<li><strong>Risk assessment </strong>– analyzing and identifying the biggest security risks,</li>



<li><strong>Security health check</strong> – a combination of security scanning, penetration testing and risk assessment to determine the level of current security measures and their effectiveness.</li>
</ul>



<h3 class="wp-block-heading">Usability tests</h3>



<p>These tests check whether the user can easily learn how to use the application and whether their experience will be positive. Aspects such as aesthetics, intuitiveness, and the ability for people with disabilities to use the app also come into play here. It&#8217;s a good idea to keep this in mind and focus on these issues from the very beginning of the project, especially in agile projects, where we have constant contact with the client and a real opportunity to influence changes to the functionality being created. Indiscriminately adding functionalities according to the requirements of the client (who is not always technically-minded) is not the best approach. Conducting usability testing only after the application is completed can result in a significant increase in project costs due to additional work.</p>



<h3 class="wp-block-heading">Reliability tests</h3>



<p>Reliability testing means verifying if a system can operate correctly for a specified period under specified conditions. However, it is difficult to simulate production conditions on test environments over a long enough period, which is why, among other things, such testing can take place partially on production servers. An example of reliability testing is placing a new version of an application on one of many servers (usually a less frequently used one) and leaving the previous version on the others. After an assumed period of application monitoring, the new version is uploaded to the remaining servers. This approach must be accompanied by appropriate configuration so that if there are problems with the new version on a single machine, traffic is automatically redirected to others. The reliability characteristics are:</p>



<ul class="wp-block-list">
<li><strong>Maturity</strong> – the level of fulfillment of reliability requirements,</li>



<li><strong>Reachability </strong>– the time after which the system is available,</li>



<li><strong>Fault tolerance</strong> – the ability of a system to continue operating during a failure,</li>



<li><strong>Reproducibility </strong>– the ability to recover from a disaster, measured in time and the amount of lost data.</li>
</ul>



<h3 class="wp-block-heading">Maintainability tests</h3>



<p>Maintainability testing allows you to analyze the complexity of maintaining a system in the future. They are rather rarely conducted, despite the fact that the maintenance of the program will (as assumed) last longer than its development. Prevention plays an important role from the beginning of the project – systematic code review and keeping records. It is very likely that in the future the system will be maintained or developed by other people rather than those who created it. For this reason, code and documentation transparency are key.</p>



<p>The main objectives of the maintainability tests are:</p>



<ul class="wp-block-list">
<li>Minimizing the cost of application maintenance,</li>



<li>Minimizing the application downtime needed for maintenance.</li>
</ul>



<h3 class="wp-block-heading">Portability testing</h3>



<p>Portability testing helps determine the level of complexity involved in moving a software component or application from one environment to another. In this case, too, separating them from the testing process and focusing only on such types of testing is rare. Agile design frameworks such as Scrum naturally foster portability testing. In an iterative approach to software development, portability is tested on frequent releases of successive versions (moving the application from the development/testing environment to production), even as often as every 2 weeks. Other situations in which it is worth conducting portability testing include moving from Internet Explorer to Chrome, from one version of a database to another, or extending the program&#8217;s installability to successive versions of Windows or Mac systems. Portability can be measured by the amount of work required to move a software component from one environment to another. The characteristics of portability are:</p>



<ul class="wp-block-list">
<li><strong>Installability </strong>– the capability to install the program on a new system,</li>



<li><strong>Adaptability </strong>– the capability to install applications on all target systems,</li>



<li><strong>Substitutability </strong>– the capability to replace an existing software module.</li>
</ul>



<h3 class="wp-block-heading">Compatibility tests</h3>



<p>Compatibility tests verify the capability of different programs to coexist in the same environment, as well as verifying the ability of a program to work according to different parameters. A very popular case is compatibility testing, which aims to verify the operation of applications in different browsers, such as Chrome, Firefox, Internet Explorer, Safari or Opera. Another case is the testing of mobile applications on many different devices. This approach identifies problems that customers may encounter using non-standard operating systems or browsers. Compatibility can be tested according to:</p>



<ul class="wp-block-list">
<li><strong>equipment</strong></li>



<li><strong>operating system</strong></li>



<li><strong>software</strong></li>



<li><strong>network</strong></li>



<li><strong>browser</strong></li>



<li><strong>mobile device</strong></li>



<li><strong>software version</strong></li>
</ul>



<h2 class="wp-block-heading" id="Test-cases">Test cases for the non-functional type of software testing</h2>



<p>The non-functional type of software testing focuses on the aspects of the software that are not related to performance, usability, security, and scalability. When creating test cases for non-functional testing, it is important to consider various scenarios that can impact the overall performance and user experience of the software.</p>



<h2 class="wp-block-heading" id="Non-functional-testing-tools">Non-functional testing tools</h2>



<p>Non-functional testing tools can help a great deal in the testing process. There are different tools available used to test non-functional aspects (stress testing, volume testing, performance, etc.). Some examples of non-functional testing tools are JMeter, Loadster, and Loadrunner.</p>



<h2 class="wp-block-heading" id="key-takeaways">Testing non-functional requirements – key takeaways</h2>



<ul class="wp-block-list">
<li>Non-functional testing is a type of testing that checks non-functional requirements (performance, usability, security, and scalability).</li>



<li>Non-functional tests are also referred to as quality tests.</li>



<li>It is important to recognize the significance of non-functional testing and understand the potential consequences of skipping this type of testing in a project.</li>
</ul>



<h2 class="wp-block-heading">Non-functional software testing &#8211; summary</h2>



<p>Functional testing is very important, and in many projects, no one questions its relevance. Functional testing verifies functional requirements. Ongoing manual testing and regression development and maintenance practically exhaust the subject. However, we need to be aware of the importance of non-functional testing as well as the risks involved in skipping this type of testing.</p>



<p>Non-functional aspects are important. However, even at the test planning stage, there is often a lack of thorough analysis of what non-functional tests should be carried out, with the result that only some bugs are found. The risks are high: an unresponsive online store on Black Friday, leakage of confidential customer data, blocking of the site for ransomware, non-intuitiveness of the application or an unattractive design discouraging users from using it, and payments not working after uploading a new version&#8230; All these can prove to be much more costly than investing in systematic non-functional testing.</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="Non functional testing – all you need to know 4"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/technologies/non-functional-testing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is Regression Testing: Unveiling Best Practices and Essential Insights</title>
		<link>https://nearshore-it.eu/articles/what-is-regression-testing-best-practices-and-essential-insights/</link>
					<comments>https://nearshore-it.eu/articles/what-is-regression-testing-best-practices-and-essential-insights/#respond</comments>
		
		<dc:creator><![CDATA[Natalia Klockiewicz]]></dc:creator>
		<pubDate>Sun, 20 Aug 2023 05:06:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Best practices]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25667</guid>

					<description><![CDATA[What exactly is regression testing? Read the article and learn the importance of regression testing in software development and how it ensures existing features aren’t affected by changes.]]></description>
										<content:encoded><![CDATA[
<p>As the saying goes:&nbsp;<strong>„Perfect is the enemy of the good”.</strong>&nbsp;But there is also another saying that ”the only constant is change”. In software development, it is impossible to avoid introducing new functions and changes. Often, updating the software is necessary for it to work properly. Verification of changes is an important part of this process – and it’s not only about testing the existing functionalities. Regression testing allows you to ensure that the change has not impacted another, seemingly unrelated part of the software.&nbsp;</p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#Software-development-and-regression-testing-">1.  Software development and regression testing </a></li>
                    <li><a href="#The-miserable-consequences-of-not-conducting-regression-tests…-">2.  The miserable consequences of not conducting regression tests… </a></li>
                    <li><a href="#What-exactly-is-regression-testing?">3.  What exactly is regression testing?</a></li>
                    <li><a href="#How-often-should-regression-tests-be-performed?-">4.  How often should regression tests be performed? </a></li>
                    <li><a href="#At-what-levels-do-we-perform-regression-testing?-">5.  At what levels do we perform regression testing?</a></li>
                    <li><a href="#Creating-test-cases-">6.  Creating test cases </a></li>
                    <li><a href="#Selection-of-regression-test-cases--">7.  Selection of regression test cases</a></li>
                    <li><a href="#Right-Priority-">8.  Right Priority </a></li>
                    <li><a href="#How-to-prioritize-test-cases?-">9.  How to prioritize test cases? </a></li>
                    <li><a href="#Reusable-test-cases-in-regression-">10.  Reusable test cases in regression </a></li>
                    <li><a href="#What-do-we-do-when-testing-regression?--">11.  What do we do when testing regression?  </a></li>
                    <li><a href="#What-makes-a-perfect-checklist?-">12.  What makes a perfect checklist? </a></li>
                    <li><a href="#Regression-vs.-retesting-–-what's-the-difference?-">13.  Regression vs. retesting – what’s the difference?</a></li>
                    <li><a href="#How-Do-You-Perform-Regression-Testing?-Automation-in-regression-">14.  How Do You Perform Regression Testing? Automation in regression </a></li>
                    <li><a href="#Don't-forget-about-regression-testing-tools">15.  Don’t forget about regression testing tools</a></li>
                    <li><a href="#What-if-we-can't-use-test-automation?-">16.  What if we can’t use test automation? </a></li>
                    <li><a href="#The-Advantages-of-Regression-Testing">17.  The Advantages of Regression Testing</a></li>
                    <li><a href="#FAQ">18.  FAQ</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="Software-development-and-regression-testing-"><strong>Software development and regression testing&nbsp;</strong></h2>



<p>Let’s imagine that we have an application up and running and available to users. The customer is satisfied because it is popular, and wants to add a new functionality to increase user satisfaction and attract new users. The project team can’t wait to start working: new functionalities, new tasks, new challenges! After deciding on the details, the developers eagerly set to work. Then the testers check the new functionality. After minor improvements, everything works fine. It’s time to make the new functionality available to users. When the day came to release the new version of the application, everyone was happy – the project was completed on time and with the requirements fulfilled.&nbsp;</p>



<p>Unfortunately, this blissful state of affairs did not last long. A day later, the website was flooded with reports that not all the existing application functions worked properly. The team was surprised: „We didn’t even touch those functionalities, and the new one works fine”. So what went wrong?&nbsp;</p>



<h2 class="wp-block-heading" id="The-miserable-consequences-of-not-conducting-regression-tests…-"><strong>The miserable consequences of not conducting regression tests…&nbsp;</strong></h2>



<p>Well, there was one very important element missing in the testing process.<strong> No one checked whether the newly added functionality affected the existing ones. </strong>In other words, no regression tests were performed.&nbsp;</p>



<p>Because of this lack of regression tests, the application didn’t gain new users. Furthermore, the majority of the existing ones stopped using it. It tumbled down the rankings, incomes decreased, which made the client unhappy.&nbsp;&nbsp;</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="What is Regression Testing: Unveiling Best Practices and Essential Insights 5"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="What-exactly-is-regression-testing?"><strong>What exactly is regression testing?</strong></h2>



<p>According to the&nbsp;<strong>ISTQB dictionary</strong>, regression testing is the testing of a previously tested program following modification “to ensure that defects have not been introduced or uncovered in unchanged areas of the software, as a result of the changes made. It is performed when the software or its environment is changed”.&nbsp;</p>



<p>We can illustrate it this way: during regression tests, we check that&nbsp;<strong>„when laying wallpaper in one room, the roughcast did not fall off the wall in the other one”</strong>. Any changes to the code in one place can cause the function to break in another, although at first glance it seems that they are not related. That is why it is so important to retest the software after implementing changes.</p>



<p class="has-text-align-center"><strong>Red also: <a href="https://nearshore-it.eu/articles/functional-tests-what-do-you-need-to-know/">Functional testing in software development</a></strong></p>



<h2 class="wp-block-heading" id="How-often-should-regression-tests-be-performed?-"><strong>How often should regression tests be performed?&nbsp;</strong></h2>



<p>Now you can see how important it is to make sure that the changes have not affected the existing functions and to find errors early on. Changes may result from modifications to the requirements and code of the software, adding new functionalities or repairing a defect, so it is important that regression tests are carried out as often as a new version of the software is released.&nbsp;</p>



<h2 class="wp-block-heading" id="At-what-levels-do-we-perform-regression-testing?-"><strong>At what levels do we perform regression testing?&nbsp;</strong></h2>



<p>Regression tests are independent of the test levels and test types. They can be carried out at the level of modular, integration, system or acceptance tests and regardless of whether we are dealing with functional or non-functional tests.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="756" height="320" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1.png" alt="nearshore 2023.11.xx graphic 1 1" class="wp-image-25795" title="What is Regression Testing: Unveiling Best Practices and Essential Insights 6" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1-300x127.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1-495x210.png 495w" sizes="(max-width: 756px) 100vw, 756px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading" id="Creating-test-cases-"><strong>Creating test cases&nbsp;</strong></h2>



<p>When checking the software, the tester creates test cases. However, not all of them will be performed during regression tests. What does this depend on?&nbsp;</p>



<p><strong>It mostly depends on the quantity and time needed to run them</strong>. If we are dealing with an uncomplicated system and it will not take too much time to perform all test cases while testing regression, then they can be performed.&nbsp;</p>



<p>Most often, however, systems or applications are characterized by a high level of complexity and are dependent on other systems. We are then unable to use all the created test cases. So what should be the decisive factor when choosing cases for regression tests?&nbsp;</p>



<h2 class="wp-block-heading" id="Selection-of-regression-test-cases--"><strong>Selection of regression test cases&nbsp;&nbsp;</strong></h2>



<p>If we have to limit ourselves, it is worth choosing a set of test cases accordingly. Certainly, it’s a good idea to include those cases that:&nbsp;</p>



<ol class="wp-block-list">
<li><strong>Check the most critical functions of an app </strong>– first of all, test cases that verify the operation of main functions or functionalities that are often used.&nbsp;</li>



<li><strong>Were created on the basis of defects</strong> – test cases that were created on the basis of reported defects are important.&nbsp;</li>



<li><strong>Verify the vulnerability to errors</strong> – it is worth considering which area of the application is most vulnerable to errors after introducing changes, and also perform test cases from a given area while running regression tests.&nbsp;</li>



<li><strong>Check the new functionality</strong> – don’t forget about test cases that check the newly added functionality.&nbsp;</li>



<li><strong>Require many steps</strong> – let’s bear in mind complex test cases requiring a longer sequence of activities.&nbsp;</li>
</ol>



<h2 class="wp-block-heading" id="Right-Priority-"><strong>Right Priority&nbsp;</strong></h2>



<p>It is also important to prioritize test cases accordingly. This helps in the selection process, especially when the scope of the test area is large and we don’t have much time to perform them.&nbsp;&nbsp;</p>



<p>In such a situation, the tester – with time in mind – selects the test cases with the highest priority. This gives us confidence that the most critical areas of the application will be tested. The remaining cases (with a lower priority, which were not performed during regression) should be included in the final report and marked as non-executed.&nbsp;</p>



<h2 class="wp-block-heading" id="How-to-prioritize-test-cases?-"><strong>How to prioritize test cases?&nbsp;</strong></h2>



<p>There are several factors to consider when prioritizing test cases:&nbsp;</p>



<ul class="wp-block-list">
<li>The importance of a given functionality from a business point of view&nbsp;</li>



<li>Its availability / visibility to the end user&nbsp;</li>



<li>The complexity of a given functionality&nbsp;</li>



<li>The financial impact&nbsp;&nbsp;</li>



<li>Whether it was created under time pressure&nbsp;</li>



<li>Whether there were problems with similar functionalities&nbsp;</li>
</ul>



<p>Taking into account the above aspects and answering the questions, prioritizing test cases should not be a problem. We will benefit from the work put into this process when the time for testing is very limited.&nbsp;</p>



<p class="has-text-align-center"><strong>Read also:</strong> <a href="https://nearshore-it.eu/articles/technologies/test-pyramid-and-types-of-testing/" target="_blank" data-type="post" data-id="25613" rel="noreferrer noopener">The test pyramid – what, when and how to test software to get profits</a><a href="https://borntesters.com/blog/test-pyramid-and-types-of-testing/" target="_blank" rel="noopener"></a></p>



<h2 class="wp-block-heading" id="Reusable-test-cases-in-regression-"><strong>Reusable test cases in regression&nbsp;</strong></h2>



<p>The list of test cases selected for regression tests should be verified regularly. Some of them can be used in subsequent regression tests – these are the so-called reusable cases. Others may turn out to be outdated, and thus useless in subsequent regression cycles; such an&nbsp;<strong>„outdated case”</strong>&nbsp;should be removed from the list of regression tests. &nbsp;</p>



<p>Verification of whether they are still useful mainly consists in trying to execute a given test case. If the steps described cannot be reproduced or the functionality no longer exists, then such a test case should be removed. It often turns out that the execution path or the expected result has been slightly modified and all you need to do is update the test case.&nbsp;<strong>Verification of the set of test cases selected for regression tests is necessary</strong>, because leaving outdated test cases gives us a misleading picture of the state of the application in the final reports, and the entire regression process is of no value.&nbsp;</p>



<h2 class="wp-block-heading" id="What-do-we-do-when-testing-regression?--"><strong>What do we do when testing regression? &nbsp;</strong></h2>



<h3 class="wp-block-heading"><strong>We check the expected result&nbsp;</strong></h3>



<p>When performing regression tests, we check whether the system behaves as expected. If the regression tests are prepared in the form of test cases, then after completing the steps described in the case, we check whether we get the expected results.&nbsp;</p>



<p><strong>Verification using a checklist &nbsp;</strong></p>



<p>Another way to test regression is to prepare a checklist, which is a set of operations in the application that will be tested, saved in the form of short keywords. The checklist is relatively easy to prepare and maintain and is ideal when testers know the application very well and do not need detailed steps. They know what operations should be checked in a given area and what the expected result is.&nbsp;</p>



<p>Unfortunately, in the case of a checklist, there is a risk that not all operations that should be checked will be tested. To avoid this, it is a good idea to update the checklist while the team discusses the changes to be made. Also, during the testing process of a given functionality, the missing elements should be filled in on an ongoing basis, so that the list is complete during regression.&nbsp;</p>



<h2 class="wp-block-heading" id="What-makes-a-perfect-checklist?-"><strong>What makes a perfect checklist?&nbsp;</strong></h2>



<p>A well-prepared checklist should be concise, and at the same time it should cover all the relevant functionalities. If the system is extensive and the checklist is long, it should be divided into appropriate categories that clearly define the area to be tested. It is also worth making sure that the tested operations are set in the right order, which will speed up the tests and mean that you will not have to go back to check things that have already been checked.&nbsp;<strong>Don’t forget that each checklist must be expanded along with the software development.&nbsp;</strong></p>



<h2 class="wp-block-heading" id="Regression-vs.-retesting-–-what's-the-difference?-"><strong>Regression vs. retesting – what’s the difference?&nbsp;</strong></h2>



<p>Many people, especially those new to IT, wonder if retests and regression tests are the same thing.&nbsp;</p>



<ul class="wp-block-list">
<li><strong>A retest</strong>&nbsp;is a single test that checks whether a defect has been removed. It means re-testing of a case in which the final result was different from the expected one and it was reported as a bug and fixed by the programmer. If the system works as expected after correction, we can close the request. However, if we still do not obtain the expected results, the request should still remain open, as it requires further analysis and repair.&nbsp;</li>



<li><strong>Regression</strong> is a set of tests, that gives us the answer to whether the entire module or system is free of errors after making changes to the code. Regression tests are much more time-consuming than retests, but let’s also remember that their goal is different.&nbsp;</li>
</ul>



<h2 class="wp-block-heading" id="How-Do-You-Perform-Regression-Testing?-Automation-in-regression-"><strong>How Do You Perform Regression Testing? Automation in regression&nbsp;</strong></h2>



<p>How regression tests are performed depends mainly on how big the system is, and often on what budget we have as well.&nbsp;</p>



<p>In small projects, when regression tests do not contain a large number of test cases,<strong> it is often sufficient to perform tests manually</strong>. But what if we have thousands of them and manual work would take months? Or if, during regression tests, there was an error blocking further work and you would have to check everything again after removing it? Then the best solution is to use automatic tests. <strong>Regression tests are perfect for automation</strong>, mostly because we perform them regularly and automatic tests definitely shorten the time required for executing test cases. If there are thousands of them, automation allows you to save time and effort.&nbsp;</p>



<p class="has-text-align-center"><strong>Read also:</strong>&nbsp;<a href="https://nearshore-it.eu/articles/test-automation-common-myths-2/" data-type="post" data-id="25711">Test automation – common myths</a></p>



<h2 class="wp-block-heading" id="Don't-forget-about-regression-testing-tools"><strong>Don’t forget about regression testing tools</strong></h2>



<p>Of course, the introduction of automatic tests involves costs related to, for example, the purchase of licenses for tools and hiring a person with the right competences. However, these costs in the case of large projects are still much lower than those incurred each time when performing manual regression.&nbsp;</p>



<h2 class="wp-block-heading" id="What-if-we-can't-use-test-automation?-"><strong>What if we can’t use test automation?&nbsp;</strong></h2>



<p>Very often, a <strong>mixed approach</strong>&nbsp;is used in projects, because not every test case allows for automation. Often, complex test cases are troublesome and hard to automate, which is why they are most often performed manually. Of course, it is best if there are fewer cases to be performed manually, and the others are automated – then the regression process runs smoothly and does not take up so much time.&nbsp;</p>



<h2 class="wp-block-heading" id="The-Advantages-of-Regression-Testing"><strong>The Advantages of Regression Testing</strong></h2>



<p>The regression testing process requires work and proper groundwork. Undoubtedly, it also implies costs related to time, workload or tools. However, if wisely planned and properly carried out, it brings benefits above and beyond the investment made. Regression testing prevents the introduction of defects to production, which may result in thousands of Euro in losses to the customer. If such a situation occurs, the team must deal with repairing defects, which means that further software development must wait, and is most often postponed.&nbsp;</p>



<p>The regression test report gives us an answer to the question of whether a given software is of the expected quality and whether it can be implemented in the production. Also, it often indicates modules or areas of the software that are particularly vulnerable to defects, which gives the team the opportunity to thoroughly investigate the problem.  &nbsp;</p>



<h2 class="wp-block-heading"><strong>Summary&nbsp;</strong></h2>



<p>Regression tests are a very important stage in the software development process, regardless of the methodology of the project, whether it be a cascade or agile approach.&nbsp;<strong>They answer the question of what condition our application is in after introducing changes</strong>, and allow us to avoid the costs of repairing defects in production. As we already know, the costs of correcting such errors significantly exceed those incurred during the regression testing process.&nbsp;</p>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="FAQ"><strong>FAQ</strong></h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-1697785776582" class="rank-math-list-item">
<h3 class="rank-math-question ">What is the purpose of a test case for regression testing?</h3>
<div class="rank-math-answer ">

<p>A test case for regression testing is used for checking the system thoroughly to make sure that changes haven’t caused unintended effects and to guarantee existing functionality is not affected. It is a part of the test suite in the regression testing process, which plays a critical role in the development phase of a software lifecycle.</p>

</div>
</div>
<div id="faq-question-1697785803299" class="rank-math-list-item">
<h3 class="rank-math-question ">How can you automate a regression test?</h3>
<div class="rank-math-answer ">

<p>Automating a regression test can be done by using an automated testing tool. This helps in executing the regression test cases repeatedly with minimum human interaction. The main goal of automation in regression testing is to reduce the regression cycle while increasing the efficiency of testing.</p>

</div>
</div>
<div id="faq-question-1697785815624" class="rank-math-list-item">
<h3 class="rank-math-question ">What is the difference between retest and regression test?</h3>
<div class="rank-math-answer ">

<p>Retesting is performed to confirm that the defects which were found and reported in the earlier test cycle were fixed. Regression testing, on the other hand, is done to ascertain that the fixes haven’t introduced any new bugs in the previously tested software. Simple put, retesting ensures the original faults have been corrected, while regression testing ensures no new faults have been introduced.</p>

</div>
</div>
<div id="faq-question-1697785834690" class="rank-math-list-item">
<h3 class="rank-math-question ">What is a test suite within the context of regression testing?</h3>
<div class="rank-math-answer ">

<p>A test suite in the context of regression testing is a collection of regression test cases that are intended to test a software program to ensure that it functions correctly. The test suite represents the complete regression testing that needs to be performed. It plays a crucial role in validating the overall behavior and functionality of the solution, ensuring no previously resolved bug has been reintroduced.</p>

</div>
</div>
<div id="faq-question-1697785852390" class="rank-math-list-item">
<h3 class="rank-math-question ">Can we fully automate regression testing, including the functional test? </h3>
<div class="rank-math-answer ">

<p>Yes, both regression testing and functional testing, as part of the overall software testing strategy, can be fully automated using automation test tools. Automation enormously accelerates the testing process and raises its effectiveness, especially when the number of test cases is large. However, not everything may be suitable for automation. You should have a balanced mix of manual testing and test automation.</p>

</div>
</div>
<div id="faq-question-1697785862854" class="rank-math-list-item">
<h3 class="rank-math-question ">What’s the role of unit testing in the regression testing process?</h3>
<div class="rank-math-answer ">

<p>Unit testing is performed during the development stage to ensure that individual components of the application are working correctly. In the context of regression testing, unit tests make sure that changes made in the software do not affect these individual components, making them an integral part of the regression testing process.</p>

</div>
</div>
<div id="faq-question-1697785882713" class="rank-math-list-item">
<h3 class="rank-math-question ">Why is regression testing needed after functional testing in the software testing?</h3>
<div class="rank-math-answer ">

<p>Regression testing is required after functional testing to ensure that the recent program changes have not adversely affected existing features. Functional testing ensures that the requirements are met by the application, whilst regression testing ensures that these functionalities continue to work after changes in code, design or configuration are done.</p>

</div>
</div>
<div id="faq-question-1697785893113" class="rank-math-list-item">
<h3 class="rank-math-question ">Can the regression testing be done without automation?</h3>
<div class="rank-math-answer ">

<p>Yes, regression testing can be done manually. However, as the application grows and the number of regression test cases increases, it can become time-consuming and error-prone. Hence, automating regression testing can assist in executing repetitive tasks quickly and efficiently, reducing the regression cycle and increasing testing coverage.</p>

</div>
</div>
<div id="faq-question-1697785914436" class="rank-math-list-item">
<h3 class="rank-math-question ">What is a regression testing strategy?</h3>
<div class="rank-math-answer ">

<p>A regression testing strategy involves identifying the need for regression testing, defining the regression test suite (which includes deciding on the number of test cases), and choosing between manual regression testing and automating the regression tests. The test strategy may vary depending on the software’s complexity, changes in functionalities, available resources, and time constraints.</p>

</div>
</div>
<div id="faq-question-1697785919324" class="rank-math-list-item">
<h3 class="rank-math-question ">What is the importance of retesting and regression testing in the testing process?</h3>
<div class="rank-math-answer ">

<p>Retesting and regression testing both play major roles in the software testing process. Retesting is done to verify the defect fix, while regression testing is performed to check for unexpected side-effects. Combined, retesting and regression testing ensure the robustness and reliability of the software under test.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/what-is-regression-testing-best-practices-and-essential-insights/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Functional Testing in Software Development: A Comprehensive Guide to software testing types and Examples</title>
		<link>https://nearshore-it.eu/articles/functional-tests-what-do-you-need-to-know/</link>
					<comments>https://nearshore-it.eu/articles/functional-tests-what-do-you-need-to-know/#respond</comments>
		
		<dc:creator><![CDATA[Pawel Krysiak]]></dc:creator>
		<pubDate>Tue, 01 Aug 2023 05:22:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25678</guid>

					<description><![CDATA[What functional testing is? What is the purpose of functional tests? Read the article!]]></description>
										<content:encoded><![CDATA[
<p>In the rapidly evolving realm of software development, functional testing stands out as a pivotal procedure. This extensive guide aims to unravel the complex world of functional testing, diving into its myriad types, real-world examples, and the advanced tools that streamline this process. Discover the nuances of automating functional tests and get a sneak peek into the future of functional testing. This article is a must-read for all software testers and developers, offering a profound understanding of different testing techniques and the burgeoning role of automation in testing. So, why wait? Let’s embark on this enlightening journey!</p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#Unraveling-the-concept-of-functional-testing:-what-is-it-all-about?">1.  What is functional testing?</a></li>
                    <li><a href="#Functional-testing-vs.-non-functional-testing">2.  Functional testing at different levels – basic division of functional tests</a></li>
                    <li><a href="#basic-division-of-functional-tests">3.  How do we perform functional tests?</a></li>
                    <li><a href="#ests-or-black-box-tests?">4.  White box tests or black box tests?</a></li>
                    <li><a href="#based-on-documentation">5.  Tests based on documentation</a></li>
                    <li><a href="#ompliance-with-customer-requirements">6.  Compliance with customer requirements</a></li>
                    <li><a href="#Meeting-user-expectations">7.  Meeting user expectations</a></li>
                    <li><a href="#Essential-Takeaways:-What-Should-You-Remember-About-Functional-Testing?">8.  Summary</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="Unraveling-the-concept-of-functional-testing:-what-is-it-all-about?">Unraveling the concept of functional testing: what is it all about?</h2>



<p>The goal of functional testing is to verify that the application is functioning as required in specific conditions. At various levels of testing, the tester checks whether the software works in accordance with the business requirements set by the stakeholders, and whether it meets users’ expectations.</p>



<p>Functional tests are one of the<strong> 4 traditional types of tests.</strong>&nbsp;They include functional tests, non-functional tests, structural tests and change-related tests. These tests check the activities that the program is designed to perform, or put simply, they check whether the program is doing what it should.</p>



<p>But to check this, we first need to know what the program should do. Traditionally, the answer to this question should be sought in the specification of requirements, documentation, and ultimately, we must rely on our experience.</p>



<h2 class="wp-block-heading" id="Functional-testing-vs.-non-functional-testing">Functional testing vs. non-functional testing</h2>



<p>Functional testing and non-functional testing – are they two sides of the same coin? Not quite. Functional tests focus on the most basic requirements – whether functionalities work as intended. &nbsp;Non-functional tests are also referred to as quality tests – here the matter is more complicated than in the case of functional tests. Non-functional testing checks parameters such as&nbsp;<strong>performance, usability, and reliability.&nbsp;</strong>In other words, functional testing ensures that the software system functions as expected, whereas non-functional testing explores how well the system performs.</p>



<h2 class="wp-block-heading" id="basic-division-of-functional-tests">Types of functional tests and the indispensable role of functional testing in software development</h2>



<p>What you need to bear in mind at this stage is that test types and test levels are two separate concepts.</p>



<p>The test types determine their purpose. In this case, it is to check the behavior of the application and verify that it complies with the specifications and user requirements.</p>



<p>The test levels refer to the phases of software development. The basic divisions are&nbsp;<strong>unit</strong>,&nbsp;<strong>integration</strong>,&nbsp;<strong>system</strong>&nbsp;and&nbsp;<strong>acceptance</strong>&nbsp;<strong>tests</strong>.  In this article, we will not focus on developing this division further, but we must remember that functional tests should be performed at every available level of testing.</p>



<h3 class="wp-block-heading"><strong>Unit testing &amp;&nbsp;how does it function as a type of functional testing?</strong></h3>



<p>Functional tests at the level of unit tests are usually the realm of programmers, because they are usually responsible for creating and maintaining them. At this level, they check whether a single method / function does what it should, e.g., whether the appropriate action is triggered or whether the calculations are correct. This is the lowest of the test levels, as the tests themselves should be simple and performed very quickly. Therefore, this level of testing should be the foundation for automatic verification if the software works properly.</p>



<p class="has-text-align-center"><strong>Also read: <a href="https://nearshore-it.eu/articles/technologies/test-pyramid-and-types-of-testing/" data-type="post" data-id="25613" target="_blank" rel="noreferrer noopener">Test Pyramid</a></strong></p>



<h3 class="wp-block-heading">Integration tests</h3>



<p>Integration tests, on the other hand, can be the realm of both testers and developers. The basic factor here will be the level at which we check the integration. If we verify the integration of individual methods and functions (after checking with unit tests if they work on their own), it will tend to be the domain of programmers.</p>



<p>However, if we test integration at a higher level, e.g., integration between two application modules, this work can (and often should) be carried out by a software tester. This is due to the fact that a developer testing his own code tests his interpretation of the requirements, but not necessarily the correct one. This is not a shot at programmers, but rather an explanation of why you should not test your own solutions.</p>



<h3 class="wp-block-heading">System tests</h3>



<p>Most people consider functional tests at the system level as the default type of tests.&nbsp;<strong>System testing means checking software functionality&nbsp;</strong>in an integrated environment, where functionalities can be tested end-to-end. It is also the most intuitive level for beginner testers or people who don’t deal with testing.</p>



<p>But that’s not all – since it is end-to-end testing, it is also very important from the perspective of business and stakeholders, because end users will use the software in a very similar way. Often only at this point can we pay attention to the accuracy of the user interface (both compatibility with mockups and the simplicity of use) and the issue of presenting data to the user. At this level, we can finally check the accessibility of the product for people with disabilities, which is especially important for testers working in public institutions.</p>



<h3 class="wp-block-heading">Acceptance testing</h3>



<p>Acceptance testing is the last stage of testing, which is usually performed on the finished product, by end users, or perhaps by or with the contribution of a client. Functional tests are carried out at this level to finally confirm and approve that the resulting product meets the requirements. It is also the last chance to find defects before handing the product over to end users and the final call to check the compliance of the product with the legal requirements. What is a test pyramid? What, when and how to test?</p>



<p class="has-text-align-center"><strong>Read also: <a href="https://nearshore-it.eu/articles/guide-to-user-acceptance-testing-uat/" data-type="post" data-id="25764" target="_blank" rel="noreferrer noopener">User Acceptance Testing (UAT) – Why is it important</a></strong><a href="https://borntesters.com/blog/guide-to-user-acceptance-testing-uat/" target="_blank" rel="noopener"></a></p>



<h2 class="wp-block-heading" id="-perform-functional-tests?">How do we perform functional tests?</h2>



<p>We have discussed functional tests at different levels, but let’s answer the question of how to perform them. As is often the case with testing, the best answer is that <strong>&nbsp;it depends</strong>. Tests at all levels, except for unit tests, can be performed manually more or less successfully.</p>



<p>In the case of integration tests, we will often need additional software to help, but this does not change the fact that well-designed tests can be performed manually.</p>



<h2 class="wp-block-heading">Test Automation and functional testing: what’s the connection?</h2>



<p>We can cover all the previously mentioned test levels with automatic tests. This allows for effective regression testing and also builds trust in the product, as it is regularly checked for correct operation (automatic tests are not for finding errors, but to make sure that functionalities that have already worked keep on doing so).</p>



<h2 class="wp-block-heading">When to automate your functional tests</h2>



<p>The most important business paths during acceptance tests are worth checking manually so we can rest assured that the product is ready to be made available to users. It is worth utilizing automated tests during acceptance testing to limit repetitive work (e.g., redirects with multiple language versions, translations, etc.).</p>



<h2 class="wp-block-heading" id="ests-or-black-box-tests?">White-box testing or black-box testing techniques?</h2>



<p>We already know what functional tests are, what their purpose is, what levels we should perform them at and who can perform such tests. It’s time to answer the question of &nbsp;<strong>what the right way to determine how to test our functional features is.</strong></p>



<h2 class="wp-block-heading" id="based-on-documentation">Tests based on documentation</h2>



<p>As I mentioned, functional tests check the correctness of the software in terms of customer requirements, but also in terms of compliance with user requirements.</p>



<h2 class="wp-block-heading" id="ompliance-with-customer-requirements">Compliance with customer requirements</h2>



<p>Let’s focus on meeting customer requirements at the beginning.&nbsp;<strong>These requirements are usually included in the specification, mock-ups and other forms of documentation</strong>. Designing tests based on documentation means the use of black box techniques in practice. Beginner testers often do not even know that they use the popular black box techniques described above when designing tests. This is because the basic techniques are simple and intuitive.</p>



<h2 class="wp-block-heading" id="Meeting-user-expectations">Meeting user expectations</h2>



<p>The second part of functional tests is to&nbsp;<strong>check whether they meet user expectations.</strong>&nbsp;Here the experience of a tester is vital. By that, I mean both testing and industry experience. In these tests, we rely on techniques based on experience – guessing errors, exploratory tests or using checklists.</p>



<p>To sum up, testers have a range of different techniques, some of which require intuition, and others experience. The common denominator for them is the result: well-designed tests which allow us to find defects or raise the level of confidence in the quality of the software.</p>



<h2 class="wp-block-heading" id="s-it-worth-taking-an-interest-in-functional-tests?">Is it worth taking an interest in functional software testing?</h2>



<p>As part of the functional testing of the application, testers are responsible for testing functions at different levels. The techniques used to find errors create significant opportunities for development and specialization.</p>



<h2 class="wp-block-heading" id="Essential-Takeaways:-What-Should-You-Remember-About-Functional-Testing?">Essential Takeaways: What Should You Remember About Functional Testing?</h2>



<p>As we conclude this comprehensive guide, let’s recap the key points:</p>



<ul class="wp-block-list"><li>Functional testing is pivotal to verify that a software system operates correctly.</li><li>There’s a clear distinction between functional and non-functional testing.</li><li>Numerous types of functional testing exist, each with its unique purpose and application.</li><li>A variety of functional testing tools are available to streamline and automate testing.</li><li>The future of functional testing lies in increased automation and the use of AI-based techniques.</li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/functional-tests-what-do-you-need-to-know/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Automated tests: Selenium + Python vs Selenium + Java</title>
		<link>https://nearshore-it.eu/articles/selenium-python-vs-selenium-java/</link>
					<comments>https://nearshore-it.eu/articles/selenium-python-vs-selenium-java/#respond</comments>
		
		<dc:creator><![CDATA[Jacek Laska]]></dc:creator>
		<pubDate>Wed, 12 Jul 2023 05:33:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25774</guid>

					<description><![CDATA[The world of IT and QA is changing rapidly, and the popularity of some of the tools is passing. Which choose? Read the article and learn about the advantages and disadvantages of combining Selenium with two of the most popular programming languages today: Java and Python.]]></description>
										<content:encoded><![CDATA[
<p>As a (future) TAE (Test Automation Engineer) focusing on Selenium, you may get to the point where you need to make a decision on which way you go and what tools and languages you are going to use for testing. Life changes rapidly in the IT and QA world and some of the ones that were popular in the past are not attractive any more. As usual, there are probably a number of different factors that could play a role in making such a decision for you. In this article I will try to help you with that by briefly showcasing the pros and cons of using Selenium with two of the most popular languages nowadays: Java and Python.</p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#Test-automation:-what-are-the-options?-Java-and-Python--">1.  Test automation: what are the options? Java and Python  </a></li>
                    <li><a href="#A-programming-language-or-a-scripting-language?-">2.  A programming language or a scripting language? </a></li>
                    <li><a href="#What-is-easier-to-learn:-Java-or-Python?--">3.  What is easier to learn: Java or Python?  </a></li>
                    <li><a href="#options-do-you-have?-">4.  Test automation – what options do you have? </a></li>
                    <li><a href="#enium-WebDriver?-">5.  What is Selenium WebDriver? </a></li>
                    <li><a href="#Selenium-and-Python-">6.  Selenium and Python </a></li>
                    <li><a href="#elenium-and-Java-">7.  Selenium and Java </a></li>
                    <li><a href="#What-is-a-better-option-for-automated-tests-–-Selenium-with-Python-or-Selenium-with-Java?--">8.  What is a better option for automated tests – Selenium with Python or Selenium with Java?  </a></li>
                    <li><a href="#What-is-Selenium-with-Python-for?-">9.  What is Selenium with Python for? </a></li>
                    <li><a href="#How-to-execute-Selenium-script-in-Python?-">10.  How to execute Selenium script in Python? </a></li>
                    <li><a href="#How-to-install-Selenium-with-PIP?-">11.  How to install Selenium with PIP? </a></li>
                    <li><a href="#Test-automation-–-summary--">12.  Test automation – summary  </a></li>
                    <li><a href="#FAQ---starting-points-for-Selenium-with-Java-or-Python-">13.  FAQ</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="Test-automation:-what-are-the-options?-Java-and-Python--">Java and Python&nbsp;&nbsp;</h2>



<p>Each of them is well-established, platform-independent, object-oriented and part of a large, supportive community. When it comes to selecting Selenium language bindings (read Java or Python here), you should first understand some key differences between them.&nbsp;</p>



<p>Selenium supports a wide range of programming languages for test automation. Java and Python are the top choices for binding with Selenium in this context.&nbsp;</p>



<h2 class="wp-block-heading" id="A-programming-language-or-a-scripting-language?-">A programming language or a scripting language?&nbsp;</h2>



<p>One of the main questions that could come to mind when comparing Java and Python could be: is Python/Java a programming language or a scripting language?&nbsp;</p>



<p>Basically, all scripting languages are considered to be programming languages. The main difference between them is that programming languages are&nbsp;<strong>compiled</strong>, whereas scripting languages are interpreted. Scripting languages are slower than programming languages and usually sit behind them.&nbsp;</p>



<p>You can find a brief comparison in the link below:&nbsp;<a href="http://interpreter%20vs%20compiler/" target="_blank" rel="noreferrer noopener">Interpreter vs compiler</a>&nbsp;&nbsp;</p>



<h4 class="wp-block-heading">Python&nbsp;</h4>



<p>Python can be called a scripting language as well as a programming language since&nbsp;<strong>it works both as a compiler and an interpreter.&nbsp;</strong>Standard Python can compile Python code into bytecodes and then interpret it just like Java and C.&nbsp;</p>



<p>“However, considering the historical relationship between the general-purpose programming language and the scripting language, it would be more appropriate to say that Python is a programming language that works nicely as a scripting language too”.&nbsp;</p>



<p>An&nbsp;<strong>interpreter&nbsp;</strong>is a layer of software that works as a bridge between the program and the system hardware to keep the code running. The Python interpreter is an application that is responsible for running Python scripts.&nbsp;</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="376" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-4.png" alt="nearshore 2023.11.xx graphic 1 4" class="wp-image-25888" title="Automated tests: Selenium + Python vs Selenium + Java 7" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-4.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-4-300x149.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-4-495x246.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<h3 class="wp-block-heading">Java&nbsp;</h3>



<p>Java is generally faster and more efficient than Python because it is a&nbsp;<strong>compiled&nbsp;</strong>language. As an interpreted language, Python has simpler, more concise syntax than Java. It can perform the same function as Java in fewer lines of code. In Java, the data types of variables should be declared before using them, unlike for Python. You can then decide what appeals more to you here.&nbsp;</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="376" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-1.png" alt="nearshore 2023.11.xx graphic 2 1 1" class="wp-image-25886" title="Automated tests: Selenium + Python vs Selenium + Java 8" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-1.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-1-300x149.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-1-495x246.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<h2 class="wp-block-heading" id="What-is-easier-to-learn:-Java-or-Python?--">What is easier to learn: Java or Python?&nbsp;&nbsp;</h2>



<p>Another question you may have, especially when you are new to programming, is: how quickly can you learn Java vs Python?&nbsp;</p>



<p>And there is no doubt here that Python is the winner. As mentioned above, its syntax is shorter and easier to digest. Java has more complex prototyping; for example, it burdens your code with additional declarations and restrictions.&nbsp;</p>



<p>Choose Python then if you have a short ramp-up period in which to learn.&nbsp;</p>



<p>The list of key factors to take into consideration before making a decision:&nbsp;</p>



<ul class="wp-block-list">
<li><strong>Job opportunities: </strong>still more jobs for Java. </li>



<li><strong>Job changes / migrations: </strong>thanks to scripting, it’s easier for Python if you switch to, for example, DevOps. </li>



<li><strong>Object oriented:</strong> both Python and Java rely on object programming so if you know one of them, you have a good starting point for the other. </li>



<li><strong>Platform independent:</strong> both Python and Java binaries (bytecodes), once generated, can be executed on any supported platforms thanks to their own virtual machines (PVM and JVM respectively). </li>



<li><strong>Simplicity:</strong> Python is easier to use thanks to its simpler syntax.  </li>



<li><strong>Execution: </strong>as a scripting language, Python has the ability to run your script code directly using its <a href="https://docs.python.org/3/tutorial/interpreter.html" target="_blank" rel="noreferrer noopener">interpreter</a> instead of directly running a compiler (like Javac for Java). </li>



<li><strong>Performance / execution speed: </strong>Java has the advantage here as it is faster (can be JIT-compiled to be more efficient). </li>



<li><strong>Popularity / support:</strong> Java wins out here, as solutions based on Java are more popular and it has a very large supporting community. </li>



<li><strong>Python is a statically typed language</strong> (performs type checking at runtime, meaning you can have a code that fails at the very last moment of execution). </li>



<li><strong>Java is a dynamically typed language</strong> (performs type checking at compile time, meaning that you catch problems in your code earlier in the development process). </li>



<li><strong>Extendibility</strong>: since Java is more popular, more plugins, APIs, frameworks and libraries are available on the market than for Python. </li>
</ul>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="options-do-you-have?-">Test automation – what options do you have? </h2>



<p>Selenium satisfies a specific need in the test automation world. It is only for browsers. If you want to quickly start automating your test cases,&nbsp;<a href="https://www.selenium.dev/selenium-ide" target="_blank" rel="noreferrer noopener">Selenium IDE</a>&nbsp;is your friend here, as it allows you to rapidly start automating tests.&nbsp;&nbsp;</p>



<p>The test steps you perform in a browser are directly transformed into a set of commands thanks to&nbsp;<a href="https://www.tutorialspoint.com/what-is-selenese" target="_blank" rel="noreferrer noopener">Selenese</a>, which is Selenium IDE’s built-in language. It is very simple. Moreover, after storing your tests in a set of&nbsp;<a href="https://www.javatpoint.com/selenium-ide-commands" target="_blank" rel="noreferrer noopener">Selenese commands</a>, you can aggregate them into test suites and finally export to your preferred Selenium bindings (e.g., Java, Python, etc.).&nbsp;</p>



<p>Selenese and Selenium IDE is a good start, but the more you dig into the subject of web application automation, the more you see its constraints.&nbsp;</p>



<p>To properly test a modern web application with its dynamically changed content (e.g., using AJAX or JS technologies) you are going to need to start looking for some more advanced options. That’s where Selenium WebDriver comes in, along with its Selenium-specific language bindings. Selenium WebDriver is often used as a basis for testing web applications.&nbsp;&nbsp;</p>



<p>According to the A4Q Selenium 4 Tester syllabus:&nbsp;</p>



<p>„Selenium, when used for testing web applications, needs some testing frameworks. The Selenium engine, as a standalone tool, only exposes its native APIs as methods or functions to the TAE. The TAE must then program a testing framework to use these APIs to carry out the tests required. A testing framework can be conceived from scratch or existing frameworks could be used. The Selenium project supports multiple testing frameworks in diverse languages” such as:&nbsp;&nbsp;</p>



<ul class="wp-block-list">
<li>for Java: <a href="https://selenide.org/" target="_blank" rel="noreferrer noopener">Selenide</a>  </li>



<li>for Python: <a href="https://pypi.org/project/selene/" target="_blank" rel="noreferrer noopener">Selene</a>  </li>
</ul>



<p>Whether you use your own testing framework or not, you need to drive your test execution somehow. Many TAEs use some unit test libraries to drive their tests (test runners).&nbsp;</p>



<p>Some of them like&nbsp;<a href="https://testng.org/" target="_blank" rel="noreferrer noopener">TestNG</a>&nbsp;or&nbsp;<a href="https://docs.pytest.org/" target="_blank" rel="noreferrer noopener">Pytest</a>&nbsp;allow you to create higher-level functional tests apart from its primary unit testing use (functional, component, integration, end-to-end etc.).&nbsp;</p>



<p class="has-text-align-center"><strong>Read also:&nbsp;<a href="https://nearshore-it.eu/articles/guide-to-user-acceptance-testing-uat/" data-type="post" data-id="25764" target="_blank" rel="noreferrer noopener">User Acceptance Testing (UAT) – Why is it important?</a></strong></p>



<h3 class="wp-block-heading">For Python&nbsp;</h3>



<p>The simplest case is to use Python’s standard unit test library, or alternatively you can use the highly popular&nbsp;<a href="https://docs.pytest.org/" target="_blank" rel="noreferrer noopener">Pytest.</a>&nbsp;&nbsp;</p>



<h3 class="wp-block-heading">For Java&nbsp;</h3>



<p>You may use xUnit libraries (e.g., JUnit 4/5) or&nbsp;<a href="https://www.bugraptors.com/blog/junit-vs-testng" target="_blank" rel="noreferrer noopener">TestNG</a>.&nbsp;&nbsp;</p>



<p>Once you are familiar with running tests locally using your chosen browser, you may take a step forward and set up your&nbsp;<a href="https://www.selenium.dev/documentation/grid/" target="_blank" rel="noreferrer noopener">grid</a>&nbsp;of browsers to run tests remotely.&nbsp;</p>



<p>This way, your tests can be run on different browsers and multiple operating systems across a range of machines in parallel mode. If your configuration is large, you could run your regression testing in a fraction of the time it would take without&nbsp;<a href="https://www.selenium.dev/documentation/overview/components/" target="_blank" rel="noreferrer noopener">Selenium</a>&nbsp;Grid.&nbsp;</p>



<p>Later, you can go even further and integrate your tests into the CI/CD pipeline (e.g., running&nbsp;<a href="https://qaautomation.expert/2022/04/12/run-selenium-tests-in-gitlab-ci-cd/" target="_blank" rel="noreferrer noopener">Selenium Tests in GitLab CI/CD</a>&nbsp;or Jenkins).&nbsp;</p>



<p>Please note that you could take advantage of containerization techniques like Docker to create various images for automated UI tests.&nbsp;</p>



<p>By doing this, you could prepare a separate VM for any combination of your OS / browser environment for your&nbsp;<a href="https://en.wikipedia.org/wiki/System_under_test" target="_blank" rel="noreferrer noopener">SUT</a>&nbsp;(System Under Test) /&nbsp;<a href="http://www.testthisblog.com/2012/06/lets-make-up-our-minds-put-sut-or-aut.html" target="_blank" rel="noreferrer noopener">AUT&nbsp;</a>(Application Under Test).&nbsp;</p>



<p>CI/CD has been pivotal in setting up software development lifecycles, where new features are constantly updated at maximum levels of speed and efficiency. This allows end-users to access new features without the need to download software updates, offering them a seamless experience.&nbsp;&nbsp;</p>



<p>Given the short span of the release cycle, testing has to be scaled to deliver bug-free software in the allocated timeframe. This is where Selenium plays a pivotal role by providing test automation in the CI/CD pipeline.&nbsp;</p>



<p>Thanks to Selenium automation testing, parallel tests can be performed at the required scale, while&nbsp;<a href="https://github.com/SeleniumHQ/docker-selenium" target="_blank" rel="noreferrer noopener">Docker</a>&nbsp;helps maintain the sanity of the test environment with its ephemeral containers.&nbsp;</p>



<h2 class="wp-block-heading" id="enium-WebDriver?-">What is Selenium WebDriver?&nbsp;</h2>



<p>The most comprehensive source of knowledge to help answer this question can be found on the&nbsp;<a href="https://www.selenium.dev/documentation/webdriver/" target="_blank" rel="noreferrer noopener">Selenium WebDriver page</a>: &nbsp;</p>



<p>„Selenium WebDriver refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just WebDriver.”&nbsp;</p>



<p>or directly from the A4Q syllabus:&nbsp;&nbsp;</p>



<p>„Selenium WebDriver, as the name suggests, interacts with the browser in the same way that a real user would. WebDriver is an end-to-end test compilation tool for web applications that is also frequently referred to as „Selenium WebDriver”.&nbsp;</p>



<p>From a Selenium architectural point of view, all the components are visualized in the official&nbsp;<a href="https://www.selenium.dev/documentation/overview/components/" target="_blank" rel="noreferrer noopener">documentation page.</a>&nbsp;</p>



<p>We can say that WebDriver helps us to mimic user / browser interactions; hence, it is extremely helpful in terms of test automation. WebDriver controls a browser using browser specific drivers which are usually created by their vendors (e.g., Google for Chrome or Mozilla for Firefox).&nbsp;</p>



<p>All the communication is 2-way and is compliant with the following protocols:&nbsp;</p>



<ul class="wp-block-list">
<li><strong>for Selenium 3</strong>: <a href="https://www.selenium.dev/documentation/legacy/json_wire_protocol/" target="_blank" rel="noreferrer noopener">JSON Wire Protocol</a> over HTTP (translated communication) </li>



<li><strong>for Selenium 4:</strong> <a href="https://w3c.github.io/webdriver/webdriver-spec.html" target="_blank" rel="noreferrer noopener">W3C WebDriver Protocol</a> (native communication). See more on the <a href="https://www.w3.org/TR/webdriver/" target="_blank" rel="noreferrer noopener">W3C</a> site </li>
</ul>



<p>Thanks to W3C Protocol introduced in Selenium 4, we have a direct transfer of information between client and server. So, if you are still using Selenium 3 (WebDriver) and are hesitant to upgrade, consider checking the following page:&nbsp;<a href="https://www.selenium.dev/documentation/webdriver/getting_started/upgrade_to_selenium_4/" target="_blank" rel="noreferrer noopener">Upgrade to Selenium 4.</a>&nbsp;</p>



<p>The minimum versions required are<strong>&nbsp;Java version 8 and Python version 3.7.</strong>&nbsp;</p>



<h2 class="wp-block-heading" id="Selenium-and-Python-">Selenium and Python&nbsp;</h2>



<p>If you decide to go this way but don’t yet have the requisite knowledge, then try to play with Selenium IDE and generate your Python code using its export function.&nbsp;&nbsp;</p>



<p>Once you are more familiar with Selenium IDE, you can then prepare your full Selenium / Python test automation development environment.&nbsp;</p>



<p>What you need:&nbsp;</p>



<ul class="wp-block-list">
<li>IDE (<a href="https://www.jetbrains.com/pycharm/" target="_blank" rel="noreferrer noopener">PyCharm</a>, <a href="https://code.visualstudio.com/" target="_blank" rel="noreferrer noopener">Visual Studio Code</a> or <a href="https://www.jetbrains.com/aqua/" target="_blank" rel="noreferrer noopener">Aqua</a>) </li>



<li><a href="https://www.python.org/" target="_blank" rel="noreferrer noopener">Python</a> </li>



<li><a href="https://pypi.org/project/pip/" target="_blank" rel="noreferrer noopener">PIP</a> (Package Installer for Python) </li>



<li>Build tool (<a href="https://pipenv.pypa.io/en/latest/" target="_blank" rel="noreferrer noopener">Pipenv</a>, PIP + <a href="https://docs.python.org/3/library/venv.html" target="_blank" rel="noreferrer noopener">Venv</a>/<a href="https://virtualenv.pypa.io/en/stable/" target="_blank" rel="noreferrer noopener">Virtualenv</a>, <a href="https://python-poetry.org/" target="_blank" rel="noreferrer noopener">Poetry</a> or <a href="https://bazel.build/" target="_blank" rel="noreferrer noopener">Bazel</a>) </li>



<li><a href="https://pypi.org/project/selenium/" target="_blank" rel="noreferrer noopener">Selenium Python bindings</a> </li>



<li><a href="https://www.selenium.dev/documentation/webdriver/browsers/" target="_blank" rel="noreferrer noopener">Selenium browser drivers</a> (<a href="https://chromedriver.chromium.org/downloads" target="_blank" rel="noreferrer noopener">Chrome</a>, <a href="https://github.com/mozilla/geckodriver/releases" target="_blank" rel="noreferrer noopener">Firefox</a>, <a href="https://developer.apple.com/documentation/webkit/about_webdriver_for_safari" target="_blank" rel="noreferrer noopener">Safari</a>, <a href="https://github.com/operasoftware/operachromiumdriver" target="_blank" rel="noreferrer noopener">Opera</a>, <a href="https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" target="_blank" rel="noreferrer noopener">Edge</a> or <a href="https://pypi.org/project/webdriver-manager/" target="_blank" rel="noreferrer noopener">webdriver-manager</a>/<a href="https://www.selenium.dev/blog/2022/introducing-selenium-manager/" target="_blank" rel="noreferrer noopener">SeleniumManager*</a>)</li>



<li>Test Runner (<a href="https://docs.python.org/3/library/unittest.html" target="_blank" rel="noreferrer noopener">Unittest</a> or <a href="https://docs.pytest.org/" target="_blank" rel="noreferrer noopener">Pytest</a>) </li>
</ul>



<p>*Selenium Manager is available starting from version 4.6 (Beta)&nbsp;</p>



<h2 class="wp-block-heading" id="elenium-and-Java-">Selenium and Java&nbsp;</h2>



<p>If you decided to go this way but don’t yet have the requisite knowledge, then try to play with the&nbsp;<a href="https://www.selenium.dev/selenium-ide/" target="_blank" rel="noreferrer noopener">Selenium IDE</a>&nbsp;plugin for Chrome or Firefox and generate your Java code using its export function.&nbsp;</p>



<p>Once you are more familiar with it, you can then prepare your full Selenium / Java test automation development environment.&nbsp;</p>



<p><strong>What you need:&nbsp;</strong></p>



<ul class="wp-block-list">
<li>IDE (<a href="https://www.jetbrains.com/idea/" target="_blank" rel="noreferrer noopener">IDEA</a>, <a href="https://code.visualstudio.com/" target="_blank" rel="noreferrer noopener">Visual Studio Code</a> or <a href="https://www.jetbrains.com/aqua/" target="_blank" rel="noreferrer noopener">Aqua</a>) </li>



<li><a href="https://www.oracle.com/java/technologies/downloads/" target="_blank" rel="noreferrer noopener">Java (JDK)</a> </li>



<li>Build tool (<a href="https://maven.apache.org/" target="_blank" rel="noreferrer noopener">Maven</a> or <a href="https://gradle.org/" target="_blank" rel="noreferrer noopener">Gradle</a>) </li>



<li><a href="https://github.com/SeleniumHQ/selenium/releases/" target="_blank" rel="noreferrer noopener">Selenium Java bindings </a></li>



<li><a href="https://www.selenium.dev/documentation/webdriver/browsers/" target="_blank" rel="noreferrer noopener">Selenium Browser Drivers</a> (<a href="https://chromedriver.chromium.org/downloads" target="_blank" rel="noreferrer noopener">Chrome</a>, <a href="https://github.com/mozilla/geckodriver/releases" target="_blank" rel="noreferrer noopener">Firefox</a>, <a href="https://developer.apple.com/documentation/webkit/about_webdriver_for_safari" target="_blank" rel="noreferrer noopener">Safari</a>, <a href="https://github.com/operasoftware/operachromiumdriver/releases" target="_blank" rel="noreferrer noopener">Opera</a>, <a href="https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" target="_blank" rel="noreferrer noopener">Edge</a> or <a href="https://bonigarcia.dev/webdrivermanager/" target="_blank" rel="noreferrer noopener">WebDriverManager</a>/<a href="https://www.selenium.dev/documentation/selenium_manager/" target="_blank" rel="noreferrer noopener">SeleniumManager*</a>) </li>



<li>Test Runner (<a href="https://junit.org/" target="_blank" rel="noreferrer noopener">JUNIT</a> <a href="https://junit.org/junit4/" target="_blank" rel="noreferrer noopener">4</a>/<a href="https://junit.org/junit5/" target="_blank" rel="noreferrer noopener">5</a> or <a href="https://testng.org/doc/" target="_blank" rel="noreferrer noopener">TestNG</a>)  </li>
</ul>



<p>*Selenium Manager is available starting from version 4.6 (Beta)&nbsp;</p>



<h2 class="wp-block-heading" id="What-is-a-better-option-for-automated-tests-–-Selenium-with-Python-or-Selenium-with-Java?--">What is a better option for automated tests –&nbsp;Selenium with Python or Selenium with Java?&nbsp;&nbsp;</h2>



<p>If you are a complete beginner when it comes to test automation with Selenium and maybe to programming too (whether it is Java or Python), I suggest that you start by using&nbsp;<a href="https://www.selenium.dev/selenium-ide/" target="_blank" rel="noreferrer noopener">Selenium IDE,</a>&nbsp;which is provided in the form of an add-on for Chrome, Firefox and Edge (version 3.x). It allows you to generate your Java / Python code using its export function. It is very straightforward, as you simply record your actions in a browser. Code is generated for you afterwards by exporting to your favorite language function. At the time of writing (June 2023), it was even possible to download a standalone version (4 alpha) of Selenium IDE for several platforms (e.g., Windows, MacOS). Find out more about&nbsp;<a href="https://github.com/SeleniumHQ/selenium-ide/releases/" target="_blank" rel="noreferrer noopener">Selenium’s latest releases.</a>&nbsp;</p>



<p>From the point of view of automation, and especially CI/CD integration, it looks like a combination of Selenium and Java is better suited here. It blends in well with this process thanks to very good integration with tools like<strong>&nbsp;Jenkins/Maven/Gradle.</strong>&nbsp;</p>



<p>This doesn’t mean that you can’t achieve this with Python, albeit it would be more tiresome and some plugins would be necessary. But once again, Python provides simple coding and readability, so if you don’t have a background in Java/Python programming, you may be tempted to use Python.&nbsp;</p>



<p>One of the most important points in the Selenium test automation development process is related to test debugging. Many browsers provide “<strong>DevTools</strong>” – a set of tools that are integrated with the browser that developers can use to debug web apps and explore the performance of their pages.&nbsp;</p>



<p>The first thing that comes to mind in any case is&nbsp;<strong>Chrome DevTools&nbsp;</strong>based on&nbsp;<strong>Chrome DevTools Protocol (CDP):</strong>&nbsp;</p>



<ul class="wp-block-list">
<li><a href="https://developer.chrome.com/docs/devtools/" target="_blank" rel="noreferrer noopener">https://developer.chrome.com/docs/devtools/</a> </li>



<li><a href="https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/</a> </li>



<li><a href="https://www.selenium.dev/selenium/docs/api/Java/org/openqa/selenium/devtools/package-summary.html" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/selenium/docs/api/Java/org/openqa/selenium/devtools/package-summary.html</a> </li>



<li><a href="https://chromedevtools.github.io/devtools-protocol/" target="_blank" rel="noreferrer noopener">https://chromedevtools.github.io/devtools-protocol/</a> </li>
</ul>



<p>which is probably most commonly used and integrated with Selenium 4 itself. It helps you inspect, test and verify your selectors. As selectors are generic and language independent, it has universal usage. Another thing that is useful for debugging your Selenium test code is breakpoints in your favorite IDE. Set it anywhere you seem to have a problem and your test stops in the browser at that moment. Now you can continue debugging using your browser’s&nbsp;<strong>DevTools&nbsp;</strong>such as&nbsp;<strong>Chrome DevTools.</strong>&nbsp;</p>



<p>This works both for Java (e.g.,&nbsp;<strong>IDEA</strong>) and Python (e.g.,&nbsp;<strong>PyCharm</strong>). But there is one thing for Python that is very interesting for debugging too. It is called&nbsp;<strong>PDB (The Python Debugger)</strong>&nbsp;and it is one of the best debugging techniques for Selenium.&nbsp;</p>



<ul class="wp-block-list">
<li><a href="https://docs.python.org/3/library/pdb.html" target="_blank" rel="noreferrer noopener">https://docs.python.org/3/library/pdb.html</a> </li>



<li><a href="https://realpython.com/python-debugging-pdb/" target="_blank" rel="noreferrer noopener">https://realpython.com/python-debugging-pdb/</a> </li>



<li><a href="https://visualmodo.com/6-simple-tips-for-debugging-selenium-python-code/" target="_blank" rel="noreferrer noopener">https://visualmodo.com/6-simple-tips-for-debugging-selenium-python-code/</a> </li>



<li><a href="https://seleniumbase.com/the-ultimate-pytest-debugging-guide-2021/" target="_blank" rel="noreferrer noopener">https://seleniumbase.com/the-ultimate-pytest-debugging-guide-2021/</a> </li>



<li><a href="https://www.codementor.io/@stevek/advanced-python-debugging-with-pdb-g56gvmpfa" target="_blank" rel="noreferrer noopener">https://www.codementor.io/@stevek/advanced-python-debugging-with-pdb-g56gvmpfa</a> </li>
</ul>



<p>This Python module gives you an interactive source code debugging option. To see how useful it could be, look at the example below:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> py 
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from selenium import webdriver 
>>> from selenium.webdriver.common.by import By 
>>> import pdb 
>>> if __name__ == '__main__': 
...   print('Hello World!') 
...   browser = webdriver.Chrome() 
...   browser.get('http://selenium.dev/') 
...   web_driver_selector = "div.selenium-button-container a.selenium-webdriver" 
...   web_driver_link = browser.find_element(By.CSS_SELECTOR, web_driver_selector) 
...   pdb.set_trace() 
...   browser.quit() 
... 
Hello World! </pre>



<p>and now when your browser is stopped at the breakpoint set on the&nbsp;<a href="http://selenium.dev/" target="_blank" rel="noreferrer noopener">http://selenium.dev/</a>&nbsp;page, you can check the web_driver_link:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">(Pdb) dir 
&lt;built-in function dir> 
(Pdb) dir(web_driver_link) 
['__abstractmethods__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_execute', '_id', '_parent', '_upload', 'accessible_name', 'aria_role', 'clear', 'click', 'find_element', 'find_elements', 'get_attribute', 'get_dom_attribute', 'get_property', 'id', 'is_displayed', 'is_enabled', 'is_selected', 'location', 'location_once_scrolled_into_view', 'parent', 'rect', 'screenshot', 'screenshot_as_base64', 'screenshot_as_png', 'send_keys', 'shadow_root', 'size', 'submit', 'tag_name', 'text', 'value_of_css_property'] </pre>



<p>As you can see above, pdb gives you the opportunity to inspect your object and what you can do with it using dir command, for example:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">(Pdb) web_driver_link.is_displayed() 
True 
(Pdb) web_driver_link.is_enabled() 
True 
(Pdb) web_driver_link.is_selected() 
False 
(Pdb) web_driver_link.text 
'READ MORE' 
(Pdb) web_driver_link.get_property('href') 
'https://www.selenium.dev/documentation/webdriver/' 
(Pdb) web_driver_link.get_dom_attribute('class') 
'selenium-button selenium-webdriver text-uppercase font-weight-bold' 
(Pdb) web_driver_link.get_attribute('class') 
'selenium-button selenium-webdriver text-uppercase font-weight-bold' 
(Pdb) web_driver_link.get_dom_attribute 
&lt;bound method WebElement.get_dom_attribute of &lt;selenium.webdriver.remote.webelement.WebElement (session="b51ad53a899388ec9293d83fd0750a98", element="E97FE72B561D59DFF64B6C8846C4CC17_element_31")>> 
(Pdb) web_driver_link.id 
'E97FE72B561D59DFF64B6C8846C4CC17_element_31' 
(Pdb) web_driver_link.__class__ 
&lt;class 'selenium.webdriver.remote.webelement.WebElement'> 
(Pdb) web_driver_link.value_of_css_property 
&lt;bound method WebElement.value_of_css_property of &lt;selenium.webdriver.remote.webelement.WebElement (session="b51ad53a899388ec9293d83fd0750a98", element="E97FE72B561D59DFF64B6C8846C4CC17_element_31")>> 
(Pdb) web_driver_link.value_of_css_property('color') 
'rgba(200, 16, 46, 1)' 
(Pdb) </pre>



<p>This could also be one of the arguments in Python’s favor. You may even extend it to include an ipdb add-on that improves the experience of the pdb debugger:&nbsp;&nbsp;</p>



<p>ipdb Debug Mode adds color-coded syntax highlighting, tab-completion, and an expanded view of the code with line numbers. ipdb must be installed separately from pytest before use:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install ipdb  </pre>



<h2 class="wp-block-heading" id="What-is-Selenium-with-Python-for?-">What is Selenium with Python for?&nbsp;</h2>



<p>This blend of technologies is meant for testing front end web applications. It helps to leverage your tedious and repeatable GUI actions or tests and replace them with automated scripts. By doing so, you can integrate them further with CI/CD tools for nightly regression testing, for example. If I were to answer this in only one sentence I would say:&nbsp;</p>



<p><strong>Selenium + Python is basically for web application test automation.</strong>&nbsp;</p>



<p>Selenium (WebDriver) is responsible for 2-way client-server communication between you and the browser. Python and its Python Selenium bindings wrap everything in executable code driven by testing frameworks like xUnit / TestNG.&nbsp;</p>



<h3 class="wp-block-heading">Is Selenium with Python a good choice?&nbsp;</h3>



<p>I would say that the answer to this question depends on many factors. Each of us is different and has our own experience, skills and ability to learn. The final answer to this question will be specific to you. The aim of this article is to help you find it. Read the article and analyze it along with your professional objectives, your past, present and future, as it could indeed be your best choice.&nbsp;</p>



<h2 class="wp-block-heading" id="How-to-execute-Selenium-script-in-Python?-">How to execute Selenium script in Python?&nbsp;</h2>



<p>In Python, we can distinguish 2 main types of Python files:&nbsp;</p>



<ul class="wp-block-list">
<li><strong>.py </strong>files are human readable text files with Python code inside, called Python scripts (on Windows systems the extension can also be<strong> .pyw</strong>). </li>



<li><strong>.pyc </strong>files are compiled bytecode files that are generated by the Python interpreter when a Python script is imported or executed. </li>
</ul>



<p>Python files are saved on the user machine with the file extension “<strong>.py</strong>” as Java files are saved with .java extensions. Python codes are then converted to bytecodes after being interpreted. These bytecodes are saved in files with the extension “<strong>.pyc</strong>”.&nbsp;&nbsp;</p>



<p>The “<a href="https://www.w3docs.com/snippets/python/what-is-pycache.html" target="_blank" rel="noreferrer noopener">__pycache__</a>” directory is the folder created to store the “<strong>.pyc</strong>” files.&nbsp;</p>



<ul class="wp-block-list">
<li><a href="https://prepinsta.com/python/difference-between-py-pyc-and-pycache-files/" target="_blank" rel="noreferrer noopener">https://prepinsta.com/python/difference-between-py-pyc-and-pycache-files/</a> </li>



<li><a href="https://stackabuse.com/differences-between-pyc-pyd-and-pyo-python-files/" target="_blank" rel="noreferrer noopener">https://stackabuse.com/differences-between-pyc-pyd-and-pyo-python-files/</a> </li>



<li><a href="https://net-informations.com/python/iq/pyc.htm" target="_blank" rel="noreferrer noopener">https://net-informations.com/python/iq/pyc.htm</a> </li>
</ul>



<p>Think of a .pyc file as a compiled bytecode, similar to a .class file in the JAVA world.&nbsp;</p>



<p>As soon as you&nbsp;<a href="https://docs.python.org/dev/whatsnew/3.2.html#pep-3147-pyc-repository-directories" target="_blank" rel="noreferrer noopener">generate it</a>, it can be directly executed by the interpreter without recompiling a .py script file each time you use it. By doing so, you speed up the execution, which is important when you have large python scripts and/or modules.&nbsp;</p>



<p>To sum up:&nbsp;</p>



<ul class="wp-block-list">
<li><strong>.pyc </strong>files are generated automatically by the Python interpreter when a Python script is imported or executed. </li>
</ul>



<ul class="wp-block-list">
<li><strong>.pyc </strong>files are stored in the same directory as the corresponding <strong>.py </strong>files, and have the same name as the<strong> .py</strong> files, except with a <strong>.pyc </strong>extension instead of <strong>.py.</strong> </li>



<li><strong>.pyc </strong>files are specific to the version of Python that was used to generate them. If you try to run a <strong>.pyc </strong>file with a different version of Python, you may encounter errors or unexpected behavior. </li>
</ul>



<p>If you want to run a Python script, you have 2 options:&nbsp;</p>



<ol class="wp-block-list">
<li> run Python Script with the Python Interpreter using Interactive mode (in the form of a piece of code written in an interactive session – useful for debugging). </li>
</ol>



<p><strong>python</strong>&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">e.g., typing your code line by line: 
C:\Users\user> py 
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from selenium import webdriver 
>>> if __name__ == '__main__': 
...   print('Hello World!') 
...   browser = webdriver.Chrome() 
...   browser.get('http://selenium.dev/') 
...   browser.quit() 
... 
Hello World! 
  
DevTools listening on ws://127.0.0.1:56302/devtools/browser/fdca3cc9-4266-49af-a146-41d60ed464eb 
>>> exit() 
  
C:\Users\user> </pre>



<p>or using<strong>&nbsp;exec()&nbsp;</strong>which provides an alternative way of running your scripts:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> py 
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> exec(open('your_script.py').read()) 
Hello World! 
>>> 
>>> quit() 
  
C:\Users\user> </pre>



<p>A Python interactive mode session allows you to write many lines of code, but once you close the session, you lose everything you’ve written.&nbsp;&nbsp;</p>



<p>That’s why the usual way of writing Python programs is by using plain text files. The file with the Python code must be located in your current working directory. The file must be in the Python Module Search Path (PMSP), where Python looks for the modules and packages you import.&nbsp;</p>



<p>2) run Python Script using Command-Line (in the form of a script or module – useful for automation)&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python your_script.py 
  
e.g.: 
C:\Users\user> py your_script.py 
Hello World! </pre>



<p>or even more simply, by using Windows file associations and providing just a script name:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> your_script.py 
Hello World! </pre>



<p>In GNU/Linux systems you can achieve a similar outcome by adding a so-called hashbang or shebang to your script, which is the character combination #! followed by the interpreter path.&nbsp;</p>



<p>There are two ways to specify the path to the interpreter:&nbsp;</p>



<ul class="wp-block-list">
<li><strong>#!/usr/bin/python</strong>: writing the absolute path. </li>



<li><strong>#!/usr/bin/env python</strong>:<strong> </strong>using the operating system env command, which locates and executes Python by searching the PATH environment variable. </li>
</ul>



<p>As not all Unix-like systems locate the Python interpreter at the same location, the second flavor of path given above looks more universal.&nbsp;</p>



<p>You need to add execution permission as well:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#assign the execution permissions 
chmod +x your_script.py 
#run script using its filename 
./your_script.py 
Hello World! </pre>



<p>You can run your bytecode-generated script directly as well:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> dir your_script.py 
Volume in drive C is Windows 
Volume Serial Number is 94D2-9546 
  
Directory of C:\Users\user 
  
15-Jun-23 14:02        544 your_script.py 
        1 File(s)      544 bytes 
        0 Dir(s) 194,664,701,952 bytes free 
  
C:\Users\user> cd __pycache__ 
  
C:\Users\user\__pycache__> dir your_script.cpython-311.pyc 
Volume in drive C is Windows 
Volume Serial Number is 94D2-9546 
  
Directory of C:\Users\user\__pycache__ 
  
15-Jun-23 14:06        401 your_script.cpython-311.pyc 
        1 File(s)      401 bytes 
        0 Dir(s) 194,664,546,304 bytes free 
  
C:\Users\user\__pycache__> your_script.cpython-311.pyc 
Hello World! 
  
C:\Users\user\__pycache__> </pre>



<h2 class="wp-block-heading" id="How-to-install-Selenium-with-PIP?-">How to install Selenium with PIP?&nbsp;</h2>



<ul class="wp-block-list">
<li>install Python (manually or using IDE) </li>
</ul>



<p>Go to&nbsp;<a href="https://www.python.org/" target="_blank" rel="noreferrer noopener">Python.org</a>&nbsp;and get the suitable&nbsp;<a href="https://www.python.org/ftp/python/" target="_blank" rel="noreferrer noopener">version</a>.&nbsp;<br></p>



<p>py –version</p>



<p>Python 3.N.N</p>



<p>e.g. for WIN (CMD):</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> py --version 
Python 3.11.4 
  
C:\Users\user> </pre>



<ul class="wp-block-list">
<li><a href="https://pip.pypa.io/en/stable/" target="_blank" rel="noreferrer noopener">install or upgrade PIP</a> (manually or using IDE) </li>
</ul>



<h3 class="wp-block-heading" id="How-to-install-Selenium-with-PIP?-">What is PIP?&nbsp;</h3>



<p>PIP is the package installer for Python. You can use it to install packages from the Python Package Index and other indexes. The most popular tool for installing Python packages, and the one included with modern versions of Python.&nbsp;&nbsp;</p>



<p>It provides the essential core features for finding, downloading, and installing packages from other Python package indexes, and can be incorporated into a wide range of development workflows via its command-line interface (CLI).&nbsp;</p>



<p>py -m pip –version</p>



<p>pip X.Y.Z from … (python 3.N.N)</p>



<p><br>e.g., for WIN (CMD):&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> py -m pip --version 
pip 23.1.2 from C:\Program Files\Python311\Lib\site-packages\pip (python 3.11) 
  
C:\Users\user> </pre>



<p>e.g., for WIN (IDE):&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip list 
 
 
setuptools 65.5.1 
wheel   0.38.4 
  
[notice] A new release of pip available: 22.3.1 -> 23.1.2 
[notice] To update, run: python.exe -m pip install --upgrade pip 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip --version 
pip 22.3.1 from C:\Users\user\PycharmProjects\pythonSelenium\venv\Lib\site-packages\pip (python 3.11) 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> python.exe -m pip install --upgrade pip 
Requirement already satisfied: pip in c:\users\user\pycharmprojects\pythonselenium\venv\lib\site-packages (22.3.1) 
Collecting pip 
 Downloading pip-23.1.2-py3-none-any.whl (2.1 MB) 
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 2.7 MB/s eta 0:00:00 
Installing collected packages: pip 
 Attempting uninstall: pip 
  Found existing installation: pip 22.3.1 
  Uninstalling pip-22.3.1: 
   Successfully uninstalled pip-22.3.1 
Successfully installed pip-23.1.2 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium>  
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip --version 
pip 23.1.2 from C:\Users\user\PycharmProjects\pythonSelenium\venv\Lib\site-packages\pip (python 3.11) 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium>  
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip list 
Package  Version 
---------- ------- 
pip    23.1.2 
setuptools 65.5.1 
wheel   0.38.4 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium>  </pre>



<p>If that worked, congratulations! You have a working PIP in your environment.&nbsp;</p>



<ul class="wp-block-list">
<li> install <a href="https://pypi.org/project/selenium/#files" target="_blank" rel="noreferrer noopener">Selenium Python bindings</a> <br> </li>
</ul>



<p>Verify the supported Python version (as of Selenium 4.10.0):&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install selenium 
pip install -U selenium </pre>



<p>If you have PIP on your system, you can simply install or upgrade the Python bindings:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install selenium==&lt;version_number> </pre>



<p>If you want the specific Selenium python bindings version:&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip install selenium==&lt;version_number> </pre>



<p>Alternately, you can download the source distribution from PyPI (e.g. selenium-4.10.0.tar.gz), unarchive it, and run:&nbsp;</p>



<p>py setup.py install</p>



<p>e.g. for WIN (CMD):</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\user> py -m pip list 
Package  Version 
---------- ------- 
pip    23.1.2 
setuptools 65.5.0 
  
C:\Users\user> 
C:\Users\user> py -m pip install selenium 
Defaulting to user installation because normal site-packages is not writeable 
Collecting selenium 
 Downloading selenium-4.10.0-py3-none-any.whl (6.7 MB) 
   ---------------------------------------- 6.7/6.7 MB 23.7 MB/s eta 0:00:00 
Collecting urllib3[socks]&lt;3,>=1.26 (from selenium) 
 Downloading urllib3-2.0.3-py3-none-any.whl (123 kB) 
   ---------------------------------------- 123.6/123.6 kB ? eta 0:00:00 
Collecting trio~=0.17 (from selenium) 
 Downloading trio-0.22.0-py3-none-any.whl (384 kB) 
   ---------------------------------------- 384.9/384.9 kB 25.0 MB/s eta 0:00:00 
Collecting trio-websocket~=0.9 (from selenium) 
 Downloading trio_websocket-0.10.3-py3-none-any.whl (17 kB) 
Collecting certifi>=2021.10.8 (from selenium) 
 Downloading certifi-2023.5.7-py3-none-any.whl (156 kB) 
   ---------------------------------------- 157.0/157.0 kB 9.2 MB/s eta 0:00:00 
Collecting attrs>=19.2.0 (from trio~=0.17->selenium) 
 Downloading attrs-23.1.0-py3-none-any.whl (61 kB) 
   ---------------------------------------- 61.2/61.2 kB 3.2 MB/s eta 0:00:00 
Collecting sortedcontainers (from trio~=0.17->selenium) 
 Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB) 
Collecting async-generator>=1.9 (from trio~=0.17->selenium) 
 Downloading async_generator-1.10-py3-none-any.whl (18 kB) 
Collecting idna (from trio~=0.17->selenium) 
 Downloading idna-3.4-py3-none-any.whl (61 kB) 
   ---------------------------------------- 61.5/61.5 kB 3.2 MB/s eta 0:00:00 
Collecting outcome (from trio~=0.17->selenium) 
 Downloading outcome-1.2.0-py2.py3-none-any.whl (9.7 kB) 
Collecting sniffio (from trio~=0.17->selenium) 
 Downloading sniffio-1.3.0-py3-none-any.whl (10 kB) 
Collecting cffi>=1.14 (from trio~=0.17->selenium) 
 Downloading cffi-1.15.1-cp311-cp311-win_amd64.whl (179 kB) 
   ---------------------------------------- 179.0/179.0 kB ? eta 0:00:00 
Collecting exceptiongroup (from trio-websocket~=0.9->selenium) 
 Downloading exceptiongroup-1.1.1-py3-none-any.whl (14 kB) 
Collecting wsproto>=0.14 (from trio-websocket~=0.9->selenium) 
 Downloading wsproto-1.2.0-py3-none-any.whl (24 kB) 
Collecting pysocks!=1.5.7,&lt;2.0,>=1.5.6 (from urllib3[socks]&lt;3,>=1.26->selenium) 
 Downloading PySocks-1.7.1-py3-none-any.whl (16 kB) 
Collecting pycparser (from cffi>=1.14->trio~=0.17->selenium) 
 Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB) 
   ---------------------------------------- 118.7/118.7 kB ? eta 0:00:00 
Collecting h11&lt;1,>=0.9.0 (from wsproto>=0.14->trio-websocket~=0.9->selenium) 
 Downloading h11-0.14.0-py3-none-any.whl (58 kB) 
   ---------------------------------------- 58.3/58.3 kB ? eta 0:00:00 
Installing collected packages: sortedcontainers, urllib3, sniffio, pysocks, pycparser, idna, h11, exceptiongroup, certifi, attrs, async-generator, wsproto, outcome, cffi, trio, trio-websocket, selenium 
Successfully installed async-generator-1.10 attrs-23.1.0 certifi-2023.5.7 cffi-1.15.1 exceptiongroup-1.1.1 h11-0.14.0 idna-3.4 outcome-1.2.0 pycparser-2.21 pysocks-1.7.1 selenium-4.10.0 sniffio-1.3.0 sortedcontainers-2.4.0 trio-0.22.0 trio-websocket-0.10.3 urllib3-2.0.3 wsproto-1.2.0 
  
C:\Users\user> 
C:\Users\user> py -m pip freeze 
async-generator==1.10 
attrs==23.1.0 
certifi==2023.5.7 
cffi==1.15.1 
exceptiongroup==1.1.1 
h11==0.14.0 
idna==3.4 
outcome==1.2.0 
pycparser==2.21 
PySocks==1.7.1 
selenium==4.10.0 
sniffio==1.3.0 
sortedcontainers==2.4.0 
trio==0.22.0 
trio-websocket==0.10.3 
urllib3==2.0.3 
wsproto==1.2.0 
  
C:\Users\user> 
C:\Users\user> py -m pip show selenium 
Name: selenium 
Version: 4.10.0 
Summary: 
Home-page: https://www.selenium.dev 
Author: 
Author-email: 
License: Apache 2.0 
Location: C:\Users\user\AppData\Roaming\Python\Python311\site-packages 
Requires: certifi, trio, trio-websocket, urllib3 
Required-by: 
  
C:\Users\user> 
  
  
or for WIN (IDE): 
  
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip install selenium 
Collecting selenium 
 Using cached selenium-4.10.0-py3-none-any.whl (6.7 MB) 
Collecting urllib3[socks]&lt;3,>=1.26 (from selenium) 
 Using cached urllib3-2.0.3-py3-none-any.whl (123 kB) 
Collecting trio~=0.17 (from selenium) 
 Using cached trio-0.22.0-py3-none-any.whl (384 kB) 
Collecting trio-websocket~=0.9 (from selenium) 
 Using cached trio_websocket-0.10.3-py3-none-any.whl (17 kB) 
Collecting certifi>=2021.10.8 (from selenium) 
 Using cached certifi-2023.5.7-py3-none-any.whl (156 kB) 
Collecting attrs>=19.2.0 (from trio~=0.17->selenium) 
 Using cached attrs-23.1.0-py3-none-any.whl (61 kB) 
Collecting sortedcontainers (from trio~=0.17->selenium) 
 Using cached sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB) 
Collecting async-generator>=1.9 (from trio~=0.17->selenium) 
 Using cached async_generator-1.10-py3-none-any.whl (18 kB) 
Collecting idna (from trio~=0.17->selenium) 
 Using cached idna-3.4-py3-none-any.whl (61 kB) 
Collecting outcome (from trio~=0.17->selenium) 
 Using cached outcome-1.2.0-py2.py3-none-any.whl (9.7 kB) 
Collecting sniffio (from trio~=0.17->selenium) 
 Using cached sniffio-1.3.0-py3-none-any.whl (10 kB) 
Collecting cffi>=1.14 (from trio~=0.17->selenium) 
 Using cached cffi-1.15.1-cp311-cp311-win_amd64.whl (179 kB) 
Collecting exceptiongroup (from trio-websocket~=0.9->selenium) 
 Using cached exceptiongroup-1.1.1-py3-none-any.whl (14 kB) 
Collecting wsproto>=0.14 (from trio-websocket~=0.9->selenium) 
 Using cached wsproto-1.2.0-py3-none-any.whl (24 kB) 
Collecting pysocks!=1.5.7,&lt;2.0,>=1.5.6 (from urllib3[socks]&lt;3,>=1.26->selenium) 
 Using cached PySocks-1.7.1-py3-none-any.whl (16 kB) 
Collecting pycparser (from cffi>=1.14->trio~=0.17->selenium) 
 Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB) 
Collecting h11&lt;1,>=0.9.0 (from wsproto>=0.14->trio-websocket~=0.9->selenium) 
 Using cached h11-0.14.0-py3-none-any.whl (58 kB) 
Installing collected packages: sortedcontainers, urllib3, sniffio, pysocks, pycparser, idna, h11, exceptiongroup, certifi, attrs, async-generator, wsproto, outco 
me, cffi, trio, trio-websocket, selenium 
Successfully installed async-generator-1.10 attrs-23.1.0 certifi-2023.5.7 cffi-1.15.1 exceptiongroup-1.1.1 h11-0.14.0 idna-3.4 outcome-1.2.0 pycparser-2.21 pysoc 
ks-1.7.1 selenium-4.10.0 sniffio-1.3.0 sortedcontainers-2.4.0 trio-0.22.0 trio-websocket-0.10.3 urllib3-2.0.3 wsproto-1.2.0 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium>  
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip list       
Package     Version 
---------------- -------- 
async-generator 1.10 
attrs      23.1.0 
certifi     2023.5.7 
cffi       1.15.1 
exceptiongroup  1.1.1 
h11       0.14.0 
idna       3.4 
outcome     1.2.0 
pip       23.1.2 
pycparser    2.21 
PySocks     1.7.1 
selenium     4.10.0 
sniffio     1.3.0 
sortedcontainers 2.4.0 
trio       0.22.0 
trio-websocket  0.10.3 
urllib3     2.0.3 
wheel      0.38.4 
wsproto     1.2.0 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium> py -m pip show selenium 
Name: selenium 
Version: 4.10.0 
Summary: 
Home-page: https://www.selenium.dev 
Author: 
Author-email: 
License: Apache 2.0 
Location: C:\Users\user\PycharmProjects\pythonSelenium\venv\Lib\site-packages 
Requires: certifi, trio, trio-websocket, urllib3 
Required-by: 
(venv) PS C:\Users\user\PycharmProjects\pythonSelenium>  </pre>



<h2 class="wp-block-heading" id="Test-automation-–-summary--">Test automation – summary &nbsp;</h2>



<p>Selenium supports a number of programming languages for test automation. Among developers, both Java and Python have achieved record-breaking popularity. Python is easy to learn, and its syntax is simple to read, so if you are new to programming, using Selenium with Python might sound interesting in terms of automation. On the other hand, Java and Selenium are an excellent fit for the entire software development process, especially in the context of CI/CD integration, thanks to the use of the appropriate build tools. The answer to the question of which to use, Java or Python, is up to you, depending on your professional background and objectives for the future.&nbsp;&nbsp;</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="Automated tests: Selenium + Python vs Selenium + Java 9"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="FAQ---starting-points-for-Selenium-with-Java-or-Python-">FAQ – starting points for Selenium with Java or Python </h2>



<p>Here is your starter pack for test automation with Selenium + Java or Selenium + Python, no matter which of them you decide to use.&nbsp;</p>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-1698151090943" class="rank-math-list-item">
<h3 class="rank-math-question ">Selenium / WebDriver with language bindings </h3>
<div class="rank-math-answer ">

<p><a href="https://selenium.dev/downloads" target="_blank" rel="noreferrer noopener">https://selenium.dev/downloads</a> <br /><a href="https://www.selenium.dev/downloads/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/downloads/</a> <br /><a href="https://github.com/SeleniumHQ/Selenium" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/Selenium</a> <br /><a href="https://www.selenium.dev/documentation/webdriver/getting_started/install_library/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/documentation/webdriver/getting_started/install_library/</a> <br /><a href="https://www.selenium.dev/documentation/webdriver/getting_started/first_script/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/documentation/webdriver/getting_started/first_script/</a> <br /><a href="https://www.selenium.dev/selenium-ide/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/selenium-ide/</a> <br /><a href="https://www.tutorialspoint.com/what-is-selenese" target="_blank" rel="noreferrer noopener">https://www.tutorialspoint.com/what-is-selenese</a> <br /><a href="https://www.javatpoint.com/selenium-ide-commands" target="_blank" rel="noreferrer noopener">https://www.javatpoint.com/selenium-ide-commands</a> <br /><a href="https://github.com/SeleniumHQ/selenium-ide/releases/latest" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium-ide/releases/latest</a> <br /><a href="https://github.com/SeleniumHQ/selenium-ide/releases/tag/4.0.0-alpha.40" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium-ide/releases/tag/4.0.0-alpha.40</a> <br /><a href="https://github.com/SeleniumHQ/selenium-ide/releases" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium-ide/releases</a> </p>

</div>
</div>
<div id="faq-question-1698151110998" class="rank-math-list-item">
<h3 class="rank-math-question ">Selenium with Python </h3>
<div class="rank-math-answer ">

<p>Download: <a href="https://pypi.org/project/selenium/#history" target="_blank" rel="noreferrer noopener">https://pypi.org/project/selenium/#history</a> <br />API: <a href="https://seleniumhq.github.io/selenium/docs/api/py/api.html" target="_blank" rel="noreferrer noopener">https://seleniumhq.github.io/selenium/docs/api/py/api.html</a> <br />Changelog: <a href="https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES</a> <br />PyCharm: <a href="https://www.jetbrains.com/pycharm/" target="_blank" rel="noreferrer noopener">https://www.jetbrains.com/pycharm/</a> <br />VSC: <a href="https://code.visualstudio.com/" target="_blank" rel="noreferrer noopener">https://code.visualstudio.com/</a> <br />VSC Python Extension: <a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python" target="_blank" rel="noreferrer noopener">https://marketplace.visualstudio.com/items?itemName=ms-python.python</a> <br />Aqua: <a href="https://www.jetbrains.com/aqua/download" target="_blank" rel="noreferrer noopener">https://www.jetbrains.com/aqua/download</a> <br />Python: <a href="https://www.python.org/" target="_blank" rel="noreferrer noopener">https://www.python.org/</a> <br />PIP: <a href="https://pip.pypa.io/en/stable/" target="_blank" rel="noreferrer noopener">https://pip.pypa.io/en/stable/</a> <br />Python Selenium Bindings: <a href="https://pypi.org/project/selenium/%22%20/l%20%22files" target="_blank" rel="noreferrer noopener">https://pypi.org/project/selenium/#files</a>  <br />Unittest: <a href="https://docs.python.org/3/library/unittest.html" target="_blank" rel="noreferrer noopener">https://docs.python.org/3/library/unittest.html</a> <br />Pytest: <a href="https://pypi.org/project/pytest" target="_blank" rel="noreferrer noopener">https://pypi.org/project/pytest</a> <br />Pipenv: <a href="https://pypi.org/project/pipenv/" target="_blank" rel="noreferrer noopener">https://pypi.org/project/pipenv/</a> <br />Venv: <a href="https://packaging.python.org/en/latest/key_projects/%22%20/l%20%22venv" target="_blank" rel="noreferrer noopener">https://packaging.python.org/en/latest/key_projects/#venv</a> <br />Virtualenv: <a href="https://pypi.org/project/virtualenv/" target="_blank" rel="noreferrer noopener">https://pypi.org/project/virtualenv/</a> <br />Poetry: <a href="https://python-poetry.org/" target="_blank" rel="noreferrer noopener">https://python-poetry.org/</a> <br />Bazel: <a href="https://bazel.build/" target="_blank" rel="noreferrer noopener">https://bazel.build/</a> <br />Browser drivers: <a href="https://www.selenium.dev/downloads/#supported-browsers" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/downloads/#supported-browsers</a> <br />WebDriverManager: <a href="https://pypi.org/project/webdriver-manager/" target="_blank" rel="noreferrer noopener">https://pypi.org/project/webdriver-manager/</a> </p>

</div>
</div>
<div id="faq-question-1698151121790" class="rank-math-list-item">
<h3 class="rank-math-question ">Selenium with Java </h3>
<div class="rank-math-answer ">

<p>Download: <a href="https://github.com/SeleniumHQ/selenium/releases" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium/releases</a> <br />API: <a href="https://seleniumhq.github.io/selenium/docs/api/Java/index.html" target="_blank" rel="noreferrer noopener">https://seleniumhq.github.io/selenium/docs/api/Java/index.html</a> <br />Changelog: <a href="https://github.com/SeleniumHQ/selenium/blob/trunk/Java/CHANGELOG" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium/blob/trunk/Java/CHANGELOG</a> <br />IDEA: <a href="https://www.jetbrains.com/idea/" target="_blank" rel="noreferrer noopener">https://www.jetbrains.com/idea/ </a><br />VSC: <a href="https://code.visualstudio.com/" target="_blank" rel="noreferrer noopener">https://code.visualstudio.com/</a> <br />VSC CODING PACK for JAVA: <a href="https://aka.ms/vscode-java-installer-win" target="_blank" rel="noreferrer noopener">https://aka.ms/vscode-java-installer-win</a> <br />VSC EXTENSION PACK for JAVA: <a href="extension/vscjava.vscode-java-pack" target="_blank" rel="noreferrer noopener">vscode:extension/vscjava.vscode-java-pack </a><br />AQUA: <a href="https://www.jetbrains.com/aqua/download" target="_blank" rel="noreferrer noopener">https://www.jetbrains.com/aqua/download</a> <br />JDK: <a href="https://www.oracle.com/java/technologies/javase-downloads.html" target="_blank" rel="noreferrer noopener">https://www.oracle.com/java/technologies/javase-downloads.html</a> <br />MAVEN: <a href="https://maven.apache.org/" target="_blank" rel="noreferrer noopener">https://maven.apache.org/</a> <br />GRADLE: <a href="https://gradle.org/" target="_blank" rel="noreferrer noopener">https://gradle.org/</a> <br />JAVA SELENIUM BINDINGS: <a href="https://github.com/SeleniumHQ/selenium/releases/" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/selenium/releases/</a> <br />JUNIT 4: <a href="https://junit.org/junit4/" target="_blank" rel="noreferrer noopener">https://junit.org/junit4/</a> <br />JUNIT 5: <a href="https://junit.org/junit5/" target="_blank" rel="noreferrer noopener">https://junit.org/junit5/</a> <br />TESTNG: <a href="https://testng.org/" target="_blank" rel="noreferrer noopener">https://testng.org</a> <br />BROWSER DRIVERS: <a href="https://www.selenium.dev/downloads/#supported-browsers" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/downloads/#supported-browsers</a> <br />WEBDRIVERMANAGER: <a href="https://bonigarcia.dev/webdrivermanager/" target="_blank" rel="noreferrer noopener">https://bonigarcia.dev/webdrivermanager/ </a></p>

</div>
</div>
<div id="faq-question-1698151122870" class="rank-math-list-item">
<h3 class="rank-math-question ">Selenium Grid and Docker Containers </h3>
<div class="rank-math-answer ">

<p><a href="https://www.selenium.dev/documentation/grid/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/documentation/grid/</a> <br /><a href="https://www.selenium.dev/documentation/overview/components/" target="_blank" rel="noreferrer noopener">https://www.selenium.dev/documentation/overview/components/</a> <br /><a href="https://github.com/SeleniumHQ/docker-selenium" target="_blank" rel="noreferrer noopener">https://github.com/SeleniumHQ/docker-selenium</a>  <br /><a href="https://hub.docker.com/r/selenium/standalone-chrome" target="_blank" rel="noreferrer noopener">https://hub.docker.com/r/selenium/standalone-chrome</a>  <br /><a href="https://www.browserstack.com/guide/run-selenium-tests-in-docker" target="_blank" rel="noreferrer noopener">https://www.browserstack.com/guide/run-selenium-tests-in-docker</a>  <br /><a href="https://qaautomation.expert/2022/04/12/run-selenium-tests-in-gitlab-ci-cd/" target="_blank" rel="noreferrer noopener">https://qaautomation.expert/2022/04/12/run-selenium-tests-in-gitlab-ci-cd/</a></p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/selenium-python-vs-selenium-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>User Acceptance Testing (UAT) – Why is it important? </title>
		<link>https://nearshore-it.eu/articles/guide-to-user-acceptance-testing-uat/</link>
					<comments>https://nearshore-it.eu/articles/guide-to-user-acceptance-testing-uat/#respond</comments>
		
		<dc:creator><![CDATA[Paweł Jaroszek]]></dc:creator>
		<pubDate>Fri, 23 Jun 2023 05:24:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Best practices]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25764</guid>

					<description><![CDATA[Acceptance tests (UAT) are performed at the end of the software development process and are an important part of it. From this article, you will learn what the sample acceptance testing process is, what the different types of acceptance tests are and why it is worth resisting the temptation to skip these types of tests in the project. ]]></description>
										<content:encoded><![CDATA[
<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#What-are-Acceptance-Tests-(UAT)?-">1.  What are Acceptance Tests (UAT)? </a></li>
                    <li><a href="#Purpose-of-UAT-(User-Acceptance-Tests),-according-to-ISTQB--">2.  Purpose of UAT (User Acceptance Tests), according to ISTQB  </a></li>
                    <li><a href="#-Importance-of-UAT--">3.  The Importance of UAT  </a></li>
                    <li><a href="#xample-of-UAT-testing-process">4.  The example of UAT testing process   </a></li>
                    <li><a href="#s-of-UAT-tests-">5.  Types of UAT tests </a></li>
                    <li><a href="#erification-or-validation?-">6.  UAT – verification or validation? </a></li>
                    <li><a href="#-up:-Why-should-I-conduct-User-Acceptance-Tes">7.  To sum up: Why should I conduct User Acceptance Tests?  </a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="What-are-Acceptance-Tests-(UAT)?-">What are Acceptance Tests (UAT)?&nbsp;</h2>



<p>Let’s start with what acceptance testing is not. The goal of UATs is not to get something on programmers who have developed software, or on QAs who have run software tests. Acceptance testing (UAT) is part of the software development process (see our article on software testing for more details). At the UAT stage, the product is ready for implementation, and we have to confirm that all requirements have been met.   </p>



<h2 class="wp-block-heading" id="Purpose-of-UAT-(User-Acceptance-Tests),-according-to-ISTQB--">Purpose of UAT (User Acceptance Tests), according to ISTQB &nbsp;</h2>



<p>As per ISTQB, acceptance tests should check: &nbsp;</p>



<ul class="wp-block-list">
<li>end-user requirements  </li>



<li>system requirements </li>



<li>use cases </li>



<li>business processes </li>
</ul>



<p class="has-text-align-center"><strong>Read also:&nbsp;<a href="https://nearshore-it.eu/articles/technologies/test-pyramid-and-types-of-testing/" data-type="post" data-id="25613" target="_blank" rel="noreferrer noopener">The test pyramid – what, when and how to test software to get profits</a></strong></p>



<h2 class="wp-block-heading" id="-Importance-of-UAT--">The Importance of UAT&nbsp;&nbsp;</h2>



<p id="im-learn-to-trust-it-more.---">The customer or users of the system are most often responsible for conducting acceptance tests. The product to be tested by acceptance tests has already been thoroughly checked by the previous system tests. Acceptance tests are run to confirm that the new version meets the customer’s requirements and help him learn to trust it more.  &nbsp;</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="User Acceptance Testing (UAT) – Why is it important?  10"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="xample-of-UAT-testing-process">The example of UAT testing process   </h2>



<ul class="wp-block-list">
<li><strong>Initiation: </strong>
<ul class="wp-block-list">
<li>Defining the conditions of acceptance  </li>



<li>Defining the team responsible for carrying out the tests  </li>



<li>Preparing the environment and the appropriate version of the software </li>



<li>Preparing suitable test data  </li>



<li>Determining the teams/people needed for full support during the tests (this includes providing data, determining who should answer potential questions and a general overview of the teams working in a given PRE-PROD environment, so that other applications are stable while acceptance tests are ongoing   </li>
</ul>
</li>



<li><strong>Design </strong>
<ul class="wp-block-list">
<li>Selecting appropriate test cases and creating a set of tests based on them (test suits)   </li>



<li>Preparing test management tools (here we will mark tests that have been performed with a positive/negative effect)  </li>



<li>Ensuring that test teams have the required accesses  </li>
</ul>
</li>



<li><strong>Execution</strong>
<ul class="wp-block-list">
<li>The test team starts work on the first tests </li>



<li>Marking revealed errors with the use of test tools  </li>



<li>Re-checking new functionalities and regressions  </li>
</ul>
</li>



<li><strong>Summary / Closing: </strong>
<ul class="wp-block-list">
<li>Preparing a report on the test results  </li>



<li>Deciding on implementation based on the report and the errors described therein  </li>
</ul>
</li>
</ul>



<h2 class="wp-block-heading" id="s-of-UAT-tests-">Types of UAT tests&nbsp;</h2>



<p>Acceptance tests performed by users (alpha and beta tests)  &nbsp;</p>



<ul class="wp-block-list">
<li><strong>Alpha tests</strong> – this is a form of internal acceptance tests. These are most often performed by internal Quality Assurance teams and testers.   </li>



<li><strong>Beta testing</strong> is a form of testing carried out by end users. The software version, the so-called beta version, is passed to several external test groups.  </li>
</ul>



<p>Beta testing helps to reveal errors not captured by an internal QA team. This type of test is very cost-effective, and doesn’t require any additional investment.&nbsp;&nbsp;</p>



<p><em>Why do companies back out of conducting beta tests?</em>&nbsp;</p>



<p><strong>Confidentiality</strong>&nbsp;– a common argument against conducting beta tests. Companies are afraid of information about the system leaking to the media.&nbsp;</p>



<p><strong>Too much confidence in one’s own abilities</strong>&nbsp;– companies believe that Quality Assurance team can capture any error.&nbsp;&nbsp;</p>



<p><strong>Too late in the process&nbsp;</strong>– some people claim that beta tests are conducted too late to bring any measurable effects.&nbsp;</p>



<p><strong>Lack of time&nbsp;</strong>– doubts related to reporting errors, e.g., that users won’t be systematic or report duplicated issues, which might impact the time of implementation.&nbsp;&nbsp;</p>



<h3 class="wp-block-heading">Production acceptance tests<strong>&nbsp;</strong> &nbsp;</h3>



<p>Theses are tests designed for the operators and administrators of a given app. The simulated production environment is used for tests related to backup, re-installation of versions, user management, and data migration. &nbsp;</p>



<ul class="wp-block-list">
<li><strong>Acceptance tests</strong> <strong>for compliance with the law</strong> <br>These are tests that are based on checking whether the application complies with current laws, regulations or security standards. Such tests are often performed by users or independent testing teams.  </li>



<li><strong>Acceptance tests for compliance with the contract </strong>  <br>These are tests that check the acceptance criteria included in the contract while setting the terms of the request. Like legal compliance tests, such tests are often performed by users or independent testing teams.  </li>
</ul>



<p class="has-text-align-center"><strong>Read also:&nbsp;<a href="https://nearshore-it.eu/articles/test-automation-tools/" data-type="post" data-id="25659" target="_blank" rel="noreferrer noopener">Test automation tools or good practices? How to speed up testing?</a></strong></p>



<h2 class="wp-block-heading" id="erification-or-validation?-">UAT – verification or validation?&nbsp;</h2>



<p>These concepts are very similar. However, to correctly answer the question of whether acceptance tests constitute verification or validation, let’s start with their definition according to ISTQB.  &nbsp;</p>



<ul class="wp-block-list">
<li><strong>Verification</strong> – checking the correctness and providing objective proof that the product of the software development process meets the defined requirements. </li>



<li><strong>Validation</strong> – checking the correctness and providing objective proof that the product of the software development process meets the user’s needs and requirements. </li>
</ul>



<p>Based on these definitions and my brief introduction to what acceptance tests are, we can conclude that acceptance tests&nbsp;<strong>are run to validate the product</strong>&nbsp;and are one of the last steps in software development.&nbsp;</p>



<p>When answering the question: „Why are acceptance tests important in the software development process?”, it’s best to present their benefits:  &nbsp;</p>



<ul class="wp-block-list">
<li>They build end-user / customer confidence in the system  </li>



<li>They check the compliance of the specifications with functional and non-functional requirements </li>



<li>They check if the system is functioning well </li>
</ul>



<h2 class="wp-block-heading" id="-up:-Why-should-I-conduct-User-Acceptance-Tes">To sum up: Why should I conduct User Acceptance Tests?&nbsp;&nbsp;</h2>



<p>All of this is very important in the software development process. In order for cooperation between the customer and the software provider to bear fruit, it’s necessary to ensure that each new version of the application brings as many benefits as possible, while minimizing the risk of new errors.  </p>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/guide-to-user-acceptance-testing-uat/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Marble testing – RxJS testing and observables 101 </title>
		<link>https://nearshore-it.eu/technologies/marble-testing-and-rxjs/</link>
					<comments>https://nearshore-it.eu/technologies/marble-testing-and-rxjs/#respond</comments>
		
		<dc:creator><![CDATA[Maciej Woźnica]]></dc:creator>
		<pubDate>Thu, 01 Jun 2023 09:51:31 +0000</pubDate>
				<category><![CDATA[Technologies]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=23946</guid>

					<description><![CDATA[In this article, we will take a closer look at RxJS Marble testing – an essential tool for testing the RxJS library. We will examine the principles of observable testing, as well as the technique of marble testing, which facilitates the creation and analysis of tests. We will also see the benefits of this approach and discuss best practices related to RxJS code testing.]]></description>
										<content:encoded><![CDATA[
<div class="table-of-contents">
    <p class="title">GO TO:</p>
    <ol>
                    <li><a href="#RxJS-observables--">1.  RxJS observables  </a></li>
                    <li><a href="#g-(marble-testing-in-RxJS)?-">2.  What is RxJS testing (marble testing in RxJS)?  </a></li>
                    <li><a href="#How-to-write-RxJS-test-cases?---">3.  How to write RxJS test cases?   </a></li>
                    <li><a href="#What-is-a-marble-diagram-in-RxJS?--">4.  What is a marble diagram in RxJS?  </a></li>
                    <li><a href="#iagrams-in-RxJS?--">5.  How to read marble diagrams in RxJS?  </a></li>
                    <li><a href="#es-of-marble-tests-in-RxJS?">6.   What are the types of marble tests in RxJ? </a></li>
                    <li><a href="#benefits-of-RxJS-testing?--">7.  What are the benefits of RxJS testing?  </a></li>
                    <li><a href="#FAQ">8.  FAQ</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="RxJS-observables--">RxJS observables &nbsp;</h2>



<p>RxJS is a library for creating, managing and handling asynchronous data streams in JavaScript applications. The key element of RxJS is observables, which represent the data streams emitted over time. &nbsp;</p>



<p>Observables are based on the Observer design pattern, in which the observer “subscribes” to the observed object and waits for the data it emits. RxJS offers a variety of operators, such as map, filter, and merge, which allow you to transform, filter, and merge data streams. The concept of the RxJS library is described in more detail in the article &#8220;<a href="https://nearshore-it.eu/articles/technologies/rxjs-reactive-javascript/" target="_blank" data-type="URL" data-id="https://nearshore-it.eu/articles/technologies/rxjs-reactive-javascript/" rel="noreferrer noopener">Reactive Programming with JavaScript in RxJS</a>&#8220;. </p>



<h2 class="wp-block-heading" id="g-(marble-testing-in-RxJS)?-">What is RxJS testing (marble testing in RxJS)? </h2>



<p>RxJS enables reactive programming in JavaScript, so you can support asynchronous data streams and manipulate them with various operations, such as mapping, filtering, and merging. RxJS testing is designed to ensure that the code running on these streams is correct, error-free, and meets expectations. </p>



<h3 class="wp-block-heading">Marble testing </h3>



<p>In the context of RxJS testing, it is worth mentioning <strong>marble testing</strong>, which is one of the most popular tools for testing data streams in this library. Marble testing is a visualization of data streams using so-called marble diagrams. In marble, data streams are represented as strings of characters, where each character symbolizes a value in the stream or a special event, such as the end of the stream or the occurrence of an error. Marble testing allows you to define the expected results and compare them with the actual test results, which is especially useful for complex asynchronous operations. &nbsp;</p>



<h3 class="wp-block-heading">Test types</h3>



<p>RxJS testing, especially using marble diagrams, allows you to verify whether functions and reactive operators work correctly in the context of unit tests. Unit tests focus on the evaluation of individual functions, operators and data streams. Their goal is to isolate individual code elements and check whether they behave as expected. &nbsp;</p>



<h3 class="wp-block-heading">RxJS Testing Tools &nbsp;</h3>



<p>To facilitate testing with marble diagrams, RxJS provides tools such as TestScheduler, which allows you to control time virtually without affecting your actual test run time. TestScheduler allows you to define input values and expected output values using marble diagrams, and then simulates data flow in reactive streams. &nbsp;</p>



<h2 class="wp-block-heading" id="How-to-write-RxJS-test-cases?---">How to write RxJS test cases?  &nbsp;</h2>



<p>Writing RxJS test cases requires careful planning, an understanding of the source code, and the use of suitable testing tools. Marble testing is one of the approaches that helps to create transparent tests for data streams. Here are some tips on how to write tests for code based on the RxJS library: &nbsp;</p>



<h3 class="wp-block-heading">1. Get to know the source code &nbsp;</h3>



<p>Before writing test cases, carefully read the source code that will be tested. Understanding the structure of the code and the purpose of individual functions and operators will allow for the creation of effective and comprehensive tests. &nbsp;</p>



<h3 class="wp-block-heading">2. Choose the right testing framework&nbsp;&nbsp;</h3>



<p>Choose a JavaScript testing framework, such as Jasmine, Mocha or Jest, that best suits your needs and preferences. Make sure that the chosen framework works with RxJS and allows you to use marble testing if you plan to take advantage of this approach. &nbsp;</p>



<h3 class="wp-block-heading">3. Create the test structure &nbsp;</h3>



<p>Unit tests are usually organized in &#8220;<strong>describe</strong>&#8221; blocks (or similar, depending on the framework you use) which serve grouping tests for a specific function, operator, or component. In the &#8220;describe&#8221; blocks, we place individual test cases, defined by the &#8220;<strong>it</strong>&#8221; function (or the equivalent in the selected framework).&nbsp;</p>



<h3 class="wp-block-heading">4. Apply marble testing &nbsp;</h3>



<p>Marble testing is an approach that allows you to visualize data streams using so-called marble diagrams. In marble testing, data streams are represented as strings of characters, where each character symbolizes a value in the stream or a special event, such as the end of the stream or the occurrence of an error.&nbsp;&nbsp;</p>



<p>For RxJS testing using marble testing, use tools provided by the library, such as TestScheduler. TestScheduler allows you to control time in a virtual way and define input values and expected output values using marble diagrams.  &nbsp;</p>



<h3 class="wp-block-heading">5. Define test cases &nbsp;</h3>



<p>Test cases should be defined in a legible and understandable manner, describing the expected behavior of a function, operator or data stream. Using marble testing, you can accurately and legibly describe the expected behavior of data streams and compare the actual results with the expected ones. &nbsp;</p>



<h3 class="wp-block-heading">6. Test different cases and scenarios &nbsp;</h3>



<p>When writing test cases, it is worth testing different scenarios, such as: &nbsp;</p>



<ul class="wp-block-list">
<li><strong>Data flow with different values  </strong></li>



<li><strong>Data flow with delays or intervals  </strong></li>



<li><strong>Code behavior in case of errors  </strong></li>



<li><strong>End of data streams  </strong></li>



<li><strong>Proper transfer of values to subsequent operators  </strong></li>



<li><strong>Also, try to include boundary cases to make sure the tested code can resist different situations.  </strong></li>
</ul>



<h3 class="wp-block-heading">7. Browse and improve test cases &nbsp;</h3>



<p>Review your test cases regularly to make sure they are up-to-date and are still working. Try to optimize your tests by eliminating repetitive or redundant pieces of code, as well as making it easier to read and understand. This will facilitate the maintenance and development of tests as the source code changes. &nbsp;</p>



<p>Writing RxJS test cases, especially using marble testing, requires an understanding of the structure of the code, selection of the appropriate framework for testing, creation of a test structure, and definition of the test cases that accurately describe the expected behavior of data streams. By applying the above guidelines, you will be able to create clear and effective unit tests for your code based on the RxJS library. &nbsp;</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="Marble testing – RxJS testing and observables 101  11"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h2 class="wp-block-heading" id="What-is-a-marble-diagram-in-RxJS?--">What is a marble diagram in RxJS?  </h2>



<p>Marble diagrams are visual representations of data streams in the RxJS library that help you understand the flow of data and interactions between operations in streams. The introduction of marble diagrams into the RxJS software development process can improve code readability, facilitate communication between developers, and speed up the testing implementation process. &nbsp;</p>



<h2 class="wp-block-heading" id="iagrams-in-RxJS?--">How to read marble diagrams in RxJS? &nbsp;</h2>



<p>Marble diagrams use characters to represent the values emitted by the stream, the end of the stream, the occurrence of an error, and subscription as well as the cancellation thereof. Here are some additional tips on how to read diagrams: &nbsp;</p>



<p><strong>Time:</strong> Each hyphen (<strong>&#8211;</strong>) means a unit of time, also called a &#8220;frame&#8221;. In marble tests, the length of the time frame is defined in the TestScheduler tool, which allows you to control the time of a test. &nbsp;</p>



<p><strong>Values:</strong> alphanumeric characters (e.g.<strong>, a, b, c</strong>) represent the values emitted by the data stream. These values are usually defined in a value object passed to the <strong>toBe()</strong> method, which maps these characters to actual values.&nbsp;</p>



<p><strong>Subscribing and unsubscribing: </strong>in Marble, we can use the symbol <strong>^</strong> to indicate the moment when the subscription starts, and <strong>!</strong> to indicate the moment when it is cancelled. &nbsp;</p>



<p><strong><em>An example of a marble diagram for RxJS may look like this:</em></strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">---a---b---c---|  </pre>



<p>This diagram represents a data stream that emits three values: <strong>a</strong>, <strong>b</strong>, <strong>c</strong>, each emitted at equal time intervals. The last symbol, <strong>|</strong>, indicates that the stream was finalized after emitting <strong>c</strong>.&nbsp;<br>&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">A B C 

     map(x => x.toUpperCase())  

A B C </pre>



<p>In this case, we have an input stream that emits the values <strong>a</strong>, <strong>b</strong>, <strong>c</strong>. Then we used the map operator, which converts each emitted value into its equivalent with a capital letter. The resulting stream thus emits the values of <strong>A</strong>, <strong>B</strong>, <strong>C.</strong>&nbsp;</p>



<p>Marble diagrams can be much more complicated, with many operators and events. It is vital to understand basic notation to interpret and create such diagrams. &nbsp;</p>



<h2 class="wp-block-heading" id="es-of-marble-tests-in-RxJS?">What are the types of marble tests in RxJS?&nbsp;</h2>



<p>There are two main types of Marble tests in RxJS: unit tests and integration tests. &nbsp;</p>



<h3 class="wp-block-heading">Unit tests&nbsp;</h3>



<p>Unit tests focus on isolating and testing individual components, operators or functions. Marble testing is very useful in unit testing as it allows you to precisely check the sequence of events and the effects of individual operators on data streams. In unit tests, we use TestScheduler, which allows us to control the time and verify the expected test results. &nbsp;</p>



<h3 class="wp-block-heading">Integration tests&nbsp;</h3>



<p>Integration tests test the interactions between different components, operators or functions in the system. Marble testing can also be used in integration tests to examine how different parts of the code work together. In integration tests, we check whether the data flow between different components is in accordance with our expectations. Marble testing in the context of integration testing is more complex than unit testing, but it can provide valuable information about the behavior of the system as a whole. &nbsp;</p>



<p>When testing with marble diagrams, it is also important to understand what “hot” and “cold” operators are. In the context of data streams, a hot operator is one that emits values regardless of whether there is currently any subscription. In turn, the &#8220;cold&#8221; operator begins to emit values only after subscription. In marble tests, the “cold” operator is usually represented by streams marked as <strong>source</strong>. Let&#8217;s picture this using the example below: </p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import { TestScheduler } from 'rxjs/testing'; 

import { of, Subject } from 'rxjs';  

import { map, takeUntil } from 'rxjs/operators';  
 

it('should demonstrate hot and cold observables', () => {  

  const testScheduler = new TestScheduler((actual, expected) => {  

    expect(actual).toEqual(expected);  

  });  

  

  testScheduler.run(({ cold, hot, expectObservable }) => {  

    const sourceCold$ = cold(' --a--b--c--|');  

    const sourceHot$ = hot('  --d--e--f--|');  

    const stop$ = cold('      -----s--|');  

    const expectedMarble = '  --x--y--(z|)';  

  

    const resultCold$ = sourceCold$.pipe(  

      takeUntil(stop$),  

      map(((value) => value.toUpperCase())  

    );  

    const resultHot$ = sourceHot$.pipe(  

      takeUntil(stop$),  

      map(((value) => value.toUpperCase())  

    );  

    expectObservable(resultCold$).toBe(expectedMarble, {  

      x: 'A',  

      y: 'B',  

      from: 'C'  

    });  

    expectObservable(resultHot$).toBe(expectedMarble, {  

      x: 'D',  

8. 

      from: 'F'  

    });  

  });  

});  </pre>



<p>In the example above, we see two data streams: “hot” and “cold”. The “cold” stream only starts emitting values after the subscription, while the “hot” stream emits values regardless of subscription. In the test, we use the<strong> &#8220;</strong>takeUntil&#8221; operator to stop observing data streams at the right time.&nbsp;</p>



<p>To sum up, marble diagrams in RxJS are extremely helpful in understanding the data flow and behavior of individual operators in data streams. Marble testing facilitates the creation of unit and integration tests, which are necessary for the proper functioning of the application based on RxJS. Know-how on marble diagrams and the ability to write effective marble tests are important competencies for every programmer who uses the RxJS library. &nbsp;</p>



<p>When working with marble, it is worth remembering a few additional rules and tips that can facilitate the testing process: </p>



<ul class="wp-block-list">
<li><strong>Naming conventions:</strong> When you create data streams using marble diagrams, it&#8217;s a good idea to maintain naming conventions and use names related to stream functionality. This allows us to better understand which data flows through the streams, making it easier to analyze the test results.  </li>



<li><strong>Using Helper: </strong>In many cases in marble testing, we can use support functions provided by the RxJS library, <strong>such</strong> as TestScheduler,<strong> hot</strong>,<strong> cold</strong>,<strong> time, </strong>expectObservable<strong> and</strong> expectSubscriptions. These features make it easy to create and manage marble diagrams and test the flow of data between different streams.  </li>



<li><strong>Verification of test results:</strong> When writing marble tests, it is worth paying attention to test results and errors reported by testing tools such as Jasmine or Mocha. This allows us to quickly identify and correct errors in the code.  </li>



<li><strong>Accuracy of tests:</strong> Marble testing allows for precise tracking of the sequence of events in data streams. However, it is important to remember that marble testing does not replace other types of testing, such as unit or integration testing. It is worth using different testing techniques depending on the context and needs of the application.  </li>



<li><strong>Practice: </strong>Marble testing may be difficult to understand at first, but over time and with experience it becomes much easier. Working with different examples and scenarios will help you to understand how to best use marble diagrams in RxJS tests.  </li>
</ul>



<p>Using marble in RxJS, you can effectively test data streams and interactions between operations. Marble diagrams make it easier to understand the data flow and the expected test results, which leads to building more reliable and efficient applications. Practice and experience are key to mastering marble testing, but its benefits are priceless to any front-end developer. &nbsp;</p>



<p><strong>Read also:</strong> <a href="https://nearshore-it.eu/articles/project-management-leadership/testers-role-in-a-scrum-team/" data-type="post" data-id="7388" target="_blank" rel="noreferrer noopener">Agile tester roles and responsibilities</a></p>



<h2 class="wp-block-heading" id="benefits-of-RxJS-testing?--">What are the benefits of RxJS testing? &nbsp;</h2>



<ul class="wp-block-list">
<li><strong>The code performs as expected –</strong> testing the RxJS code is extremely important because it allows you to increase the level of certainty that the code is working as you expect. The tests enable developers to be sure that their applications meet the assumed business requirements, which translates to a lower risk of errors or inconsistencies.  </li>



<li><strong>Error detection</strong> – at the same time, testing makes it easier to detect errors, because it checks individual functions, operators and the interactions between them. This allows you to identify and fix problems in the code more quickly. It also shortens the debugging time, as the tests help developers locate the source of the error quickly.  </li>



<li><strong>It’s easier to make changes</strong> – RxJS tests also support making changes to the code, as they automatically check the functionality after each modification. Thanks to this, the programmer can quickly detect and fix any problems resulting from the introduced changes. In addition, the tests facilitate refactoring, because the programmer can be sure that his changes will not result in regression.  </li>



<li><strong>Code documentation </strong>–<strong> </strong>it is also worth mentioning that RxJS tests often serve as documentation for the code, providing information on how to use individual functions and what their expected results are. Such documentation is invaluable to other programmers who wish to understand someone&#8217;s code and familiarize themselves with it.  </li>



<li><strong>Greater trust in software</strong> – finally, testing increases trust in code among both developers and project stakeholders. Everyone can be sure that the application works properly and meets the requirements. Tests are crucial to the maintenance of high quality applications based on data streams and reactive programming.  </li>



<li><strong>Better code</strong> – as a result, testing the RxJS code contributes to better code quality, faster error detection and correction, easier changes and increased trust in the code. As an RxJS expert, I strongly recommend using tests in all projects based on this library.  </li>
</ul>



<h2 class="wp-block-heading rank-math-faq-heading" id="FAQ">FAQ</h2>


<div id="rank-math-faq" class="rank-math-block">
<ol class="rank-math-list ">
<li id="faq-question-1685603845174" class="rank-math-list-item">
<h3 class="rank-math-question ">What are the features of RxJS test frameworks and how to choose the best one?  </h3>
<div class="rank-math-answer ">

<p>RxJS test frameworks are tools for creating, organizing, and executing tests for RxJS-based code. Choosing the best framework depends on the needs of the project and the team&#8217;s preferences. When choosing a test framework for RxJS, it is worth paying attention to the following aspects:  <br /> <br /><strong>Marble Testing Support:</strong> It’s important to choose a framework that supports marble testing, as it is crucial in testing reactive data streams. <br /><strong>Integration with other tools:</strong> See how well the framework integrates with other tools used in the project, such as bundlers, CI/CD environments, and linters. <br /><strong>Ease of use:</strong> the testing framework should be easy to configure and use. <br /><strong>Community Support:</strong> Popular test frameworks are more likely to actively develop and gain the support of the community. <br /><strong>Documentation: </strong>good documentation is crucial for the rapid introduction of the test framework into the project and for understanding its capabilities. <br /><strong>Performance: The</strong> performance of the test framework impacts the duration of the tests. <br /><strong>Flexibility and expandability:</strong> The chosen framework should offer flexibility in configuration and the option to expand it to include additional tools or features. <br />Examples of popular test frameworks supporting RxJS include Jasmine, Jest, and Mocha. Each of them offers different functions and advantages, so it is worth carefully analyzing their capabilities before deciding which to use. </p>

</div>
</li>
<li id="faq-question-1685603861169" class="rank-math-list-item">
<h3 class="rank-math-question ">How to implement RxJS testing? </h3>
<div class="rank-math-answer ">

<p>To implement RxJS testing in your project, you must first choose the right test framework that supports marble testing, such as Jasmine, Jest, or Mocha. The decision should depend on the needs of the project and the preferences of the team. Then proceed to install and configure the selected test framework using a package manager such as NPM or yarn and follow the instructions provided by the framework documentation.  <br /> <br />If the selected test framework does not support marble testing directly, install additional tools such as rxjs-marbles for Mocha or jest-marbles for Jest. Now you can start writing unit tests for RxJS-based components, services, operators, and streams. Use marble tests to represent and test reactive data streams. Make sure you test the key scenarios, both positive and negative, to verify that the code is working properly.  <br /> <br />It is a good idea to put the tests in dedicated files or folders so that they can be easily found and managed. The accepted standard is to place tests in the folder <strong>__tests__</strong> or in files with <strong>the </strong>extension .spec.ts <strong>or .test.ts.</strong> To run the tests, use the tools provided by the test framework, both locally and on the CI/CD server. Depending on the framework, you can use CLI commands such as <strong>npm test</strong>, <strong>yarn test</strong> or <strong>ng test.</strong> <br /> <br />Monitor test results, analyze errors, and fix code issues. Use reporting and statistical tools to assess code quality and track testing progress. As the project grows, update and maintain tests by writing new tests for new features and updating existing tests in case of code changes. This will make it easier to maintain high quality code.  </p>

</div>
</li>
<li id="faq-question-1685603872787" class="rank-math-list-item">
<h3 class="rank-math-question ">What are the most common RxJS testing errors? </h3>
<div class="rank-math-answer ">

<p>One such mistake is not taking the principle of asynchrony into account when testing. When testing data streams, it is important to remember to use appropriate asynchronous testing techniques, such as marble testing, or using the fakeAsync <strong>and</strong> <strong>tick</strong> functions provided by Angular. <br /> <br />Another common mistake is failing to properly manage your subscriptions. If they are not cancelled once the tests are completed, this may lead to memory leaks and false positive test results. It is worth taking the time to manage subscriptions properly, especially when testing components or services.  <br /> <br />Another common mistake is the misuse of RxJS operators, which can lead to unexpected results. It is especially important to understand the difference between <strong>a</strong> switchMap <strong>operator </strong>and a mergeMap operator and other operators that influence the behavior of data streams. <br /> <br />Inadequate error testing can lead to a false sense of security. It is worth paying attention to error handling testing, especially for asynchronous operations such as HTTP requests. In such cases, it is worth using the appropriate operators to handle errors such <strong>as catchError</strong> and <strong>retry</strong>. <br /> <br />Inaccurate testing of boundary conditions and extreme scenarios can lead to a failure to detect problems. Therefore, it is worth striving for full coverage with tests, as well as studying different combinations of input data that can affect the operation of data streams. Testing these cases may reveal potential issues that you may not notice when testing only typical scenarios.  <br /> <br />The last mistake, albeit a no less important one, is the improper use of hot and cold operators in marble testing. It is worth understanding the differences between these operators and knowing when to use them to get reliable test results.  </p>

</div>
</li>
<li id="faq-question-1685603904376" class="rank-math-list-item">
<h3 class="rank-math-question ">What are the design patterns of RxJS testing? </h3>
<div class="rank-math-answer ">

<p>RxJS testing design patterns are proven techniques used in testing applications based on this library. A key element is the implementation of marble tests, which allow the visualization and testing of data streams, as well as the analysis of interactions between them. Thanks to the use of such patterns, asynchronous tests will become more effective, and isolating the tested parts of the application from external dependencies will allow you to control behavior and test various scenarios.  </p>

</div>
</li>
<li id="faq-question-1685603933888" class="rank-math-list-item">
<h3 class="rank-math-question ">What are the best testing practices?  </h3>
<div class="rank-math-answer ">

<p>When it comes to best testing practices in the context of the RxJS library, it is worth focusing on approaches and techniques that make testing effective, efficient and easy to maintain. Asynchronous testing, including <strong>async</strong>, fakeAsync <strong>or</strong> <strong>marble tests</strong>, allows you to test various scenarios related to asynchronous operations. It is also crucial to test error handling to see if they are properly served in data streams. It is important to test boundary conditions and extreme scenarios, which allows you to detect potential problems that you may not notice when testing only typical scenarios. Monitoring the level of test coverage and taking care of the good organization of tests, placing them in dedicated files or folders, makes it easier to manage the code and maintain its transparency.   </p>

</div>
</li>
</ol>
</div>

</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>



<p class="has-text-align-center"><strong>Read also: <a href="https://nearshore-it.eu/articles/what-is-regression-testing-best-practices-and-essential-insights/">What is regression testing</a></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/technologies/marble-testing-and-rxjs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Test automation tools or good practices? How to speed up testing?</title>
		<link>https://nearshore-it.eu/articles/test-automation-tools/</link>
					<comments>https://nearshore-it.eu/articles/test-automation-tools/#respond</comments>
		
		<dc:creator><![CDATA[Mateusz Mirecki]]></dc:creator>
		<pubDate>Wed, 17 May 2023 04:55:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25659</guid>

					<description><![CDATA[As application development continues, the number of automated tests increases accordingly, and it takes an increasingly long time to run them. At the very beginning, the time taken by tests can be counted in minutes, but after a few months of work it can extend to hours or even days. In this article, I reveal some proven methods and good testing practices that will help you reduce the time needed to perform tests.]]></description>
										<content:encoded><![CDATA[
<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#Is-it-possible-to-test-applications-faster?">1.  Is it possible to test applications faster?</a></li>
                    <li><a href="#Parallel-running-of-tests">2.  Creating preconditions using APIs or using a database directly</a></li>
                    <li><a href="#Creating-preconditions-using-APIs-or-using-a-database-directly">3.  Creating preconditions using APIs or using a database directly</a></li>
                    <li><a href="#Converting-Tests-to-Lower-Level-Tests">4.  Converting Tests to Lower Level Tests</a></li>
                    <li><a href="#Breaking-down-tests-into-smaller-packages-and-grouping">5.  Breaking down tests into smaller packages and grouping</a></li>
                    <li><a href="#Reducing-the-number-of-similar-tests">6.  Reducing the number of similar tests</a></li>
                    <li><a href="#Changing-the-test-structure-–-matching-the-test-to-the-tested-functionality">7.  Changing the test structure – matching the test to the tested functionality</a></li>
                    <li><a href="#Appropriate-use-of-waits">8.  Appropriate use of waits</a></li>
                    <li><a href="#Dedicated-database-for-testing">9.  Dedicated database for testing</a></li>
                    <li><a href="#Use-of-headless-mode">10.  Use of headless mode</a></li>
                    <li><a href="#Suitable-equipment-for-testing">11.  Suitable equipment for testing</a></li>
                    <li><a href="#Summary">12.  Summary</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="Is-it-possible-to-test-applications-faster?">Is it possible to test applications faster?</h2>



<p>The dynamically developing technology and growing user requirements make the design of efficient and reliable web applications increasingly complex, and ensuring the proper functioning of the system requires a great deal of effort not only from the development team, but also from the test team. A good set of tests helps to address these challenges. Unfortunately, a focus on quality does not always go hand-in-hand with speed.</p>



<p>It is not only test managers and project managers who dislike the long wait for test results. This is also problematic for developers – the lengthy application testing process may be one of the reasons for delays in software development. For the sake of the project,<strong>&nbsp;tests should be carried out as soon as possible</strong>&nbsp;(using common sense – they also should be reliable and give real information about the tested application). Below are some ways to speed up testing without compromising quality.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="460" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1.png" alt="nearshore 2023.11.xx graphic 2 1" class="wp-image-25800" title="Test automation tools or good practices? How to speed up testing? 12" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-300x183.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_2-1-495x301.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading" id="Parallel-running-of-tests">Parallel running of tests</h3>



<p>Running tests in parallel is the best and most effective way to significantly reduce testing time. By default, in many tools, tests are carried out in a sequential way (only one test is performed at a time, and once it is completed, another one is launched). In general, this option depends on the test runner used and the options it provides for this purpose.</p>



<p>For example,&nbsp;<a href="https://xunit.net/docs/running-tests-in-parallel" target="_blank" rel="noreferrer noopener">XUnit&nbsp;</a>uses a&nbsp;<strong>concept called&nbsp;<em>test collections</em></strong>, which defines how tests can be performed in parallel. By default, each test class is a unique collection, and tests in the same class will not run in parallel – for this to happen, they must be separated into two or more classes. Additionally,&nbsp;<strong>this tool allows you to create custom collections</strong>&nbsp;where the user can apply special attributes to create them, making it easy to manage and group tests as well as to run them accordingly, depending on the context. Other test runners might have similar functionalities. For example, in the Playwright tool, you can run tests in parallel both within one test class and throughout the project using configuration parameters. This option is enabled by default.</p>



<p>How much time can be saved with this approach? Let’s assume (without taking into account machine performance, server latency, network bandwidth, and other factors affecting testing performance) that we have a collection of 100 tests, each performed for an average time of one minute. It will take&nbsp;<strong>1 hour and 40 minutes to start them sequentially</strong>. When running them in two threads (2 tests performed at the same time), the run time needed will be reduced by half – up to<strong>&nbsp;50 minutes</strong>. Adding more threads will allow for an even greater reduction in the time needed to execute them.</p>



<p><strong>Potential problems</strong></p>



<p>Unfortunately, running tests in this way is not the golden mean, where you just need to change the configuration and increase the number of threads. Be aware of potential problems related to running tests in parallel, for example:</p>



<ul class="wp-block-list"><li><strong>the performance of one test may&nbsp;</strong>(e.g., through changes to the database or resource consumption / load)&nbsp;<strong>affect the performance of other ones</strong>. Such tests should be identified and run sequentially (before or after a collection of tests performed in parallel). Thanks to this, we will provide some isolation for all tests, and they will not affect each other while running;</li><li><strong>computer / server performance</strong>&nbsp;– select the maximum number of tests performed in parallel to avoid performance issues.</li></ul>



<p>The appropriate approach to test analysis and dividing them into two groups (those that can be run in parallel and those that should be run sequentially) and selecting the right parameters allowing you to determine the maximum number of tests running can be a challenge, but the benefits of changing the way tests are run will allow you to significantly reduce the time taken for testing. Not only will this give you extra time for other activities, but most of all it will enable you to get feedback from tests earlier and address potential errors and failures more quickly.</p>



<p class="has-text-align-center"><strong>Read also:<a href="https://nearshore-it.eu/articles/technologies/atata-test-automation-framework/" data-type="post" data-id="25754" target="_blank" rel="noreferrer noopener"> Test automation frameworks. Introduction to Atata</a></strong></p>



<h3 class="wp-block-heading" id="Creating-preconditions-using-APIs-or-using-a-database-directly">Creating preconditions using APIs or using a database directly</h3>



<p>When testing the user interface, it is often necessary to properly prepare the configuration of the tested application or use certain data necessary to run the test (these are most often described as&nbsp;<strong>preconditions</strong>). These types of actions should be performed using the API. If possible, the data can be prepared directly in the database. This increases the speed of tests (direct&nbsp;<strong>HTTP&nbsp;</strong>requests or modification of data in the database are faster than „<strong>clicking</strong>” individual options in the interface) and their stability.</p>



<p><strong>Potential problems</strong></p>



<p>Here, too, we face potential problems, such as the need to assure compliance with the API or database. While the API is easy to maintain (in most cases it is a matter of adding/removing fields in requests), in the case of a database you need to know its structure and the relationships between tables.</p>



<h3 class="wp-block-heading" id="Converting-Tests-to-Lower-Level-Tests">Converting Tests to Lower Level Tests</h3>



<p>Performing tests through the user interface is generally slower and less reliable than lower-level tests such as API or unit tests. According to the&nbsp;<a href="https://nearshore-it.eu/articles/technologies/test-pyramid-and-types-of-testing/" target="_blank" data-type="post" data-id="25613" rel="noreferrer noopener">test pyramid</a>, there should be fewer&nbsp;<strong>UI/E2E tests</strong>&nbsp;than tests on lower levels.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="320" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1.png" alt="nearshore 2023.11.xx graphic 1 1" class="wp-image-25795" title="Test automation tools or good practices? How to speed up testing? 13" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1-300x127.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-1-495x210.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>UI tests require the browser to run and interact with it, which equals more time and resources. The interface rendering also takes time; it takes longer for the page to load properly for various reasons (<strong>e.g., a loaded application server or database</strong>). Sometimes the page may behave unpredictably (the component will not load properly, the dynamic element will not appear, etc.). This can not only lengthen the time of testing, but also make it unstable.</p>



<p>If you have multiple UI tests, consider converting them to lower-layer tests if possible. For example, a page access test, which can only be viewed by a logged-in user (e.g., a user of the account panel), can be performed entirely on the UI layer – including logging in. However, you can modify it accordingly and implement login to the application through the&nbsp;<strong>API</strong>, so that the UI layer will be used only to verify a specific page. Moving the login „<strong>lower</strong>” will speed up the execution of the test, because its exact execution on the UI side will be possible to start with the already logged-in user going directly to the desired page.</p>



<h3 class="wp-block-heading" id="Breaking-down-tests-into-smaller-packages-and-grouping">Breaking down tests into smaller packages and grouping</h3>



<p>Grouping tests does not itself affect the performance of tests which have already been created. The goal here is to enable the selection of specific tests or sets of tests due to their properties (tested area, functionality, type, priority, etc.). Thanks to the appropriate specification of test cases, we get an option to run only those tests that are needed at a given point in time. The main split can be done by isolating stability, smoke and regression tests, and providing tests with additional attributes will allow you to start them in almost any configuration (e.g., due to the above-mentioned area and type of tests).</p>



<p>It is not always necessary to run the entire set of tests. Often we want to test only a selected part of the system or a specific functionality. Manual searching and running them would be a very time-consuming activity, and when we have a large set of tests, there is a chance that some may be missed. The use of attributes for filtration allows you to specify all tests that are needed in a given situation. For example, when you have an online store and are working on a new product type, you can only run tests related to adding a product to your basket or wish list before you decide on a full regression.</p>



<p class="has-text-align-center"><strong>Read more: <a href="https://nearshore-it.eu/articles/what-is-regression-testing-best-practices-and-essential-insights/">What is regression testing</a></strong></p>



<h3 class="wp-block-heading" id="Split-testing-–-case-study">Split testing – case study</h3>



<p>Let me give you a real-world example. While working on a project for a customer from the bookmaking industry, we launched regression tests, among others, during each release.</p>



<p><strong>Challenge</strong>:</p>



<p>At the very beginning, they were not categorized except for a few general tags describing what type of test (regression, smoke) it was, its ID in testRail, and who the author was. All tests were performed over about 2 days. Then came the meticulous process of analyzing failures.The client decided to change his approach and make running tests and subsequent analysis easier and faster.</p>



<p><strong>Solution</strong>:</p>



<p>Together with other teams, we developed a process on the basis of which tests were analyzed and assigned to the teams responsible for a given application area. We marked them with new tags corresponding to the tested area, among others; we also created documentation – tests were unified and described. In addition, API/UI tests were extracted. At a later stage, we analyzed whether they were stable – on this basis, we isolated stable and unstable tests (flaky tests). We moved the unstable tests from the regression tests to a separate section and updated them to subsequently add them back to the regression set. During the next stage, we analyzed UI tests and converted them to API tests whenever possible.</p>



<p><strong>Result</strong>:</p>



<p>Thanks to these solutions, we were able to<strong>&nbsp;reduce the time needed to perform all tests to almost 18 hours</strong>, and run additional tests, e.g., for specific areas of the application, so that we did not have to run a full regression every time.</p>



<h3 class="wp-block-heading" id="Reducing-the-number-of-similar-tests">Reducing the number of similar tests</h3>



<p>It may turn out that a set of test cases consists&nbsp;<strong>of tests verifying practically identical functionality</strong>, but using&nbsp;<strong>different data</strong>&nbsp;(e.g., adding 1 product to the basket, adding 5 products to the basket, adding a product from the „household devices” category to the basket, adding a product from the „Consoles” category to the basket). If the second test case does not verify additional criteria (e.g., add a 5% discount when the customer has at least 5 products in the cart), consider whether the test case should continue to be used. This happens especially with a large number of test cases created for large systems, where as they develop you can lose track and create a test case that already exists. Periodic analysis of test cases and updating and verifying them will help to identify such test cases, and further research will answer the question of whether to keep the analyzed test case, modify it or completely remove it.</p>



<h3 class="wp-block-heading" id="Changing-the-test-structure-–-matching-the-test-to-the-tested-functionality">Changing the test structure – matching the test to the tested functionality</h3>



<p>Tests should not only be stable and fast, but also&nbsp;<strong>properly written</strong>&nbsp;– so that they test a specific area of application or functionality. In a properly designed test, the number of steps needed to fully verify functionality should be as small as possible to avoid verifying something that should not be covered by testing. For example, when testing adding a product to the basket (assuming that the user must be logged in), we should not focus on asserting whether the user has actually been logged in – this should be checked when testing the customer’s login area to access the store. In particular, you can fall into such a trap by creating tests according to the&nbsp;<a href="https://nearshore-it.eu/articles/technologies/behavior-driven-development-bdd/">BDD&nbsp;process</a><a href="https://nearshore-it.eu/articles/technologies/behavior-driven-development-bdd/" data-type="post" data-id="25633" target="_blank" rel="noreferrer noopener">&nbsp;</a>(example: specflow), where the test steps are often simply copied from the existing one and placed in a new one, without editing it to fit them into the context.</p>



<p>Let’s consider a test of user login to the application:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Given I navigate to the homepage
And I click the Login button
When I log in as ‘testUser’ with password ‘testPassword’
Then I assert that the My Account button is displayed
And the ‘testUser’ name is displayed</pre>



<p>You can use its steps and add them at the beginning of the test of placing a product in the basket:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Scenario: Add the product to the basket
Given I navigate to the homepage
And I click the Login button
When I log in as ‘testUser’ with password ‘testPassword’
Then I assert that the My Account button is displayed
And the ‘testUser’ name is displayed
When I navigate to a test product page
And I add the product to the basket
Then the Basket should contain the test product</pre>



<p>Steps regarding the correct user login are not relevant in the context of adding a product to the basket – moreover, the login test is duplicated. Its significance is questioned, because logging in will be checked in every test that will be written on that basis.</p>



<p>Instead, it should be modified accordingly to include only the function of adding a product to the basket:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Scenario: Add a product to the basket
When I navigate to a test product page
When I log in as ‘testUser’ with password ‘testPassword’
And I add the product to the basket
Then the Basket should contain the test product</pre>



<p>Thanks to this, the test was optimized in terms of speed and tested functionality.<br>Referring to the aspects related to creating preconditions, the login can be moved to this section and done on the API page, meaning that the test could start directly from navigation to the product page, where the user would already be logged in:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> Background: User is Logged In
Given I login as a test user through API
Scenario: Add the product to the basket
 When I navigate to a test product page
And I add the product to the basket 
Then the Basket should contain the test product</pre>



<p>Going a step further referring to the test conversion, if it is not necessary to check something on the UI side, you can try to convert the test to the API level and speed up its execution even more.</p>



<h3 class="wp-block-heading" id="Appropriate-use-of-waits">Appropriate use of waits</h3>



<p>The content of the application can be displayed statically or dynamically.&nbsp;<strong>AJAX technology</strong>, in which communication with the server takes place in an asynchronous manner without the need to reload the entire document,&nbsp;<strong>is used</strong>&nbsp;for the dynamic display of content. Thanks to this, the elements are loaded on the page at different intervals.<br>Unfortunately, this behavior forces the use of the right approach to interact with dynamically loaded elements. Using the static&nbsp;<strong>Thread.Sleep() method</strong>, which suspends code execution for a specified period of time, is not recommended. This results in an unnecessary extension of test time, and if the desired item is loaded faster than the declared pause, the program will wait idle until the specified time. If the item is not loaded before the specified time, the test will fail, as there are many factors affecting the load of the item (server load, network bandwidth, etc.), and sometimes it may take several seconds. Excessive wait time can also affect the stability of tests, which can sometimes fail.</p>



<p>Multiple automation frameworks (e.g.,&nbsp;<strong>Selenium</strong>,&nbsp;<strong>Cypress</strong>,&nbsp;<strong>Playwright&nbsp;</strong>or&nbsp;<strong>Spock</strong>) contain built-in solutions. It is also worth mentioning external libraries such as Awaitability, which can extend the functionality of other tools. For this purpose, you can implement methods that will wait for further code execution until a specific condition is met (<strong>conditional waits</strong>). An additional advantage of this approach is the ability to define these methods globally and use them without duplicating code in tests, which also makes it easier to maintain the repository.</p>



<h3 class="wp-block-heading" id="Dedicated-database-for-testing">Dedicated database for testing</h3>



<p>An undoubted advantage is the separation of data from the rest of the environments used in the project, thanks to which the processes do not disturb each other – sudden implementation in a given environment jointly used by the entire team or changes made manually will not affect the performance of tests. To create such a database, you can use the production base, which will give you a very similar test environment to that utilized by end users of the application.<br>When using a separate database, remember to manage it properly – for example, resetting the data when the tests are completed.</p>



<h3 class="wp-block-heading" id="Use-of-headless-mode">Use of headless mode</h3>



<p>Headless mode means that the browser is launched without a graphical interface. Its operation and functions remain unchanged compared to the classic browser, but the&nbsp;<strong>resources are not additionally burdened with</strong>&nbsp;the rendering of the web application and the launch of the browser interface itself. Running tests using this mode will allow you to reduce the time of tests compared to running tests using a typical browser. This is especially useful when we run multiple tests at the same time – browsers with an active GUI use many more resources than those running in headless mode. An additional advantage is the option of using them to conduct tests on the server or container side, and hence a simple way to include them in the&nbsp;<strong>CI/CD process</strong>.</p>



<h3 class="wp-block-heading" id="Suitable-equipment-for-testing">Suitable equipment for testing</h3>



<p>Performing tests, in particular E2E, in browsers requires quite a lot of computing power. Tests perform many operations (launching a browser instance, rendering an application, executing a test code, etc.). Carrying them out with poorly performing equipment, especially if it is done in parallel, can not only negatively affect the time of their execution, but also lead to instability. The simplest solution is to bring&nbsp;<strong>the computer / server on which</strong>&nbsp;we perform tests up to date. This will increase the speed of the tests (and the number of parallel tests).</p>



<p>If there are reasons why updating the hardware is impossible, using cloud services might be a good idea.</p>



<h2 class="wp-block-heading" id="Summary">Summary</h2>



<p>The right test automation tool will certainly help streamline the entire process, but it is the automation tester, as the person responsible for the tests, who should follow good practices and promote their use in the project. With the above tips,&nbsp;<strong>you can speed up the execution of automatic tests, so that information on the reliability of the tested application will be available faster</strong>. This is important from a business perspective – the competition does not rest on their laurels, customers and end users expect the developed application to run smoothly and reliably, and any fixes will be made as soon as possible. Thanks to the swift testing process, we will be able to meet these expectations.</p>



<p>It is not obligatory to use all the listed methods at the same time, but using each of them will&nbsp;<strong>reduce the time of testing</strong>&nbsp;by several dozen minutes or even hours when we run lots of tests.</p>



<p>It is important to periodically check the set of tests and discuss optimization options in all respects – each member of the team responsible for software development should suggest corrections which will give us diversified feedback (from a technical and business point of view), making it possible to conduct in-depth discussions and draw appropriate conclusions, using them to optimize the tests.</p>



<p class="has-text-align-center"><strong>Read also: <a href="https://nearshore-it.eu/articles/functional-tests-what-do-you-need-to-know/">Functional Testing in Software Development: A Comprehensive Guide to software testing types and Examples</a></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/test-automation-tools/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Test automation frameworks. Introduction to Atata</title>
		<link>https://nearshore-it.eu/articles/atata-test-automation-framework/</link>
					<comments>https://nearshore-it.eu/articles/atata-test-automation-framework/#respond</comments>
		
		<dc:creator><![CDATA[Łucja Nowińska]]></dc:creator>
		<pubDate>Fri, 12 May 2023 05:17:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25754</guid>

					<description><![CDATA[When deciding on automation, it is worth carefully considering what tools to use, including test frameworks. In this article you will find an overview of the most important types of test automation frameworks. I will also take a closer look at the not yet widely known tool Atata, based on Selenium WebDriver, and compare its capabilities with those offered by pure Selenium.]]></description>
										<content:encoded><![CDATA[
<p>Automation is an increasingly valued approach to software testing. It not only brings about time and cost savings in projects, but in the long run it allows us to deliver better quality products to a customer. When deciding on automation, it is worth carefully considering what tools to use, including test frameworks. In this article you will find an overview of the most important types of test automation frameworks. I will also take a closer look at the not yet widely known tool Atata, based on Selenium WebDriver, and compare its capabilities with those offered by pure Selenium.</p>



<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#When-should-we-automate-software-tests-and-why?">1.  Automation Testing</a></li>
                    <li><a href="#Types-of-test-automation-frameworks">2.  Types of test automation frameworks</a></li>
                    <li><a href="#Atata-automation-framework">3.  Atata automation framework</a></li>
                    <li><a href="#Atata-vs-Selenium">4.  Atata vs Selenium</a></li>
                    <li><a href="#Which-test-automation-framework-is-best-for-my-project?">5.  Which test automation framework is best for my project?</a></li>
                    <li><a href="#Summary">6.  Summary</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="When-should-we-automate-software-tests-and-why?">When should we automate software tests and why?</h2>



<h3 class="wp-block-heading" id="What-is-Automation?">What is Automation?</h3>



<p>Before we focus on the topic of the Atata test automation framework, I would like to briefly remind you what software test automation is in general and why it is worth taking an interest in it. There are a number of myths around this topic.</p>



<p>Testing is a very important part of the software development process. One of the approaches to this aspect is automation, i.e., the use of special tools and frameworks that enable the programming of tests and automatic execution without further human intervention.</p>



<h3 class="wp-block-heading">Benefits of Automation</h3>



<p>Automation of&nbsp;<strong>these processes can bring countless benefits</strong>, including some of the major ones –<strong>&nbsp;time and cost savings</strong>. In addition, automatic tests are more repeatable and more accurate than manual tests, which translates to reliability and effectiveness.</p>


</style><div class="promotion-box promotion-box--image-left "><div class="tiles latest-news-once"><div class="tile"><div class="tile-image"><img decoding="async" src="https://nearshore-it.eu/wp-content/uploads/2024/06/BigCTA_MarekCzachorowski.jpg" alt="BigCTA MarekCzachorowski" title="Test automation frameworks. Introduction to Atata 14"></div><div class="tile-content"><p class="entry-title client-name promotion-box__headline2">Elevate Your Application Development</p>
<p class="promotion-box__description2">Our tailored Application Development services meet your unique business needs. Consult with <strong>Marek Czachorowski</strong>, Head of Data and AI Solutions, for expert guidance.</p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Schedule a meeting</a></div></div></div></div>



<h3 class="wp-block-heading">Scenarios and test cases and automation</h3>



<p>It is worth considering test automation in your project due to the option of conducting tests with complex scenarios and in many environments at the same time, which could be a challenge when manually implementing a test scenario on a daily basis. It is possible to perform tests on different platforms, in different hardware and network configurations, which would be difficult or even impossible to achieve in the case of manual tests.</p>



<p>Creating test cases in an automated form ensures their repeatability, and thus increases their effectiveness when it comes to detecting defects. This is why automation is particularly useful in testing the critical functionalities of the app. However, it is worth remembering that the test reality is not black and white , and like everything, it has its pros and cons. What are the downsides of automation?</p>



<h3 class="wp-block-heading">The Dark Side of Automation</h3>



<p>Test automation can be a fantastic solution in many projects, but it is not a universal solution. In some cases, manual testing can be a much better, more effective option, or even the only one available. Therefore, before deciding to automate tests, it is worth carefully analyzing the specifics of the project, the needs, and any available tools and frameworks.</p>



<p>You also need to bear in mind the time that must be invested in the creation of automated test cases. This requires many hours of work, configuration, and troubleshooting that you do not have to deal with during manual software testing. This is a process that&nbsp;<strong>can develop very slowly at first</strong>, and<strong>&nbsp;credible results are often visible only after putting a lot of work into the project</strong>. There is also a need to hire an automation tester who will be able to design the entire system so that the tests are stable and in line with good programming practices.</p>



<h2 class="wp-block-heading" id="Types-of-test-automation-frameworks">Types of test automation frameworks</h2>



<p>Automation frameworks are tools that make this task easier by providing solutions to many common problems. Depending on the needs and specifics of the project, we can choose from different types of frameworks. Below is a brief description of some of them.</p>



<h3 class="wp-block-heading">Library Architecture Framework</h3>



<p><strong>The Library Architecture Framework (LAF)</strong>&nbsp;is a popular software test automation technique. As part of this methodology, libraries with ready-made test functions that can be called in the test code are used. LAF is often used in cases where tests are complicated and require multiple stages, as well as in situations where tests must work on different operating systems and web browsers.<br>This type of framework is particularly useful for&nbsp;<strong>low-level tests</strong>, such as unit tests.</p>



<h3 class="wp-block-heading">Module Based Testing Framework (MBTF)</h3>



<p>This is a type of software test automation framework that is based on a modular approach to test design. In this model, tests are designed in a modular way, and each module covers one functionality or test cases related to one application module. In&nbsp;<strong>MBTF</strong>, test modules are designed in such a way as to be universal and can be used repeatedly for various applications and systems. Once you’ve created a set of modules, you can use them in different projects without having to rewrite the code.</p>



<h3 class="wp-block-heading">Linear Automation Framework</h3>



<p><strong>Linear Automation Framework</strong>&nbsp;is a type of test automation framework that is based on a linear approach. At LAF, tests are designed to reflect business processes or application usage scenarios. This means that they are performed in a sequential manner. In this model,&nbsp;<strong>tests are designed as sets of steps, and each step of the test is associated with a user action or result that is expected in the application.&nbsp;</strong>The advantage of the Linear Automation Framework is that the tests are closer to the actual use cases, which can help us to find more realistic defects in the application, such as those that the user would come across.</p>



<h3 class="wp-block-heading">Hybrid Test Automation Framework</h3>



<p>This is a kind of framework that&nbsp;<strong>combines the features of all the above-mentioned approaches</strong>. This enables the design and execution of tests in a flexible way, tailored to the needs of the project. In&nbsp;<strong>HTAF</strong>, tests are created in a modular way, similar to the&nbsp;<strong>Module Based Testing Framework</strong>, but with more flexibility and access to a wide range of test tools. This framework allows the integration of various tools and technologies, such as<strong>&nbsp;Selenium WebDriver, TestNG, Appium, JMeter</strong>, etc., which allows us to automate tests in various environments, such as web, mobile, desktop applications and many others.</p>



<p class="has-text-align-center"><strong>Read also:&nbsp;<a href="https://nearshore-it.eu/articles/best-practices/end-to-end-testing-with-cypress/" data-type="post" data-id="25849" target="_blank" rel="noreferrer noopener">End to end testing with Cypress</a></strong></p>



<h2 class="wp-block-heading" id="Atata-automation-framework">Atata automation framework</h2>



<p>Atata is a full-featured test automation framework that is based on Selenium WebDriver and designed for web applications. It was&nbsp;<strong>written in C#</strong>&nbsp;and offers a wide range of functionalities that make it easier to automate web application tests.</p>



<h3 class="wp-block-heading">Atata – Advantages</h3>



<ul class="wp-block-list">
<li><strong>Availability&nbsp;</strong>– The Atata framework is fully open source and available on the GitHub platform under the Apache License 2.0.</li>



<li><strong>Transparency and ease of use</strong>&nbsp;– one of the key elements of the Atata framework is the use of the Fluent Page Object Pattern. This pattern allows you to write code that is easy to read and understand. The built-in login system makes it easy to track and troubleshoot problems during testing.</li>



<li><strong>Triggers&nbsp;</strong>– what is more, the framework has a unique trigger functionality that allows you to run custom code when specific events occur.</li>



<li><strong>Low Entrance Threshold</strong>&nbsp;– Atata is designed to be easy to use and maintain. The framework provides a simple and intuitive syntax for defining and using the objects on the page. This requires a minimum amount of code, which positively affects readability and facilitates the introduction of further testers to the project.</li>



<li><strong>Ready-made components</strong>&nbsp;– the framework also provides a set of ready-to-use components to facilitate work. These components include controls, pages, and layouts. Atata provides a wide range of built-in controls that can be used to interact with web elements on the site. Controls include buttons, text boxes, check boxes, radio buttons, and many, many more.</li>



<li><strong>Data-driven testing</strong>&nbsp;– Atata also supports data-driven testing, allowing testers to create tests using the Data-Driven Testing function. With this feature, developers can run the same test scenario with different datasets.</li>



<li><strong>Parallel testing</strong>&nbsp;– the framework also supports parallel testing. With parallel testing, testers can run multiple tests at the same time, which can significantly reduce the time taken for testing. This is especially useful for large web applications that require extensive quality control.</li>
</ul>



<h2 class="wp-block-heading">Atata – disadvantages</h2>



<p>Despite its many advantages, the Atata framework also has some drawbacks.</p>



<ul class="wp-block-list">
<li><strong>Limited use</strong>&nbsp;– one of the main drawbacks is that the framework usage is limited to websites only. This is an important limitation, for example, for companies developing software that also design other types of applications in addition to websites. In this case, you may need to use another test automation tool.</li>



<li><strong>Available only for C#&nbsp;</strong>– this framework is only created for the C# language, which makes it unavailable to many programmers who specialize in other popular programming languages.</li>



<li><strong>Small community&nbsp;</strong>– another disadvantage, compared to other test automation tools, may be the small community surrounding it.&nbsp;<strong>This framework is not as well-known as other test tools which have been available on the market for years</strong>. We need to take into account the fact that there are fewer online resources and documentation, as well as support materials available to users. Fortunately, the user community is highly engaged and ready to help. It is also worth noting that contact with the creators of the framework is extremely simple, and communication is highly efficient.</li>
</ul>



<p>However, despite these disadvantages, the Atata framework&nbsp;<strong>is still one of the best tools for automating C# web tests</strong>. Its numerous advantages make it popular among testers who are looking for a simple and intuitive way to automate.</p>



<h2 class="wp-block-heading" id="Atata-vs-Selenium">Atata vs Selenium</h2>



<p>Let me start by saying that the question “<strong>Atata or Selenium</strong>?” is not quite appropriate in the context of the issue we are discussing. In particular, comparing Selenium to an overlay, which in fact Atata is, may seem baseless. After all, Atata is nothing more than a framework covering the database with its functionalities, which provides us with the necessary basic tools.</p>



<p>Thanks to this we get a “<strong>nicer</strong>” version of Selenium, which is more user-friendly and faster to implement. Nevertheless, I decided to lay out the important differences in the table below. It is worth being aware of the benefits of using such an overlay for the project. After all, when planning work, choosing a framework is not easy; the more options there are, the harder it is to make a decision even within frameworks that rely on other tools which are already available.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="340" src="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_1.png" alt="Atata vs Selenium comparison" class="wp-image-28077" title="Test automation frameworks. Introduction to Atata 15" srcset="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_1.png 756w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_1-300x135.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_1-495x223.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Atata</h3>



<p>One of the biggest advantages of the Atata framework is its useful login system which allows you to track and diagnose problems during testing. Atata also offers unique features such as a trigger mechanism that allows you to execute custom code in response to specific events during testing.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="300" height="482" src="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_2.png" alt="Atata solution explorer" class="wp-image-28079" title="Test automation frameworks. Introduction to Atata 16" srcset="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_2.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_2-187x300.png 187w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_2-246x395.png 246w" sizes="auto, (max-width: 300px) 100vw, 300px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Atata also offers an intuitive syntax for defining and using page objects, making it easy to program and maintain tests. It supports the use of the&nbsp;<strong>Page Object Pattern model</strong>, which is a huge advantage for fans of this pattern. This makes the structure clear and easier to understand.</p>



<p>The framework has a built-in set of<strong>&nbsp;ready-made components</strong>&nbsp;such as&nbsp;<strong>controls</strong>,&nbsp;<strong>pages&nbsp;</strong>and&nbsp;<strong>layouts</strong>, which speeds up the test automation process. Below I have provided an example of what Atata offers – it not only contains basic elements of pages such as text fields, but also differentiates fields for&nbsp;<strong>e-mail addresses</strong>,&nbsp;<strong>passwords</strong>,&nbsp;<strong>numbers&nbsp;</strong>or&nbsp;<strong>files</strong>. Furthermore, it supports choice lists, clickable items, and many, many more. A full list of specifications and capabilities can always be found in the very clear documentation at&nbsp;<a href="https://atata.io/components/" target="_blank" rel="noreferrer noopener">https://atata.io/components/.</a></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="496" src="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_5.png" alt="nearshore 2023.05.12 graphic 5" class="wp-image-28090" style="object-fit:cover" title="Test automation frameworks. Introduction to Atata 17" srcset="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_5.png 756w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_5-300x197.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_5-495x325.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /><figcaption class="wp-element-caption">Example of capabilities from documentation</figcaption></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using _ = TextBoxPage; //alias for better readability
    [Url(TextBoxUrl)]      //Url extension to base url placed in SpecFlowHooks.cs
    [VerifyTitle("ToolsQA")]
    public class TextBoxPage : BasePage&lt;_> 
    {
        private const string TextBoxUrl = "/text-box";


        [FindById("userName")] //Selector to find element
        public TextInput&lt;_> UserNameTextBoxInput { get; set; } //An element with its type and name


        [FindById("userEmail")]
        public EmailInput&lt;_> UserEmailTextBoxInput { get; set; }


        [FindById("currentAddress")]
        public TextArea&lt;_> CurrentAddressTextBoxTextArea { get; set; }


        [FindById("permanentAddress")]
        public TextArea&lt;_> PermanentAddressTextBoxTextArea { get; set; }


        [FindById("submit")]
        public Button&lt;_> SubmitTextBoxButton { get; set; }
       
        [FindById("output")]
        public Text&lt;_> TextBoxOutputBox { get; set; }


        [FindById("name")]
        public Text&lt;_> TextBoxOutputName { get; set; }


        [FindById("email")]
        public Text&lt;_> TextBoxOutputEmail { get; set; }


        [FindById("currentAddress")]
        public Text&lt;_> TextBoxOutputCurrentAddress { get; set; }


        [FindByXPath("output")]
        public Text&lt;_> OutputBox { get; set; }


        [FindById("permanentAddress")]
        public Text&lt;_> TextBoxOutputPermanentAddress { get; set; }
    }
</pre>



<p>Use of ready-made components</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">public class ProjectDetailsPage : BasePage&lt;ProjectDetailsPage>
    {
        public int findGarageParkingPlaces()
        {
            var element = AtataContext.Current.Driver.FindElement(By.XPath("//div[contains(text(),'Garage Parking Places')]"));
            return int.Parse(element.FindElement(By.ClassName("value")).Text);
        }
    }</pre>



<p>Calling AtataContext.Current.Driver</p>



<p>Despite its enormous capabilities, however, it sometimes turns out that we lack a component or it is impossible to use a ready-made solution offered by Atata. Luckily, the developers haven’t removed the option to access a pure version of Selenium, and we can search for our elements or apply specific actions to them with no issues. Below is an example of a <strong>WebDriver call</strong>.</p>



<p>Fans of reports and tables will also find a useful function here.&nbsp;<strong>Atata offers a built-in tool to take screenshots according to the selected pattern</strong>, e.g., after performing each step. If we connect this function with a library for creating reports, such as&nbsp;<strong>ExtendedReports</strong>, we will get a very pleasant environment for generating reports in the form of a .html file. Once the tests are run, we have an immediate view of the results along with statistics, marked errors, tags and graphs. At first glance, we can say that&nbsp;<strong>IDE&nbsp;</strong>itself can also offer such data but the form of compiling them in this library is much more readable and easy on the eye. After small changes to adapt to the needs of the project, we get a report that can be presented almost effortlessly during a business meeting.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1296" height="594" src="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-1296x594.png" alt="Atata Report 1" class="wp-image-28084" title="Test automation frameworks. Introduction to Atata 18" srcset="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-1296x594.png 1296w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-300x138.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-768x352.png 768w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-1536x704.png 1536w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3-495x227.png 495w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_3.png 1584w" sizes="auto, (max-width: 1296px) 100vw, 1296px" /></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1296" height="596" src="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-1296x596.png" alt="Atata Report 2" class="wp-image-28086" title="Test automation frameworks. Introduction to Atata 19" srcset="https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-1296x596.png 1296w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-300x138.png 300w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-768x353.png 768w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-1536x707.png 1536w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4-495x228.png 495w, https://nearshore-it.eu/wp-content/uploads/2024/07/nearshore_2023.05.12_graphic_4.png 1584w" sizes="auto, (max-width: 1296px) 100vw, 1296px" /><figcaption class="wp-element-caption">Example of a report</figcaption></figure></div>


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">[Screenshot(AfterAnyAction)]
    public abstract class BasePage&lt;TOwner> : Page&lt;TOwner>
        where TOwner : BasePage&lt;TOwner>
    {
        //Some general helping methods that can be used in all pages
        public int[] GetElementSize(Text&lt;TOwner> element)
        {
            return new int[2] { element.ComponentSize.Width.Value, element.ComponentSize.Height.Value };
        }
        
        public void AcceptAlert()
        {
            AtataContext.Current.Driver.SwitchTo().Alert().Accept();
        }


        public string GetAlertMessage()
        {
            return AtataContext.Current.Driver.SwitchTo().Alert().Text;
        }
    }</pre>



<p>An example of adding screenshots to a report (1 line), I&#8217;ve thrown in the context of the whole class for clarity but I&#8217;ll leave it to you to edit as it suits you.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">[Binding]
    public sealed class TextBoxSteps : BaseSteps
    {
        private readonly ScenarioContext _scenarioContext;


        [Obsolete("Visual Studio IntelliSense Work Around", true)]
        public TextBoxSteps(ScenarioContext scenarioContext)
        {
           _scenarioContext = scenarioContext;   //Initializing scenario context, you can save test session data in it
           SetRandomUser(_scenarioContext);      //Creating new fake user data and saving it in context so it can be used in multiple tests without generating new set 
        }


        [When(@"User input all personal data on address form page")] //SpecFlow binding to feature files, methods are named the same as scenario steps 
        public void WhenUserInputAllPersonalDataOnAddressFormPage()
        {
            Go.To&lt;TextBoxPage>()                 //Open page   
                .UserNameTextBoxInput.Set(User.FirstName + " " + User.LastName) //Make actions on web elements from page you just opened eg. set -> input text 
                .UserEmailTextBoxInput.Set(User.Email) //User.Email is a reference to our generated fake data
                .CurrentAddressTextBoxTextArea.Click()
                .CurrentAddressTextBoxTextArea.Set(User.Country)
                .PermanentAddressTextBoxTextArea.Set(User.Country);
        }


        [When(@"confirm the data by clicking button")]
        public void WhenConfirmTheDataByClickingButton()
        {
            On&lt;TextBoxPage>()                     //On already opened page
                .SubmitTextBoxButton.Click();
        }


        [Then(@"user should see provided data below")]
        public void ThenUserShouldSeeProvidedDataBelow()
        {
            On&lt;TextBoxPage>()
                .TextBoxOutputBox.Should.BeVisible()  //Should is assertion verification if something is as you wanted
                .TextBoxOutputName.Content.Should.Contain($"Name:{User.FirstName} {User.LastName}")
                .TextBoxOutputEmail.Content.Should.Contain($"Email:{User.Email}")
                .TextBoxOutputCurrentAddress.IsVisible.Should.BeTrue()
                .TextBoxOutputCurrentAddress.GetContent(ContentSource.Value).Should.Contain(User.Country)
                .TextBoxOutputPermanentAddress.GetContent(ContentSource.Value).Should.Contain(User.Country);
        }
    }</pre>



<p>Example of page navigation (Go.To and On), I paste again the full context of the class</p>



<p>The issue of navigating between application pages during one session was also intuitively solved. In the example below, you can see that using the <strong>Go function</strong>, It (<strong>go to</strong>) or He (<strong>stay on the page</strong>) is sufficient. Just upload the appropriate page address according to the method – there is no need to open and close the session properly (as with Selenium) without an overlay. This contributes to significant time savings when configuring your environment.</p>



<p>Unfortunately,&nbsp;<strong>this framework was created only for the C#</strong>&nbsp;programming language, which is a significant limitation when compared to Selenium, which also works with Java and Python.</p>



<h2 class="wp-block-heading" id="Which-test-automation-framework-is-best-for-my-project?">Which test automation framework is best for my project?</h2>



<p>The choice of test automation framework depends on many factors, such as project type,&nbsp;<strong>business requirements</strong>,&nbsp;<strong>developer preferences</strong>, and&nbsp;<strong>resources available</strong>. Here are some steps that can help you choose the best framework for your project:</p>



<p>1. <strong>Define your requirements</strong></p>



<p>Before deciding to use a given framework to automate tests, you need to know what your requirements are. For example, if your project involves the development of a web application, then a framework that supports user interface testing might be the best choice. There is also no point in choosing a technology that supports other types of applications as well at the expense of the one that interests us.</p>



<p>2.&nbsp;<strong>Find the right tools</strong></p>



<p>Consult developers and testers who have experience in test automation and ask them for recommendations on tools. Collect information about different frameworks, their&nbsp;<strong>functionalities, limitations and social resources.&nbsp;</strong></p>



<p>3.&nbsp;<strong>Test the frameworks</strong></p>



<p>Test selected frameworks in practice. Prepare a set of tests representative of your project and implement them in each of the frameworks. Analyze which frameworks are the most intuitive and easy to use.&nbsp;&nbsp;</p>



<p>4.&nbsp;<strong>Check the integration</strong></p>



<p>If the developed application uses external tools, make sure that the framework you choose integrates with them. For example, if you use a Continuous Integration platform, make sure the framework you choose has a plugin for it.&nbsp;&nbsp;</p>



<p>5.&nbsp;<strong>Pay attention to the availability of documentation and community support</strong></p>



<p>Choose a framework that has good documentation and a wide community of users. This will help to solve the technical problems you may encounter when working with the framework.&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="Summary">Summary</h2>



<p>To sum up, the choice of a test automation framework depends on many factors and there is no clear answer to the question of which one will work best in your project. Currently<strong>, there are many types of frameworks available on the market</strong>, so you need to&nbsp;<strong>explore different options and choose the one that best suits your requirements and project specifics</strong>. I hope that with this article I have also managed to detail the capabilities of the not as yet well-known tool Atata.</p>



<p>Although Selenium is one of the more popular and widely appreciated tools, it is always worth knowing about other options. Atata is constantly being developed by the developer community, which means that anyone can contribute to advancements by reporting bugs, making improvements or writing documentation. This way, Atata becomes a better tool.</p>


</style><div class="promotion-box promotion-box--image-left promotion-box--full-width-without-image"><div class="tiles latest-news-once"><div class="tile"><div class="tile-content"><p class="promotion-box__description2"><strong>Consult your project directly with a specialist</strong></p>
<a class="btn btn-primary booking" href="https://outlook.office365.com/book/BookameetingwithMarek@gfi.fr/" target="_blank" rel="noopener">Book a meeting</a></div></div></div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/atata-test-automation-framework/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Test automation – common myths</title>
		<link>https://nearshore-it.eu/articles/test-automation-common-myths/</link>
					<comments>https://nearshore-it.eu/articles/test-automation-common-myths/#respond</comments>
		
		<dc:creator><![CDATA[Daria Bajda-Czyzynska]]></dc:creator>
		<pubDate>Fri, 24 Feb 2023 06:20:00 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[QA]]></category>
		<guid isPermaLink="false">https://nearshore-it.eu/?p=25711</guid>

					<description><![CDATA[There are several myths regarding the implementation, maintenance, costs and types of tests that can be automated. Discussions on test automation have kept coming up during multiple IT conferences and meetups. The number of tools, and thereby the possibilities of using them, is increasing; however vague knowledge of test automation does not help to popularize such tests and therefore to deliver products of the highest quality. In the article, I shall examine automated testing and the common misunderstandings around automated tests to clear up doubts in this area.]]></description>
										<content:encoded><![CDATA[
<div class="table-of-contents">
    <p class="title"></p>
    <ol>
                    <li><a href="#What-is-test-automation?-How-does-it-work?">1.  What is test automation? How does it work?</a></li>
                    <li><a href="#Types-of-automated-tests">2.  Types of automated tests</a></li>
                    <li><a href="#Automation-testing-and-myths">3.  Automation testing and myths</a></li>
                    <li><a href="#Benefits-of-automation-testing">4.  Benefits of automation testing</a></li>
                    <li><a href="#Test-automation-tools">5.  Test automation tools</a></li>
                    <li><a href="#Summary">6.  Summary</a></li>
            </ol>
</div>


<h2 class="wp-block-heading" id="What-is-test-automation?-How-does-it-work?">What is test automation? How does it work?</h2>



<p>Before I discuss the test automation process further, a quick reminder: automated testing is software testing by executing a set of test cases using dedicated tools. Now, let’s see how such tests are created.</p>



<p>Firstly, we specify areas requiring automated testing, focusing on relevant issues from a business perspective. We set up the goal and terms depending on the tested system, bearing in mind one of the principles of testing: “<strong>Testing is context-dependent</strong>”.</p>



<p>Once the goal is set up, we proceed to the technical aspects. We choose a testing tool, and create the testing environment and testing scripts. Having run tests, we analyze the results and verify whether we have managed to obtain business value as assumed earlier on.</p>



<p><br>Deterministic automated tests work in a quite simple way. First of all, we put the application in the initial state to test a desired action, for example how the application acts while being used by, say, 1000 users. The aim of the verification is to compare the assumed results with the actual state.</p>



<p class="has-text-align-center"><strong>Read also: <a href="https://nearshore-it.eu/articles/software-testing-do-we-need-more-tests/" data-type="post" data-id="25747" target="_blank" rel="noreferrer noopener">Software testing: do we really need more tests?</a></strong></p>



<h2 class="wp-block-heading" id="Types-of-automated-tests">Types of automated tests</h2>



<p>There are several different types of automated tests. To get the most out of it, you need to know the key differences between the two. Tests are divided into functional and non-functional.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="756" height="476" src="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-2.png" alt="nearshore 2023.11.xx graphic 1 2" class="wp-image-25876" title="Test automation – common myths 20" srcset="https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-2.png 756w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-2-300x189.png 300w, https://nearshore-it.eu/wp-content/uploads/2023/10/nearshore_2023.11.xx_graphic_1-2-495x312.png 495w" sizes="auto, (max-width: 756px) 100vw, 756px" /></figure></div>


<h3 class="wp-block-heading"><br><strong>Functional testing</strong></h3>



<p>Is a quality assurance process and a type of black box testing that bases its test cases on the specifications of the software component under test.</p>



<ul class="wp-block-list"><li><strong>Unit testing</strong>: Unit tests are the first level of testing and form the basis for other more extensive types of testing. These are usually done manually by the developers.</li><li><strong>Integration testing</strong>: This type allows for layered testing. This type allows for layered testing. Generally, it’s about integrating 1 component with 2. For example, API with a database. This is often at the code level. 1st class with 2nd class (if developers do it).</li><li><strong>System testing</strong>: It’s a type of functional test that only covers the most crucial features of the software to ensure that it could be further tested.</li><li><strong>Regression testing</strong>: A type of change-related testing to detect whether defects have been introduced or uncovered in unchanged areas of the software.</li><li><strong>User Acceptance Testing</strong>: Software test, the purpose of which is not to detect errors, but only to obtain a formal confirmation of the implementation of the software of appropriate quality.</li></ul>



<h3 class="wp-block-heading"><strong>Non-functional testing</strong></h3>



<p>Is testing an application or system against non-functional requirements: how the system works, not the specific behaviors of that system.</p>



<ul class="wp-block-list"><li><strong>Documentation testing</strong>: includes the plans, results, and testing of a system or system component. It includes test case specifications, test plans, test procedures, test reports, and test logs.</li><li><strong>Installation testing</strong>: Also known as Implementation testing and it is done to check whether the software is properly installed in the new system with its prerequisites and necessary data and is working as expected or not.</li><li><strong>Performance testing</strong>: The practice of evaluating how a system performs in terms of responsiveness and stability under a particular workload. Performance tests are typically executed to examine speed, robustness, reliability, and application size.</li><li><strong>Reliability testing</strong>: An important software testing technique that is performed by the team to ensure that the software is performing and functioning consistently in each environmental condition as well as in a specified period.</li><li><strong>Security testing</strong>: Type of Software Testing that uncovers vulnerabilities, threats, risks in a software application and prevents malicious attacks from intruders.</li></ul>



<h2 class="wp-block-heading" id="Automation-testing-and-myths">Automation testing and myths</h2>



<h3 class="wp-block-heading">1. Each test can be automated</h3>



<p>According to one of the widespread myths, each test can be automated. Let’s think it over: is it really possible? As per the International <strong>Software Testing Qualifications Board</strong> –&nbsp;the software testing certification organization – the testing process is infinite, which is why we cannot forecast and test everything.</p>



<p>Test automation is still incomparable to efficiency tests, volume testing, and stress testing.&nbsp;Automated testing has its limitations, though. For example, it cannot be used for non-functional tests.&nbsp;These are related to our personal perception of esthetics, legibility and transparency.</p>



<p>In the abovementioned area we are unable to define the initial requirements and the expected final results. Some of the aspects, for example the appearance and transparency of the application, are perceptible only to the human eye. The same thing applies to accessibility testing, which aims to determine whether users with disabilities can use the system with ease.</p>



<p>All in all, knowing that some of the tests cannot be automated, we understand that it is impossible to entirely replace manual testing with automated testing – as per the second common myth. There will always be areas requiring manual testing.</p>



<h3 class="wp-block-heading">2. Automated tests can replace manual testing</h3>



<p>This misunderstanding brings to mind a common myth from the past, that one day television would entirely replace radio. Nowadays, as we can see, radio, television and the Internet coexist and complement each other. It works similarly when it comes to automated and manual tests.<br>The first ones are advantageous due to their repeatability.&nbsp;With appropriately implemented tests we can be sure that every test will be run in the same, replicable manner.</p>



<p>&nbsp;Additionally, contrary to human nature, automatons do not need coffee, the weekend or sleep, so they can work perpetually. On the other hand, humans are better when it comes to intelligence, intuition and imagination, which are essential to running an effective test of the application.</p>



<p>The majority of tests related to functional and non-functional requirements can be performed manually. There will always be a need for manual tests, calling for the engagement and knowledge of a tester – namely usability tests, accessibility tests and security tests.</p>



<p>Test automation supports manual testing, but cannot replace exploratory testing or the technique of error guessing, wherein the tester’s knowledge in the context of the product and tools is essential.</p>



<h3 class="wp-block-heading">3. Automated tests help to catch a lot of defects</h3>



<p>Contrary to popular opinion, automated tests will not help to detect a lot of defects. One can ask: “How can that be? Isn’t that what we run them for?” Of course, it is one of the goals we are trying to attain; however<strong>,&nbsp;automated tests are quality-oriented, not quantity-oriented</strong>.&nbsp;To give an example, automated tests are useful in catching functionalities’ change-related defects in the event that software code has been amended. These are called regression tests and are used to ensure that changes implemented to either software, configuration or the environment will not impact the developed product itself.</p>



<p>Automated regression tests can successfully replace manual testing carried out by entire development teams, which – depending on the software’s complexity – would normally take hours, days or even weeks.&nbsp;Our trust increases with every single automated test.&nbsp;Even though they do not catch a lot of defects, they allow us to save time and money, enabling us to focus on the quality of the product instead.</p>



<h3 class="wp-block-heading">4. Each automatable case should be automated</h3>



<p>Knowing that not all tests can be automated and that there are areas in which we will still need manual testing – is it worth automating every automatable testing case?</p>



<p>There are situations in which swift software testing is required and engaging additional resources, tools or funds (which is often related to test automation) is not an option. Let’s paraphrase a quote by Roger Needham, Microsoft’s Research Laboratory Director, to clear up doubts: automation is a process of replacing something that works with something that almost works, but is quicker and cheaper.<br>This reminds us of the two principal ways of defining whether we should automate tests or not:</p>



<ul class="wp-block-list"><li>automated tests should be faster than manual verification</li><li>the cost of programming tests cannot exceed the income gained thanks to test automation</li></ul>



<p><strong><br>From a business perspective, the cost of tools and time needed for the implementation of automated tests in comparison with manual testing should be the decisive factor.</strong>&nbsp;This should facilitate the decision-making process in terms of automating testing cases.</p>



<p class="has-text-align-center"><strong>Read more:<a href="https://nearshore-it.eu/articles/technologies/test-pyramid-and-types-of-testing/" data-type="post" data-id="25613" target="_blank" rel="noreferrer noopener">&nbsp;The test pyramid – what, when and how to test software to get profits</a></strong></p>



<h2 class="wp-block-heading" id="Benefits-of-automation-testing">Benefits of automation testing</h2>



<p>Automated tests have many benefits. Application testing is a process. Every time the code is modified, it needs to be changed and retested in different modifications or systems. In such a situation, manual testing would be extremely time-consuming and thereby costly. With test automation, you can run tests multiple times at no extra cost.&nbsp;</p>



<p>Test automation also allows for continuous testing and a quick check of the app. This allows you to avoid bottlenecks at the end of the software development process. Test also automation helps make your life easier. Reporting in manual tests is uncomfortable and thanks to test automation, reporting is smooth.</p>



<h2 class="wp-block-heading" id="Test-automation-tools">Test automation tools</h2>



<p>So how to run the tests in the most effective way?&nbsp;Here is a list of a few best practices for test automation, as well as the tools and automation frameworks that will help you achieve success.</p>



<p>To start with, determine which test cases should be automated first. Then select an automation tool for testing. If you have already defined your needs, you can proceed and choose the appropriate test solution, for example:</p>



<ul class="wp-block-list"><li>Selenium</li><li><a href="https://nearshore-it.eu/articles/best-practices/end-to-end-testing-with-cypress/" data-type="post" data-id="25849">Cypress</a></li><li>Cucumber</li><li>LambdaTest</li></ul>



<h2 class="wp-block-heading" id="Summary">Summary</h2>



<p>Despite many myths related to test automation, automated tests are gaining greater understanding and popularity. Myths related to automated tests keep coming up, which proves that a lot still needs to be done to clarify doubts. I hope that I have managed to clear up some of them and that the article will help to define further discussion on automated tests. This is priceless help for testers in the process of delivering a high-quality product.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nearshore-it.eu/articles/test-automation-common-myths/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
