Select Page

Category Selected: Automation Testing

152 results Found


People also read

OTT Testing

Hidden Hurdles: Challenges in OTT Platform Testing

Automation Testing

Playwright Cheatsheet: Quick Tips for Testers

Automation Testing

A Quick Playwright Overview for QA Managers

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility
What is Codeless Automation Testing and its Advantages?

What is Codeless Automation Testing and its Advantages?

As the name suggests, codeless automation testing is the process of performing automation tests without having to write any code. Codeless Automation Testing can be instrumental in implementing continuous testing as the majority of automation scripts fail due to the lack of proper coding. It will also enable you to focus more on test creation and analysis instead of worrying about getting the code to work, maintaining it, and scaling it when needed as well. So if you are fairly new to codeless automation testing, then you will find this blog useful as we will be pointing out the advantages of codeless automation testing by comparing it with Selenium Testing. So let’s get started.

How is Codeless Automation Testing Different from Selenium Testing?

Selenium is a tool that greatly simplified the automation testing process. It even allows software testers to record their testing and play it back using Selenium IDE to create basic automation. But there was no easy option to edit the created test cases without being strong in coding. So if you weren’t strong in coding, the only other option would be to rerecord the entire test. But now with the introduction of codeless automation testing, you can go beyond the record and playback technique. So the scope of usage is broadened as it even makes it possible to edit the test cases with basic HTML, CSS, and XPath knowledge. Owing to the minimal use of coding, tests can be easily understood by people without much programming knowledge as well. To top it all off, the setup process is so simple that you can set it up in no time.

Getting Started with Codeless Automation Testing

So it is evident that codeless solutions are a lot more powerful in comparison. But one has to keep in mind the fact that it will work effectively only if they are used appropriately. It is always a good idea to get started with simple tests that can be validated easily. For example, if you are testing an e-commerce product, start by seeing if you are able to add a product to the cart. Once you familiarise yourself, you can go a notch higher and try testing the purchase and return/exchange process. It wouldn’t be wise to use codeless solutions in products that use third-party integrations or has a dynamic and unpredictable output as it becomes very difficult to validate them.

Local and Cloud Options

You can either opt for local codeless solutions or cloud-based solutions. As one of the best automation testing companies, we always prefer cloud-based solutions as they offer more advantages. Collaboration is one of the main plus points as it will enable seamless sharing of test data and test scenarios. In addition to that, you will be to scale your services better with the help of the many virtual machines and mobile devices available online. Since your infrastructure becomes more robust, your overall process quality will also drastically improve.

The Future of Codeless Automation Testing

Though complete codeless automation isn’t yet possible in the same way how all manual tests can’t be automated, it is the natural next step that testers have to take. Repetitive tests were replaced with automation using scripts and now repetitive automation coding is being replaced with codeless solutions that utilize machine learning and AI. But as it always has been, manual testing and scripted automated testing will still play a major role in software testing.

How to Achieve Google Sheet Automation using Google API Services

How to Achieve Google Sheet Automation using Google API Services

In today’s world, success is heavily dependent on the pace at which we work. So automating repetitive work is one of the quickest ways to attain functional performance. But if you find automation to be daunting, you might have a negative approach of just manually doing the tasks over and over again to enter an endless loop of wasting time. So if you are someone who uses Google Sheets regularly to create and maintain data, this blog will be a lifesaver for you. As a leading automation testing services company, we are focused on dedicating our time to our core service by automating repetitive tasks. So in this blog, we will be exploring how to achieve Google Sheet Automation and get the job done in no time. Without any further ado, let’s get started.

The pace isn’t the only advantage that comes with automation. Since repetitive tasks are prone to oversight and manual errors, we will be able to avoid such issues by implementing automation. Now that we have established what we are targeting to achieve, let’s first see how to do it. We will be making use of the available Google APIs to examine and add data in Google Sheets using Python. So you wouldn’t have to spend hours of your time extracting data and then replica-pasting it to other spreadsheets.

Prerequisites:

In order to achieve Google Sheet Automation, you’ll be needing a few prerequisites such as

  • A Google account.
  • A Google Cloud Platform project with the API enabled.
  • The pip package management tool
  • Python 2.6 or greater

How to Achieve Google Sheet Automation using Google API Services?

Here are the few steps that need to be followed to start using the Google sheets API.

i. Create a project on Google Cloud console

ii. Activate the Google Drive API

iii. Create credentials for the Google Drive API

iv. Activate the Google Sheets API

v. Install a few modules with pip

vi. Open the downloaded JSON file and get the client email

vii. Share the desired sheet with that email

viii. Connect to Google Sheet using the Python code

Create a project on Google cloud console

In order to read and update the data from Google Sheets in Python, we will have to create a Service Account. The reason behind this need is that it is a special form of account that can be used to make authorized API calls to Google Cloud Services. Almost everybody has a Google account today. In case you don’t, make sure to create one and then follow all the steps and comply with the requirements to create a Google Services account.

1. You will be able to create a new project by going to the developer’s console and clicking on the ‘New Project’ button.

Step 1 - Clicking on New Project

2. You can then assign the project name and even enter the organization name if you prefer to. Once you are done, click on the ‘Create’ button.

Step 2- Create New project in Google Sheet Automation

3. The next step after creating the project would be to enable the APIs that we require in this it. To access the different API options provided by Google, you have to click on Menu -> APIs & Services -> Library.

Step 3 - Creating Project on Google Cloud Console

4. You have to search and enable the following two APIs from the library as shown below. You can enable them by just clicking on the enable button that appears.

  • Google Sheets API
  • Google Drive API

The Google Sheets API is the important one that will enable you to read and regulate the data in Google Sheets.

Step 4 in Google Sheet Automation

5. Now that you have enabled the required APIs to beat your automation challenge, it’s time to create the credentials for the services account. You can do that by clicking the ‘Create Credentials’ button that can be found in the Credentials menu as shown in the image.

Step 5 - Create Credentials on Google Sheet Automation

6. Once you click on that, a drop-down list will appear. Choose the ‘Service Account’ option from the list.

Step 6 - Click Service Account - Google Sheet Automation

7. You would have to provide the Service Account details here in order to continue. That is why we had mentioned that you would have to create one prior to starting this process. Once you have provided the info, you can create the credentials by clicking on the ‘Create and Continue’ option.

8. Similar to how we share the Google spreadsheets with other collaborators by providing them various access permissions like edit or view only, we will have to provide access to our service account as well. Since we have to both read and write in the spreadsheets, you would have to give editing access or not the view-only option.

Step 8 - Adding Collaborators in Google Sheet Automation

9. Once the credentials have been created, download the JSON file for the credentials. The JSON file will contain the keys that you will need to access the API. So our Google Service account is now ready to use.

Share the desired sheet with that email

Now that the Services account credentials have been created, you have to provide the email using which you will access the spreadsheet.

Sharing the sheet with the Email

Open the Google Sheet that you want to automate and click on the Share button to provide access to this client email. Now, you are all set to code and access the sheet using Python.

Connect to Google Sheet using Python Code

First up, you have to open the downloaded JSON file in PyCharm. You can then create a Python file in the same project folder and start writing your script.

To Connect Google Sheet using Python Code

We then have to install two packages (gspread and oauth2client) from PIP. To do that in PyCharm, we have to open command prompt and use the below command

pip install gspread oauth2client

Now let’s take a look at the different segments of the python code one by one to understand it easily and successfully implement it to achieve Google Sheet Automation.

1. Importing the Libraries

We will need both the gspread and oauth2client services to authorize and make API calls to Google Cloud Services.

import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import print
2. Define the scope of the application

Then, we will define the scope of the application and add the JSON file that has the credentials to access the API.

scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file",
         "https://www.googleapis.com/auth/drive"]
3. Add credentials to the account

Once the scope has been defined, you have to add the credentials to the account.

creds = ServiceAccountCredentials.from_json_keyfile_name("test1-331506-a11c2c0a84fc.json", scope)
4. Authorize the client sheet

The next stage is authorizing the client sheet.

client = gspread.authorize(creds)
5. To open a Google Sheet

There is nothing that can be done without opening the Google Sheet in the first place.

sheet = client.open("Automation").sheet1
6. Get all records

Once the sheet is open, you can get all the data present in the sheet using the get_all_records function. It will return a JSON string that contains the data.

data = sheet.get_all_records()
pprint(data)
7. To get a specific row

Though reading all the data is a great feature, that wouldn’t be needed every single. So this is the code that you can use to get data from a specific row.

row = sheet.row_values(3)  # Get a specific row
pprint(row)
8. To get a specific Column

Similarly, we will also be able to access data from a specific column.

col = sheet.col_values(2)  # Get a specific column

pprint(col)
9. To Get the value of a specific cell

We can even be very precise and access data from a specific cell too.

cell = sheet.cell(1,2).value  # Get the value of a specific cell

pprint(cell)
10. To insert the data into a sheet

We have seen how to read the data, now let’s see how we can insert data.

insertRow = [ 15, "Logesh"]

sheet.insert_row(insertRow, 15) 
11. To delete certain row

Not all data in a sheet will be needed forever and so you can even delete a row of data from your sheet.

sheet.delete_rows(14)
12. To update one cell

If at all you want to change the data in an existing cell, you wouldn’t have to delete the content and then add the new one again. Instead, you can just update the content in the cell.

sheet.update_cell(2,4, "CHANGED")  # Update one cell
13. To Get the number of rows in the sheet

Beyond reading and editing the content in the sheet, you can even get to know the number of rows in a sheet as it might be needed for your automation process.

numRows = sheet.row_count  # Get the number of rows in the s

pprint(numRows)
14. To get the length of the data

Likewise, we can even get the length of the data in the sheet if you want to use that in your automation as well.

pprint(len(data))

Source Code:

Since we have explained everything part by part, now it’ll be much easier for you to go through the source code and understand it clearly.

import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint

scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file",
         "https://www.googleapis.com/auth/drive"]

creds = ServiceAccountCredentials.from_json_keyfile_name("test1-331506-a11c2c0a84fc.json", scope)

client = gspread.authorize(creds)

sheet = client.open("Automation").sheet1

data = sheet.get_all_records()

pprint(data)

row = sheet.row_values(3)  # Get a specific row

pprint(row)

col = sheet.col_values(2)  # Get a specific column

pprint(col)

cell = sheet.cell(1,2).value  # Get the value of a specific cell

pprint(cell)

insertRow = [ 15, "Logesh"]

sheet.insert_row(insertRow, 15)  # Insert the list as a row at index 4 its will over write

sheet.delete_rows(14)

sheet.update_cell(2,4, "CHANGED")  # Update one cell

numRows = sheet.row_count  # Get the number of rows in the sheet

pprint(numRows)

pprint(len(data))

Conclusion:

We hope you now have a clear idea of how to achieve google sheet automation as per your needs and make the most out of the tool to save your valuable time. As a test automation services provider, we understand that not everything can be automated, but if you approach any automation task with a negative mindset, you’ll never be able to unravel the solutions to overcome your obstacles. So follow and implement these methods with a positive mindset and you will definitely witness performance improvement at your end.

How to Find the Right Tools for Mobile and Web App Testing

How to Find the Right Tools for Mobile and Web App Testing

We live in a world where automation is already considered to be a huge advantage now for most companies. The same goes for testing mobile and web applications. You need to have the right tools that will help you automate many of the functions of testing so you can get a higher level of test coverage and execute them at a faster rate. Let’s look at some of the tools that quality teams are looking for when testing mobile apps and web apps.

Tools for Mobile App Testing

While most web developers and testers use the Selenium framework to write tests, there are many different tools for mobile app testing. The first question to ask when choosing a tool is whether it is open-sourced or closed-source. Since most mobile apps are built with open-source frameworks, it is best to select an open-source tool, if possible.

The next question is whether the tool runs on more than one OS or just on Android or just on iOS. You will probably write tests in a language that does not depend on OS, but you should remember that Android and iOS require different test frameworks.

Not every mobile app test framework is best for every application type: native apps, web apps with a mobile interface, and hybrid apps with heavy WebView use can require different tools.

If you are running into problems deciding which tool is best for your needs, keep in mind that many companies offer free trials or free versions of their products. Just do a little bit of research before you jump in headfirst.

Tools for Web App Testing

 More and more businesses rely on their web applications to streamline their operations and improve their marketing efforts. The continuous, high load and growing market expectations require web apps to undergo a variety of tests to make sure that it’s compliant with the UI standards, as well as in terms of compatibility and usability. Web app testers need to use a variety of automated software testing tools that allow them to test their products from different perspectives.

Which Testing Tool to Use?

Before making a decision on which testing tool to use for your applications, you need to take into account all the other factors that could affect how your testing will go. Some of the questions you need to consider are:

  • How many tests do you need to run?
  • Who will run the tests?
  • How frequently do you need to run them?
  • How many users do you intend to simulate?
  • What scripting languages do you have experience working with?
  • What platforms and browsers do you need to cover?
  • Are you testing a finished product or a pre-release version?
  • How important is automation for you?
  • Do you have a system of tracking and analyzing the results?
  • How important is a visual reporting system for you?

Conclusion

Mobile and web app testing is a crucial step in software development where companies can’t afford to cut corners. The only way to make testing much more efficient is to use the right kind of tools for the job. This guide should help you decide what kind of tools you can use for testing that will help you automate many of its functions.

If you’re in need of a QA company with a seamless track record in web and mobile testing services, Codoid is your best choice. Every new software product deserves high-quality automation testing, and our team of highly skilled QA professionals can handle any job. When it comes to QA automation services, there’s no better choice than Codoid. Partner with us today!

An End-to-End Robot Framework Tutorial

An End-to-End Robot Framework Tutorial

Robot Framework is an open-source Python-based automation framework used for Robotic Process Automation (RPA) and also for Acceptance Testing & Acceptances Test-Driven Development (ATDD). It is used with the keyword-driven testing approach for which testers can write automation test scripts easily. The Test cases are written using the keyword style in a tabular format making them easy to understand. Robot Framework does provide good support for external libraries. But Selenium library is the most popular library used with Robot Framework for web development and UI testing. As a leading mobile app testing service provider, we have been using Robot Framework in our various Android and iOS app testing projects. So we have written this end-to-end Robot Framework Tutorial that covers everything one has to know.

The Basic requirements for robot framework

Since the Robot framework is built based on Python, we have to install the latest version of Python by downloading it from their official site. After successful installation, set up the Path environment variable in your local system.

Steps to Install Robot Framework:-

1. You can check if the Python setup has been installed properly by opening Command Prompt and typing the below command.

python --version

2. Use the below command to check the pip version. (Pip is a Python package manager)

pip --version

3. Now we’re all set to install the Robot framework

a. For a straightforward installation of the robot framework, you can use the command

pip install robotframework

b. If there is a need to install the robot framework without any cache, you can use this code instead.

pip install --no-cache-dir robotframework

c. If for any reason, you want to uninstall the Robot framework, then you can do so by using the below code.

pip uninstall robotframework

4. Just like how we verified Java, we can use the below commands to check it using Command Prompt.

(i)

pip show robotframework

This command will show the details of the robot framework and the framework location.

(ii.)

pip check robotframework

Once we enter this command, the desired result that should be displayed is “No broken requirements found.” If any other message apart from this (i.e.) a warning is displayed, we need to check the warning related to the setup and install it properly.

We can also verify if the Robot Framework has also been installed properly in our Local system.

Go to the Python folder > Lib > site-packages > verify if Robot Framework is installed.

Robot Framework Installation

5. To verify the version of the installed Robot Framework, use this code

robot --version

6. You might face a scenario where you would need to use a specific version of the Robot Framework, you can accomplish this by mentioning the specific version you need as shown below.

pip install robotframework==4.0.0	//mention the specific version

7. In time, you might want to upgrade the old version of the Robot Framework. You can use the below code to do it.

pip install --upgrade robotframework

8. In addition to verifying if the Robot Framework has been installed correctly, you might also have to check if the python libraries.

(i.)

pip freeze

This command will show all the python libraries installed with the robot framework version.

(ii.)

pip list

This command will show all the python libraries installed with their version numbers.

For writing automation test case:

In the Robot Framework Tutorial, we would be exploring how to perform web browser testing using Selenium Library. But for that to happen, we have to import the Selenium library file to this Robot project

Step 1: Enter the Command-Line to install Selenium

pip install selenium

Step 2: To upgrade the pip installation with the Selenium library, enter the below-mentioned command

pip install --upgrade robotframework-seleniumlibrary

Step 3: Finally, you can check if the pip Robot framework Selenium library has been installed properly by using this command.

pip check robotframework-seleniumlibrary

IDE for the Robot framework:

We can conveniently use the following IDE’s to write the Robot Framework automation testing codes.

1. PyCharm

2. Eclipse with RED plugin

3. Visual Studio with one of the plugin

4. RIDE

In this Robot Framework Tutorial, we have used PyCharm with Selenium to write a website automation testing code.

PyCharm IDE Installation and a New Project Creation:-

Step 1: Go to https://www.jetbrains.com/pycharm/download/#section=windows

Step 2: Download the free Open-Source Community Version of the PyCharm .exe file.

Step 3: Once you run the .exe file of the PyCharm setup, you’ll see the ‘Install Location’ window. If you want to change the location from the default option, you can click on the “BROWSE” button, and select your own file setup location and click on the ‘Next’ button.

Step 4: In the 4th Window, select the 64-bit launcher and click the ‘NEXT’ button to move to the next window where you can directly click on the ‘INSTALL’ button to install all the files.

Step 5: Once the setup and jar files are properly installed and updated, tick the checkbox and finish by clicking on the “OK” button in the “Import Pycharm Settings” pop-up.

Step 6: Now, you will see the ‘Welcome to PyCharm’ window. Click on the “Create New Project” option and it will automatically generate a project fill location to set up the project. If you would like to change the location, then you may click on the file option to customize it as you please. Enter the “Project Name”, and click on the “CREATE” button.

PyCharm IDE Installation

Step 7: Finally the PyCharm Window will display with New Project.

PyCharm IDE new project

In this Pycharm IDE, we are going to create a Robot framework for a website’s automation testing. So let’s explore how to generate a report and all the other essential actions in the upcoming topics of this Robot Framework Tutorial.

How to Create a New Robot Project and the required Setups:

In the Robot framework, we have to set up interpreters and add some plugins as well. Let see how to do those things now.

Step 1: You’ve already created the Initial Project for which you need to add the interpreters to work with the Selenium and Robot framework. So follow the below steps, and use the image as a reference if needed.

Go to File > Settings > Click on Project: “current project name” > Python Interpreter > + icon

Create new Robot Object in Robot Framework Tutorial

Step 2: You need to install the following packages for this project

i. Selenium

ii. robotframework

iii. robotframework-seleniumlibrary

You have to enter these three keywords one by one in the search input field and search for the packages. Once you find them, you have to click on the “Install Package” button and wait for a while for the packages to install in the back end. Once it is successfully installed, the highlighted message will appear and you can close the window by clicking on the “OK” button in the settings window.

Note: Make sure to close the window only after installing the three packages one by one.

Installation of Selenium

Step 3: Now, you have to add the “IntelliBot @SeleniumLibrary Patched” Plugin as it’ll help us find the Robot framework files and give auto suggestions for the keywords. So without this plugin, PyCharm will not be able to find the “.robot” files. The steps are as follows,

Settings > Plugin > Marketplace >Search “IntelliBot @SeleniumLibrary Patched” > Install

Adding Intelli Project in Selenium Library

Once the Plugin has been installed, you have to restart the IDE for the initial configuration.

Step 4: Normally, the Project Structure contains multiple directories and each directory contains a similar kind of file. So in this Test project, we are going to create a test case inside the directory first.

Right-click Test Project > New > Directory > Enter the Directory Name

That directory will be created under the Test Project and so our Robot test cases can be created inside it.

Step 5: Create the “.robot” file under the created directory.

Right Click on Created Directory > New > File > Enter a File name that ends with “.robot”

Once the robot project has been created, the structure of the project will be how it’s shown in the following image.

Create Robot file in Created Directory

Prerequisites to run Automation Test Cases in the Robot Framework:

Whenever you write automation test cases in the Robot framework, 4 sections should be there. They are

  • Settings
  • Variables
  • Test Cases
  • Keywords

Prerequisites to run Automation Test Cases

Note:

  • These 4 sections are must-know aspects from a beginner’s point of view.
  • Each and every section starts with ‘***’ and is followed by the Name of the Section. It also ends with ‘***’.
  • One (or) Two Tab spaces are needed in between the Keyword and the Test data (or) Data (or) input data because indentation is very important in Python.
  • When you’re about to write a test case, you should first write the test case name and then go to the next line to write the keyword after leaving a tab space.

Step 1: Settings

You are going to import the Selenium Library in this Test case.

The first line indicates the code block and the second line uses the “Library” keyword to import the “SeleniumLibrary”.

Syntax:

***Settings***
				Keyword		LibraryName

Selenium Library in Settings Test Cases

Step 2: Write the Test Cases

Now, you have to write exact test cases as per your requirements. First, you have to assign a test case name, and then enter the test case information in the next line. You can write these test cases using free defined Selenium Keywords. Being a leading QA Company, we wanted our Robot Framework Tutorial to be a comprehensive guide even for beginners. That is why we’re going through everything from scratch.

Syntax:

***Test Cases***
			TestCase_Name		
				Keyword	Locators(or)data	Testdata

In this Robot Framework Tutorial, we are going to perform the following test cases:-

1. Visit the Codoid Website.

2. Navigate to another page and verify it.

3. Pass the Input data.

The first step towards automation is launching your browser. Based on the browser you are using (Chrome, Firefox, etc.), you have to download the various drivers. Once you have downloaded the drivers, you have to extract the downloaded file and copy the driver.exe file path. We will be using Chrome for our demonstration.

Syntax for the Chrome launch:

***Test Cases***
TestCase_Name
Keyword	driver_name		executable_path= “driver_path”

Syntax for Chrome Launch

There is also another method that can help us save some valuable time by reducing the time to launch the browser. You can,

1. Copy or Cut “various_driver.exe” file from your local.

2. Paste them under the Python/Scripts page under your local system as shown below.

Local System folder

After this step, we can directly launch the browser without pointing to the driver location in the framework. We have to write the following syntax instead of using the “Create webdriver” keyword to set up the path.

Direct browser launching syntax:

***Test Cases***
TestCase_Name
Keyword	input_data (or) URL	driver_name

Browser Launching Syntax

Based on the requirements, we have to write the test steps under the test case name with the Selenium Library Keywords and respected Locators along with the test data.

Selenium Keywords in Robot Framework Tutorial

In this example, will be performing the test case with limited Selenium Keywords in the robot framework. For more Selenium Library keywords please visit their website.

Step 3: Define the Variable

The variables are elements used to store values which can be referred to by other elements.

Syntax:

***Variables ***
				${URL}	url
				@{UserCredentials}		inputs

Defined variables can be replaced in test cases and we can even reuse them anywhere in the test case when needed.

Define the Variable Testcases in Robot Framework Tutorial

Apart from this, we have a lot of variables available in Robot Framework. We have mentioned only the required ones here

Variables Available in Robot Framework Tutorial

Step 4: Define the KEYWORDS

Since the keywords are reusable in the Robot framework, it helps manage the changes in a faster and efficient manner. You can even create our own keywords here.

Syntax:

***Keywords***	
			Keyword_Name
				Selenium_keyword		locators 	input_data

Keywords Testcases

Once you write your own keyword, you can replace the test case steps with the keywords.

Replacing Test cases with Keywords in Robot Framework tutorial

Even once all of this is done, we won’t be able to run our project directly in the PyCharm Robot framework. We would have to go to the Terminal and use the below command

robot directory_name\file_name.robot

Terminal Section in Robot Framework Tutorial

Once the project has been successfully executed, the output.html, the log.html, and the report.html files along with the screenshots for each test case will be automatically created in our project structure. So we can copy and paste it into any browser to check the report of the execution of our project.

Execution of the Project

Testcase Report

Here we have executed all the test cases. But if you are looking to run a separate test case, you can do so by using Tags. You should include the tags with the name of your choice inside the test cases section under the test case name as shown in the below image.

Including Tags in the testcases

You can either run one or a particular set of test cases by using this command in the Terminal.

For one particular Tag:

robot --include=Tag_name directory_name\file_name.robot

One particular tag at a time

For Two Tags at a Time:

robot –i Tag_name  -i Tag_name directory_name\file_name.robot

Two tags at a time

So using tags you will be able to get more concise reports as you can execute the test cases based on priorities. Refer to the following images to get a better understanding of what we mean.

Tags details in Testcase in Robot Framework Tutorial

Test Case details in the Robot Framework Tutorial

Test Case log

Conclusion:

We hope you have found our end-to-end Robot framework tutorial to be useful as the Robot framework is an easy-to-understand open-source tool that provides a modular interface to build custom automation test cases based on your varying requirements. So it has been widely adopted by various large organizations for this very purpose, and for good reason.

A Thorough Jenkins Pipeline Tutorial for Beginners

A Thorough Jenkins Pipeline Tutorial for Beginners

Jenkins has risen to become an expert in Continuous Integration, Continuous Testing, & Continuous Delivery, and assumes a critical role in conveying great applications or items. It utilizes a component called the Jenkins pipeline for achieving Continuous Delivery (i.e.) the capacity to deliver applications routinely for a long stretch. This Jenkins pipeline guarantees that the product is consistently prepared for creation. As a leading QA Company, we have been using the Jenkins Pipeline and found it to be very effective. So if you are looking for a Jenkins Pipeline Tutorial that covers everything from the basics of the pipeline to learning how to perform parallel execution, you’ve found it.

What is a Jenkins Pipeline?

A pipeline in the Jenkins CI/CD can be defined as a series of events or even tasks that are interconnected to each other in a specific order. To put it in simpler terms, the Jenkins pipeline can also be characterized as a set of modules or plugins that enable the implementation & integration of the Continuous Delivery pipelines within Jenkins. It has an expandable automation system that can be used to build basic or complicated ‘template’ distribution pipelines via the Domain-specific language (DSL) used in the pipeline. Continuous Delivery in the Jenkins pipeline comprises 4 major states,

  • Build
  • Deploy
  • Test
  • Release

We will be taking a closer look at these states later on in the Jenkins Pipeline Tutorial, but first, let’s take a peek at the many advantages that the Jenkins pipeline CI/CD has to offer.

Advantages of the Pipeline:

  • It can divide the jobs into parts (build /test /deploy) and each part can run in each agent.
  • Parallel execution of stages is easy to configure and so it can be instrumental in saving time.
  • Each stage can execute the different versions of JDK/MVN versions.
  • It can be retriggered even from a failed stage.
  • Visualizing the build flow becomes possible.
  • The build can hold until the user gives the input.
  • Version control and code reviews are made easier.
  • We can pause and restart the build as and when we wish.
  • It will automatically be created as sub-branches in a multi-branch pipeline script.

Pipeline’s Basic Keywords:

Knowing the basic keywords that will be used in the pipeline is the first step that we will be taking in our Jenkins Pipeline Tutorial. So let’s see what these keywords are and how you can use them in the pipeline. We’ll start with ‘Steps’.

Steps
  • Steps have to be written inside the stage directive.
  • Steps contains the command or scripts that we’ve used in the build.
  • One step’s directive should be there in the stage directive.
Stage
  • Stage defines a particular stage (build/test/deploy/..) of our job.
  • There has to be a minimum of at least one stage.
  • The name of the stage will be displayed on the Jenkins dashboard.
Stages

Stage and Stages are two different keywords that you shouldn’t confuse yourself with.

  • It contains a sequence of the stages we saw earlier.
  • There has to be at least one stage.
Agent
  • It defines where we need to run our pipeline script. (Master/Slave/Container)
Stage color

So using color, we will be able to find out the current status of the stage.

  • White – The stage hasn’t yet been executed.
  • Green – The stage is a success.
  • Blue Lines – The stage is being executed.
  • Red Line or Red Lines – The stage has failed.
  • Red (If in case few stages were a success and one failed, it will show red even if the few have been successful)

Types of Pipeline

1. Declarative pipeline

2. Scripted pipeline

So as seen above, there are two types of the pipeline, and the declarative pipeline is the recent addition that has the more simplified and opinionated syntax when compared to the scripted pipeline. Now let’s take a look at the syntax for these types.

Declarative Pipeline syntax:
Pipeline {
      agent any 
      stages {
         stage(‘Build’) {
              Steps {
             }
        }
stage(‘Test’){
          steps {
        }
     }
stage(‘Deploy’){
      steps {
            }
       }
   }
} 
Scripted Pipeline Syntax:
node {
  stage(‘Build’) {
     }
stage(Test’) {
    }
stage(‘Deploy’) {
    }
}

Variables in the pipeline:

What is a variable?

A variable is used to store values. There are two types of variables, and they are predefined and user-defined variables.

<variable name> = <variable value>

Predefined Variable:

pipeline{ 
    agent any 
    stages{ 
      stage('pre'){ 
      steps{ 
      echo " predefined variable $BUILD_NUMBER $WORKSPACE " 
              } 
       }
   }
}

Output:

Pre-defined Variable Output - Jenkins Pipeline Tutorial

User-defined Variable:

User-defined Variable we can define in root level or stage level

pipeline { 
    agent any 
         environment{ 
              MYHOME="Chennai" 
            } 
            stages{ 
            stage('User'){ 
            steps{ 
             echo " userdefined variable $MYHOME " 
                       } 
               } 
         } 
}

Output:

User defined Variable Output - Jenkins Pipeline

Parameters in Pipeline:

Parameters are used to pass the following types of data dynamically.

  • String
  • Text
  • Boolean
  • Choice
  • Password
  • File
Implementation of Parameters in Pipeline:
pipeline{
 agent any
 parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: '') 
text(name: 'DEPLOY_TEXT', defaultValue: 'RnD\nJenkins\nPipeline\n', description: '')
booleanParam(name: 'Are You Have Permission to Deploy', defaultValue: true, description: 'Toggle this value')
 choice(name: 'CHOICE', choices: ['One', 'Two', 'Three'], description: 'Pick something')
 file(name: 'FILE', description: 'Some file to upload')
 password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'A secret password')
}
 stages{
 stage('string'){
 steps{
 echo " string $DEPLOY_ENV"
 }
 }
stage('text'){
 
 steps{
 echo " text $DEPLOY_TEXT"
 }
 }
stage('booleanParam'){
 
 steps{
 script{
 if(TOGGLE){
 echo " now execute, booleann is true"
}else{
 echo " Dont execute, boolean is true"
}
 }
}
 }
stage('choice'){

 steps{
script{
if(DEPLOY_ENV=='staging'){
echo " choice $CHOICE"
}
 }
}
 }
stage('file'){
 
 steps{
 echo " file $FILE"
         }
 }
stage('password'){
 
 steps{
 echo " password $PASSWORD"
          }
      }
   }
}

Output:

Parameters in Pipelines

Parallel Execution in Jenkins pipeline:

We will be focusing on the parallel build using the Jenkins declarative pipeline in our Jenkins Pipeline Tutorial now. So you can trigger your build system by Jenkins if there are some steps that could possibly run at the same time since they have no dependencies. By following this method, you will speed up your build process and save time for other sequential steps. As one of the best automation testing service providers, we don’t just stop with using the best tools, we also focus on using them in the best way possible.

Parallel Exection in jenkins Pipeline Tutorial

Parallel Execution:
pipeline {
    agent any
    
    stages {
        stage ('My Java Project Test Scenarios'){
            parallel {
        stage('Unite Test'){
            steps {
                echo 'Unit test Completed'
                sleep 5
            }
        }
        stage('Integration Test'){
            steps {
                echo 'Integration Completed'
                sleep 5
            }
        }
        stage('Security Test'){
            steps {
                echo 'Security Completed'
                sleep 5
            }
        }
        stage('Selenium UI Test'){
            steps {
                echo 'Selenium UI Test Completed'
                sleep 5
            }
        }
    }
              
}
 }
}

Output:

Parallel Exection Output

Conclusion

We hope you enjoyed reading our Jenkins Pipeline Tutorial and found it to be informative at the same time. As promised we have covered everything including the basics of the Jenkins pipeline, seen its advantages, explored all the perquisites like variables and parameters that you will need to know to use it effectively. So make sure you don’t just try the Jenkins pipeline, make sure you use it effectively.

The 6 Step Solution for achieving Continuous Testing with Automated Testing

The 6 Step Solution for achieving Continuous Testing with Automated Testing

Releasing software multiple times into production in a day to deploy the new features/fixes with high quality will need an automation testing setup in all the stages of your delivery pipeline. In DevOps, you have to automate as much as possible to enable continuous testing. So when a product is getting deployed into production more frequently, you have to test the product continuously. For you to proactively search for quality issues, continuous testing has to be enabled across all stages of your delivery pipeline. Since software Test Automation is the key enabler of Continuous Testing, we will be taking a look at the 6 steps that can help you achieve Continuous Testing.

Treating Test Code as Production Code

Whenever a change happens in the product, you have to update your test code to accommodate the change. Let’s say you have to make a change on a common page/screen, your test automation framework should enable you to update the change in that one place instead of updating all the scripts.

Implementing the best practices and design patterns in test automation ease script maintenance. So you have to design your framework in such a way that any script change can be added to the test suite quickly without any hassle.

Kick-off Test Execution for Every Code Commit

Every code commit to version control should kick off automated unit & acceptance tests. When you deliver fast, you will also be in need of quick feedback for the changes or fixes that you have made. Lack of code commit validations will lead to eventual quality issues and regression defects.

Test Automation Framework

You can’t just build the entire framework and immediately start the script creation for Continuous Testing. We have to use the Acceptance Test-Driven Automation (ATDA) approach to develop an automation testing framework. ATDA enables you to write automated test scripts from the very first day instead of waiting for the framework development phase to be completed.

In the past, automation testers used to spend at least two weeks, or even a month in certain cases to develop the test automation framework. The script development itself would begin only after that. So in order to achieve Continuous Testing, you have to start the script development from day one, and then go forward with the product development.

How can we develop scripts without a framework?

Let’s say your team is comfortable with Java. You can use JVM-Cucumber, Selenium, Maven, Appium, and IntelliJ Community edition to start writing automated test scripts from day one. If a script needs a new framework feature, you first have to develop the feature and complete the script. That is how you can evolve the framework and not hold up the script development during the framework development.

Avoid & remove Flaky Tests from CI

If an issue messes with the DevOps pipeline, the entire team should focus on the issue and fix it immediately. Similarly, if a script is flaky, it will make the pipeline unstable. Automation Testing Services is our core service, and we know for a fact that you’ll need a highly skilled team that follows the best practices and uses proper object locators to avoid flaky tests and achieve Continuous Testing.

So if some of your tests are flaky, you must quarantine, schedule, and run them separately, and bring them into the delivery pipeline only when it is fixed and stable.

Test Data Generation

Test data plays an important role in UI, Functional, Non-functional, and Integration Testing. So you have to park adequate test data for test execution. Make sure to avoid failures that can be caused by invalid or missing test data. You should also have an automated system that allocates the required test data and cleans up the consumed data during execution.

Setup the Tests for all the phases

Continuous Testing should be set up in all phases of your delivery pipeline starting from development to production. For example, if a feature is being actively used by the end-users on a daily basis for a particular period of time. You can write an automated test script to check the feature’s usage from the production monitoring data to proactively check for any quality issues. So make sure you don’t just focus on smoke and regression testing as you have to set up tests for different stages in the pipeline.

Conclusion

Being one of the best automation testing service providers, we, at Codoid, follow strict scripting practices and design patterns to avoid flaky tests and have helped many clients to enable Continuous Testing in their DevOps pipeline. Fast feedback is critical for DevOps. You also shouldn’t delay test code development. You have to add the test code as and when new features are deployed into the pipeline.