Select Page

Category Selected: Automation Testing

190 results Found


People also read

Mobile App Testing

Appium 3 Features & Migration Guide

Automation Testing

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility
How to start Automation Testing from Scratch

How to start Automation Testing from Scratch

As we pass by the different industry revolutions the usage of machines in doing the manual activities has helped in their transformation. Similarly, in the software revolution, usage of tools to do the manual testing activity has literally increased the industry throughput due to the following factors.

  • Automation doesn’t only help a team in reducing the man-hours spent in business but also helping us the cost.
  • With the implementation of automation in a project, we can conduct thorough testing quite frequently to ensure nothing breaks in the system right after quick sprints in the agile model of SDLC.
  • It’s quite evident that the system never tires with the multiple executions that we can ensure greater accuracy.

What is Automation testing?

In layman terms it is the usage of tool which can mimic the user action on the software application and perform functional validation without any human intervention or with minimal human intervention.

Levels of testing

Below are a few of test types that are performed as they are required in the Software Testing Life Cycle.

Unit testing:-This is the basic level of testing as soon as a software component is built. The purpose of Unit testing is to ensure that the component does what it is expected to function. This is basically taken care of by the development team and most of it is automated (Example – J-unit, N-unit, jasmine).

System testing: These are the end to end tests that the independent QA writes to ensure the application is best tested and also to uncover any minimal flaw that exists in the system. These tests can fall under UI validation, API validation and DB validation (Example – Selenium, UFT, Test Complete, Tosca, etc.)

Acceptance testing: This is the final level of testing which is taken care of by the Business team to certify the business requirement is met. Mostly Automated scripts developed in System testing will be utilized for Acceptance Testing as well. Acceptance testing scenarios will most probably the subset of System testing scenarios

All these levels of testing can be automated depending on the organization culture and commitment

Types of Automation testing:

Given a careful study of the above different levels of testing it’s time to look at the type of testing in which automation can be achieved.

UI Automation:-This test adds a lot of value to the business considering the fact that the UI is the main layer through which the user interacts more. This is all about impersonating the user actions by clicking on a button, checkbox and sending some information to the text fields and finally saving and navigating across pages. This has widely opted in the business as it has the ability to find the defects that can be foreseen to happen at the user site.

API Automation:- Application Programming Interface is the middle layer between UI and DB. Data is transferred between the database and User Interface is mostly through API calls.

Eg: Rest/ SOAP API tests

Database Automation:- These tests are used to validate the recordset of the database based on certain conditions and with the certain expected results based on certain events.

Eg: JDBC- connecting to the DB and performing validations

Windows Automation:- Given the limitation of selenium- web driver can only talk to browser through http protocol, there are cases where we need to perform some interactions with windows, in that case, we have some test tools which helps us achieve the tasks. We can even integrate with other tests as needed

Eg: Eg: Coded UI, Sikuli, AutoIT

Identifying Automation Candidate:

So far we understood that Automation can help us in lot better ways to conduct different levels of testing in quick time and very accurately. But in order for this approach to be more beneficial, we must take care of certain things before we get into automation.

ROI (Return on investment): – We should understand what way we get benefitted in return when we spend resources to perform the Automation. We gather information like frequency of releases, # of a test to execute, cost to perform one round of test execution and cost to perform a round of automated execution.

Tool identification through Feasibility study: – This is must and can’t be avoided. A feasibility study is assessing Application under test with the set of identified automation tools to validate the best tool to be used for Automating the Application

Application stability: – Ideally in order to automate the application in best standards we must consider its. If there are frequent crashes, Application slowness due to infrastructure issues, etc would not yield the better results that we are looking for.

Setting up the Tool Infrastructure

Below are the points to consider which helps in deciding the tool Infrastructure.

  • Nature of Organization, it’s business and their security consideration
  • Application types, release frequency, Technology stacks, 3rd party plugin, and customization
  • Overall timeline taken for testing / release / Application
  • Volume of Test cases / Application and its frequency of usage for each release
  • Current tool stack it has from the Test Management perspective
  • Environment Management and tool procurement process
  • Automation feasibility outcome based on evaluation
  • Organization willingness to spend on tools procurement
  • Budget required to train and upskill the resources/resource need for Automation

Based on the above pointers and based on the ranking of tool evaluation and other cost consideration Organization has to decide which tool stack it can rely on to maximize the Automation coverage.

Initiate the discussion with the vendor to set up tools in their premise.

Automation Framework:

Automation framework is the set of rules, guidelines, and templates which when implemented helps an automation tester to write the script with ease to get the desired outcome of code re-usability, portability by reducing script maintenance cost.

Pre-requisite for Framework

Below are the components of Framework

  • Programming language
  • IDE
  • Automation tool
  • Build tool
  • TestRunner
  • Dependency management tool
  • Version control system
  • Reports and logging generation
  • CI/CD

Programming language:-This can be chosen by considering the development technical standards and also keeping in mind that whether or not the selection is cost-oriented or an open-source one and finally there has to be a community to overcome certain challenges if we face and support from vendor if it is commercial

Eg; java,c#, python, ruby, perl..etc

Java- widely used because of its open-source feature and rich library and best community than many other languages

IDE:-This is an acronym for an integrated development environment, based on the language and need we should be selecting the proper one to make the assignments hassle free

Eg: Eclipse, Intellij, Visual studio

Eclipse is widely used as it has got more community and rich features and an open-source one, IntelliJ is used mostly as well, it has got open as well licensed editor

Automation Tool:- based on the type of test and type of application and after analyzing the capabilities of a tool we should be picking this.

Eg: Selenium-webdriver, katalon studio, serenity, protractor, Rest API, RPA..etc

Build tool:- Build tools help to pull the latest code from source control, compile it and package it to trigger the execution

Eg: Maven, Gradle, Ant

Maven is widely used given its capabilities and the community it has

Test runner:- When we write some program it’s important to be executed as we need to verify the outcome of what it is being designed for. When developing a framework to trigger tests we should have the best test runner to help with more options to execute tests better such as executing tests multiple times, group execution, passing parameters and so on.

Eg: TestNG, Junit, N-Unit, jasmine are some test runners that are used, but with selenium, it is advised to go with testNG

Dependency management tool- When a sophisticated framework is developed, we may require so many third-party libraries and it is essential to integrate them as well. In order to achieve this, we should have the jar files from those libraries loaded into the binary path of the project, so that the project can recognize them. Loading on to the system may cause a greater problem as it may incur problem when it’s opened in a separate system, how do we overcome?

The concept of dependency management, can help us overcome the problem with the use of the tool Maven or Gradle. It provides a file called (POM.xml) when a maven project is created and we must mention the information of a particular dependency, then it goes and check in the local repository if it doesn’t present it automatically downloads for us locally through the internet. So when we share the project to someone else and opened the POM.xml does the same thing i.e. download things to the system from maven central repository if they don’t exist That way we can ensure the centralization of a dependency across the team. Also, it helps us to have the same and right information in the project.

Version Controlling system:- This system helps us to ensure the changes done to the code base by various teammates are properly merged. With the concept of pulls and pushes to the branches to the repository, we can achieve this. This brings a centralized system where all the persons in the team should look up. There are a few tools which help us doing this

Eg: Git Hub, Bit Bucket, SVN

Reports and logging mechanism:- Without reporting and logging mechanism no framework is completed. While reporting helps us understanding the test results in more easy fashion logging will help us in understanding what happened with a particular test.

Report tool:- Extent reports, allure reports and testing reports

Logging tool:- Log4j

CI/CD:- Continuous integration and deployment is buzzing in recent times as this is believed as a best standard to follow to ensure the code base is built properly and very frequently execution is happening. We can set the goals and pre-actions, Triggers and post- actions with this tool.

Eg: Jenkins, Teamcity

Roadmap for a manual tester to become automation tester

First of all fingers crossed!!!

First please set up a mind that every automation tester today is a manual tester before in some or other way in his/her previous assignments. It’s all about having an open mind to upskill and believing in themselves. Below steps would help in getting that done by self-exercise

Analyze your skillset first as what is known and then what should be learned from the above-mentioned toolset.

Start working on learning basics of a programming language with some real-time tasks for implementation (focus should only be on programming language –java, C# as per choice)

Interact with Automation tester as what concepts are widely used and focus on learning those concepts

Do more practical exercise on the topics that you have learned

Browse and understand the problems faced by people related to the topics learnt and implement to get those refined

Try to study the pain areas and try to improvise code written by using the concepts learned in the programming language (Oops – for instance)

Learn different frameworks available in the market and implement those

Learn other tool integration and practice

Do a mock project covering all the learned topics and demonstrate to the colleagues and get a suggestion for improvement

Provide training sessions on these tools to the beginners and clarify all their queries

Voila, you are an automation tester!!!!

Skills needed for Automation Testing

Skills needed for Automation Testing

As the software industry mature, delivery and operations team come closer for quick and seamless delivery. With the growth and strong practice of Agile based delivery which are followed throughout the software industry the need for reduction in testing life cycle without compromising the quality and coverage is necessary and thereby a lot of tightly integrated tools evolved in the past decade and skills needed for Automation testing also changed rapidly with the growing needs. This blog is going to describe the basic skills needed for Automation Testing irrespective of timeline.

Skills needed for Automation Testing

Software Testing tools evolved with the introduction of Record and Playback feature which mimics the user actions on the Applications under test. During initial days tools do not have additional features except with Application object management control. Software tester does not need programming expertise to utilize this tool.

Later tools evolved with the power of scripting language support where the Software tester would need scripting language knowledge and to understand the tool features like exception handling, regular expression along with basic framework creation capability.

2005 – 2010, many tools were introduced in the Market like Selenium which was backed by Programming language with OOPS conceptual support. Many Open source tools also come into play which needed programming language understanding along with complex framework creation. This needed a Software tester to have some development skills so that robust Automation scripts can be created.

There was a paradigm shift with the introduction and implementation of Agile adopted widely in the Software industry which necessitated the change of direction from testing to Business process validation and involvement of Business Analyst, Developers and Ops team to contribute to testing and TDD / BDD / ATDD evolved with continuous testing capability. These capabilities can be achieved only when Software Tester has a strong craving for programming. Roles like SDET came into play and DevOps as well evolved post-2010.

There was a need to do a release every fortnight and software testing timeline is shortened without compromising quality with increased testing coverage. This need necessitated the introduction of the scriptless tool in the market. Not only Record and Playback feature like the olden days, but also these tools come with DevOps capability with plug and play feature. This helped in increased automation productivity.

Future is going to be tools with AI and ML capability . This means a tester should have more Analytical skills, Mathematical knowledge along with the coding skills. With the industry evolved from normal web development to IoT, Mobile, Clouds, BigData, etc, Automation tester should have the understanding of Architecture of IoT devices, Clouds, etc along with Microservices which is evolving recently which sits in the middle layer to communicate between various devices.

Below are the Top-notch technology trends in 2020:

  • Hyper Automation (Automation tools with AI and ML capability)
  • Multi experience (Usage of Augmented Reality, Virtual Reality, multiple touchpoints, multi-channel touchpoint)
  • Cloud Infrastructure
  • Blockchain
  • IoTs

Analytical and Logical Reasoning:

This is one of the very basic requirements for any Automation Tester. This skill helps in breaking the problem into small packets and helps in coherently defining automation solutions. The more analytical and Logical reasoning skill an Automation Tester has the simpler and effective the solution he/she is going to give.

This helps in understanding the Business objective behind automation and helps in providing a solution to the team.

Domain Skills:

Whatever be the domain he/she is put up with, effective time should be spent in learning this domain. This helps in understanding the project in a better way and able to understand the scope.

Domain skills cover the following areas:

  • what is the business process involved in that domain
  • How the business outcome is measured in that domain
  • Who are the consumers involved and their skillset requirement (Operational Users related to this domain and their domain skills will help in understanding the End User perspective of that project)
  • What will be the future trend in that domain

Analysis should be done on External certification in that area and every Automation Tester should complete at-least basic external certification will help them in sustaining in that domain and be a better Automation Tester.

This skills helps in Automation Tester to play a crucial role in the team as nowadays with the reduction in team size, they will be the ever needed person for any project they work with.

Application Architecture:

With the understanding of Application architecture, Automation tester will play a crucial role in defining the right and long-lasting solution. Example ) The functional Testing team would have written Test cases for Web UI whereas underlying communication is done through Microservices which does the same functionality as UI. Automating Microservices is easy and stable and takes less effort as well. The understanding right solution to be targeted through Automation reduces the effort and helps Client as well in reaping the benefit of Automation.

This skill helps Automation Tester to enter as a Solution Architect.

Manual Testing:

This is one of the core skills required by any tester and is applicable for Automation Tester as well. Predominantly this helps in defining the data-driven approach and writing better re-usable to increase the coverage. It also helps in handling exceptions and reporting requirements in a better way. Every Automation Tester should work at-least in 1 Manual Testing project so that he can understand the Testing concepts and design principles in a better way which helps in Test effectiveness and efficiency. These skills help in writing better scripts with less maintenance effort.

Programming Language:

Since the underlying of any Automation tool is a language, every Automation tester should know at least one programming language. This skill in a language should be as good as a developer so that implementation will be better. Since most of the language is Object Oriented. Thorough knowledge of OOPS is a must and thorough implementation of all these OOPS concepts is a must. In order to evolve as an Automation Solution Architect, at-least 3 programming language with the skillset of a developer is a must Below is the trend in 2020 (Java, Python, JavaScript, Angular JS) and should aim to acquire this skill.

Knowledge of DevOps:

In the era of Continuous Testing, this knowledge is a pre-requisite for any Automation Tester.

Below are the core areas which Automation Tester should have an understanding

How to source control works. (Extensive knowledge on GiT, SVN, TFS tools and working knowledge of Distributed and Centralized source control is mandatory)

Knowledge of Development paradigm (Automated code review, Build creation, Build deployment, Build Monitoring and Release Management) helps an Automation Tester to sync up easily with the developers and communicate in a better way.

Automation Framework

Automation Framework should be stable and scalable to meet DevOps demand and hence building a robust Framework is a must

Handling data (Based on DevOps implementation there could be a limitation in tool infrastructure and knowledge on better data management like alternatives to Excel as XML or JSON skills are needed. A framework should have this capability

Test Management interface (Interfacing with Test Management for any Automation Framework is a must to have skills, knowing Test Management API calls can help in communicating with different modules of Test Management tools and helps in interfacing part)

Agile

Last but not the least, knowing Agile is a must. More than 80% of the project across the world uses Agile in their project and is now a must to know. Different techniques like Scrum, Lean, Kanban, XP, FDD are some of the popular Agile practices in the world. Every Methodology has different techniques of Estimation, gather requirements, defining scope, creating a backlog, etc. Awareness of these is a must.

Softskill

So far we have talked about Technical and Functional skills and now is the time to discuss soft skills needed for any Automation Tester

Oral and Written Communication skill (Within a team, with Management and with Client stakeholders)

Should be flexible to take up more work and adaptable to situation

Problem-solving skills

Team player (Able to gel well with the team)

Should be dependable and Trustworthy to sustain in the project

Managing self (Few areas like Time Management, Work-Life balance) is very critical

Windows Application Testing using FlaUI

Windows Application Testing using FlaUI

It is an Open-source UI based automation library to test your application which runs on Windows OS. It wraps almost all of the libraries used in the Microsoft UI Automation Test Library. We can use FlaUI libraries to automate win32, WinForms, WPF and Windows Store apps.

The below are the libraries provided by FlaUI, we will see the uses of those libraries against each one of them:

FlaUI.core – This Library will has base elements used in the concrete implementations of FlaUI.

FlaUI.UIA2 – This Library is used to automate win32 and winforms applications.

FlaUI.UIA3 – This Library is used to automate WPF and windows store apps.

Prerequisites: – You should have Visual Studio IDE installed in your machine.

Installation of FlaUI:

1. Create a New Project in Visual Studio

2. Right-click on the project and select “Manage NuGet Packages” (Using NuGet Package Manager)

3. Select the ‘Browse’ tab and Search for FlaUI, it will display the FlaUI libraries.

4. Install the below libraries from NuGet package manager

FLAui.core, Flaui.uia2, Flaui.uia3.

NOTE: The downloaded libraries are limited to the project, which means it is not available by default for all projects.

How to launch the application using FlaUI:

1) To start testing one should implement the static method “Launch” from the “Application” class which is available in FlaUI.Core library.

2) You should pass the application path (the application you installed in your machine and you want to automate) as a parameter to the Launch method as given in the below example.

Example:

var msApplication = Application.Launch(@"C:Program FilesMicrosoft OfficeOffice16WINWORD.EXE");
var automation = new UIA3Automation();
var mainWindow = msApplication.GetMainWindow(automation);
  

The above code tells you

1. How the launch method is implemented using the Application class, and how the application path is passed as a parameter (First Line).

2. In the second line, we are specifying the Automation Library Type (UIA3) used to automate the app.

3. The third line describes getting the main window instance from the application instance.

Searching an Element in the Application:

1) To find the element in the application, we need to specify the treeScope of the AutomationElement.

2) We can specify the AutomationElement by providing conditions like ConditionFactory, ControlType, and action to be performed as explained in the below example.

ConditionFactory cf = new ConditionFactory(new UIA3PropertyLibrary());
mainWindow.FindFirstDescendant(cf.ByName("Text Editor")).AsTextBox().Enter("FlaUI Tutorial");
  

Code Explanation:

1. The first line is creating the “ConditionFactory” instance, the “ConditionFactory” is the class from “FlaUI.Core”, “ConditionFactory” identifies the element based on the condition.

2. We are specifying the TreeScope {FindFirstDescendant()}, ConditionFactory{ByName()}, ControlType {AsTextBox()} and action {Enter()} of the automation element.

The above helps us to install FlaUI and run an application. We must know how to inspect an element using FLAUInspect. We need the Chocolatey package manager to install Flauinspect, we will see the step by step process of the implementation below.

1. Chocolatey is the package manager for windows. The Flauinspect is a package under the Chocolatey package manager. So it is mandatory to install Chocolatey to inspect the AutomationElement.

2. Go to https://chocolatey.org/install and follow the instructions to install Chocolatey.

3. After installing chocolatey, run this command “choco install flauinspect” in command prompt to install Flauinspect.

4. To launch Faluinspect, run this command “flauinspect”, it will open the Flauinspect application.

Working with Flauinspect:

There are three ways for inspecting an element

Open Flauinspect > go to “Mode” >

1. Hover Mode (Press ctrl and move your mouse pointer focus on the target element)

2. Focus Tracking ()

3. Show XPATH, (combine with any mode listed above) and it will show only the absolute XPath.

Capture Screenshot with FlaUI:

Flaui provide a “Capture” class for the screenshot

Capture.screen();
// It will capture the full screen

Capture.Element("That Element ");
//It will capture the specific element 

Capture.Rectangle("Specify the height, width and length")
//It will capture the specific block you specified in the parameter.
  

We can store the screenshot in a file by using the below lines of code:

var image = Capture.Screen();
image.ApplyOverlays(new MouseOverlay(image.DesktopBounds));
image.ToFile(@"c:tempscreen.png");
  

NOTE: ToFile(“Your_Location”) method can be used to store the screenshot in a user-specified location.

Perform Mouse Action using FlaUI

The Flaui provides the Mouse Class with different methods as follows:

1. Mouse left click

Mouse.LeftClick();
// left click where the mouse pointer is currently pointed to.
  

2. Point

Point point = new Point(2435, 234 )
// This will provide the location of the mouse pointer (X-axis and Y-axis).
  

3. Middle Click

Mouse.Click(MouseButton.Middle, point);
  

4. MoveTo and MoveBy and Position

Mouse.MoveTo(point)
// Will position the mouse pointer to the New location
Mouse.MoveBy(point)
// it will take the current location and add the point specified in the method then drag the mouse to the location specified.
Mouse.Position(point)
// the traces of the mouse pointer are not displayed.
  

5. Scroll

Mouse.Scroll(10)
// positive value to scroll up ; Negative Value to scroll down

Mouse.HorizontalScroll(40);
Mouse.VerticalScroll(30);
  

Perform Keyboard Action using FlaUI

To perform any action the application via Keyboard, the FlaUI provides the Keyboard class with the following methods:

Keyboard.Type("Hello Flaui");   // for a string
Keyboard.Type(VirtualKeyShort.Key_B, VirtualKeyShort.Key_C);
Keyboard.Press(VirtualKeyShort.BACK)  // backspace

//For Combinations of multiple keystrokes (To press a key and release a key)
Keyboard.Pressing(VirtualKeyShort.CONTROL);
Keyboard.Press(VirtualKeyShort.Key_A);
Keyboard.Release(VirtualKeyShort.CONTROL);

//Another Way for the combinations key
Keyboard.TypeSimultaneously(VirtualKeyShort.CONTROL,VirtualKeyShort.KEY_A);

  

NOTE: VirtualKeyShort is available in “FlaUI.Core.WindowsAPI” package

How to highlight the element in FlaUI:

Flaui provides the “DrawHighlight” method which will highlight the AutomationElement.

Automation_Element.DrawHighlight();
  

Thank you for reading the above article, we would love to hear your comments. Please write to us if you face any issue in using FlaUI, we are happy to help. Happy Testing!


Frequently Asked Questions

  • What is FlaUI?

    FlaUI is an open-source .NET library based on the native UI automation libraries of Microsoft that can be used to automate UI-based testing of Windows applications such as win32, WinForms, WPF, and Windows Store apps.

  • Is FlaUI open source?

    Yes, FlaUI is indeed an open-source UI-based automation library that can be used to perform Automated UI testing of Windows applications such as win32, WinForms, WPF, and Windows Store apps.

  • How do I install the FlaUI library?

    1. Create a new project in Visual Studio.
    2. Right-click on the project and select “Manage NuGet Packages”.
    3. Select the ‘Browse’ tab and Search for FlaUI.
    4. Install the FLAui.core, Flaui.uia2, Flaui.uia3 libraries.

Automation Testing Tools We Use

Automation Testing Tools We Use

We at Codoid use various automation testing tools. In this blog article, we would like to share the tools that we use and why. As a Test Automation Services Company, using multiple test automation tools/libraries has become inevitable for us to address automation testing challenges. If you don’t know how to use a tool, then your output will be a mess. In-depth knowledge of various automation testing tools is must to deliver high quality automated test scripts. Let’s see the tools we use for automation testing.

Web Application Automation Testing

For web application automation testing, we use Selenium WebDriver & Protractor. Python, Java, C#, and JavaScript are the programming languages which are predominantly used to write test automation scripts. To enable effective collaboration with the clients’ SPOC, Gherkin steps are written using Cucumber and Behave BDD frameworks. Our Automation CoE Team suggests Selenium best practices periodically to produce quality automated test scripts.

Desktop App Test Automation

To automate desktop app test cases, we use White Framework and Test Complete. White Framework is an open source library to automate desktop applications. Automating a desktop application using White Framework is no cake walk. It requires in-depth knowledge on White Framework, Win32 API, and C#. As an automation testing company, we have helped our clients to automate their Desktop test cases using both White Framework and Test Complete.

Mobile App Automation Testing

For mobile app automation, the best choice is Appium. Once the automated test scripts are ready for mobile app test cases, we run them on cloud real-devices using BrowserStack and Kobiton platforms.

Big Data Automation Testing

Firing all the validations SQL queries manually on daily basis is a boring task for a tester. We have setup an automation testing framework using Python and LemonCheeseCake library to compare source and target data. If your team needs any help in automating data quality validations, contact us to explore our test automation solution.

In Conclusion

The most apt automation testing tools will invariably lead to successful test automation. As a leading software testing services company, automation testing is one of our core services. continuous learning and following up automation best practices help us to deliver robust test automation suites to our clients efficiently

Everything you need to know about Test Automation and Microservices

Everything you need to know about Test Automation and Microservices

Microservices are important to the companies who want to build and deploy systems that are scalable, flexible, adaptable, and easy to develop. Automation tests are therefore needed to take things to live regularly. Microservices are modular and independently deployable as small composable components and thus are separately testable. As testing scales up from small independent microservices through integration and end-to-end testing to larger services ecosystems, it influences the testing pyramid.

So what is a Microservice?

Microservices is a part of software architecture. It involves developing single applications that can work together as a suite of small services, each running its process while communicating with HTTP resource API mechanisms. They require minimal centralized management systems and various data storage technologies and are written in multiple programming languages.

Service-Oriented Architecture (SOA) vs. Microservices

An SOA model is a dependent Enterprise Service Bus (ESB), whereas ‘Microservices’ use faster mechanisms. SOA focuses on imperative programming, and microservices use a responses-actor based programming style. SOA models also have outsized relational database management systems, yet microservices databases like NoSQL or micro-SQL connect to conventional databases. We can conclude that the architecture methods thus differ in how each creates an integrated set of services.

Service layer and test automation API Tests

Deploy multiple versions of service API’s in parallel and make sure that the version number appears at the endpoint address. When we create a microservice, service layer testing is complemented with API tests.

Let’s discuss five approaches to automation tests for microservices.

Unit testing

It is internal to the service and is the largest in terms of volumes. It should be automated based on development language and framework. Written at unit level or collection of units as the goal is to check parts of the software to validate for functionality.

Contract testing

It treats each service individually and independently call them to verify their responses. It also reframes testing principles and maps it to service layers of a testing pyramid. Considered a cost-effective substitute for integration tests.

Integration testing

Perform verification of the services that have been individually tested and check the functioning of inter-service communications. It validates if the system works seamlessly and that the dependencies between the services are present as expected. Limit the volume of full integration tests and write layer integration tests to ensure proper integration.

End-to-End (E2E) systems testing

E2E testing verifies if the entire process flow works correctly and includes all service and database integrations. Frameworks help automate functional testing by checking that the system behaves as expected when you deploy your application in a real-world environment.

Interface testing

User Interface (UI) testing is the final level of automation testing and checks the system in a
real-time end-user scenario before the application goes live.

The benefits of microservices in a large scale systems development is still contested. That’s why we recommend you install microservices only if a regular SOA does not meet your needs. If you are considering microservices, look no further than Codoid . As a test automation services company, we ensure that all testing is performed by the right set of qualified personnel to give the best quality output to our customers. Our testing tools accelerate testing for better productivity and shorter time to market. As automation tests are an essential requirement to create successful microservice architectures, we work together with our clients to help them deploy their products by giving them the best return on their investment with us.

Selenium Wait Commands using Python to Avoid False Positives

Selenium Wait Commands using Python to Avoid False Positives

We all know that Selenium has three wait types (Implicit, Explicit, and FluentWait). How to avoid false positives using Selenium waits? Applying wait for all FindElement steps using Implicit Wait is not a right approach. If you are automating a small website or writing some Web scraping scripts, you can go with Implicit Wait. However, if you are writing automated test scripts for an web application, then our recommendation is Explicit Wait. Moreover, Implicit Wait applies the wait time for the entire browser session and you can change the wait time during run-time, however, you can’t do it for individual FindElement method call. As an automation testing company, we use Selenium Explicit Wait to avoid false positives as much as possible. In this blog article, you are going to learn Selenium Wait Commands using Python.

Implicit Wait

As we mentioned before, use Implicit Wait for simple website or Web scraping scripts and don’t mix Implicit and Explicit Waits. When you automate a full regression test suite, it requires proper Page Load and AJAX call handling using Explicit Wait. Note: By default, Implicit Wait is disabled.

from selenium import webdriver
driver = webdriver.Chrome(executable_path='chromedriver.exe')
driver.get("https://codoid.com")
driver.implicitly_wait(10)
  

Visibility of Element Located

Checking the presence of an element in DOM will not suffice our need. In addition to that the scripts need to confirm whether the web element is displayed on the web page or not. Selenium Explicit Wait has visibility_of_element_located method to check whether the web element is available in DOM and Height & Width is greater than ‘0’. Most of the automation testers are aware of this method/technique. However for novice QA automation testers to write robust automation test scripts this will be a much useful tip. Your developers can hide web elements for different reasons using the below CSS attributes.

<input type="text" id="txt1" style="opacity: 0"/>
<input type="text" id="txt1" style="visibility: hidden"/>
<input type="text" id="txt1" style="display: none"/>
<input type="text" id="txt1" style="position: absolute;top: -9999px;left: -9999px;"/>
<input type="text" id="txt1" style="clip-path: polygon(0px 0px,0px 0px,0px 0px,0px 0px);"/>
  

Note: If any HTML tag is styled using clip-path, Selenium’s visibility check does not work. This may be an issue with Selenium. Let’s wait for the comments.

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as cond
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

driver = webdriver.Chrome(executable_path='chromedriver.exe')
wait = WebDriverWait(driver, timeout=10)

try:
    driver.get("http://google.com")
    wait.until(cond.visibility_of_element_located((By.NAME,"txt")))
except TimeoutException as e:
    print("Timed Out")
finally:
    driver.quit()
  

Wait for JavaScript Alert Presence

JavaScript Alert will pops out on your web browser after its invocation. One should use wait mechanism while handling JS Alert to avoid script failure. Sometimes, due to Ajax call response delay, JavaScript Alert invocation will also be delayed. However, your automation script should wait for the expected delay to handle the alert.

wait.until(cond.alert_is_present)
  

Selenium Explicit Wait using Lambda Expression

You can also use Python Lambda Expression to simplify the Selenium Explicit Wait commands.

elemnt = wait.until(lambda d: d.find_element_by_id("txt"))
elemnt.send_keys("Codoid")
  

In Conclusion

As a leading test automation services company, we at Codoid follow best practices to develop robust automation testing scripts. We hope you have learnt the nuances of Selenium Explicit Wait techniques to avoid false positives from this blog article. Contact us for your automation testing needs.