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
10 Most Useful Python Test Automation Tips

10 Most Useful Python Test Automation Tips

As a software testing services company, we encounter many test automation challenges. In this blog article, we would like to list a few useful Python Test Automation Tips, With the hope that you will bookmark this article for future references.

Installing PIP on Windows

Installing PIP on Windows is a simple task and an One-time activity. When you are setting up a test bed for test automation scripts execution, you need to recollect the steps to install PIP on Windows.

Step #1 – Download get-pip.py

Step #2 – Run get-pip.py

python get-pip.py

Virtual Environments on Windows

Installing, creating and activating a Python virtual environment is pretty straight forward. On the contrary, when you play around with multiple OS, you must be aware of the fact that there are different steps involved to activate a virtual environment on Windows.

Step #1 – Install virtual environment package

pip install virtualenv

Step #2 – Create a virtual environment

python -m venv newenv

Note: In the above command, newenv is the environment name.

Step #3 – Activate the virtual environment. Go to the virtual environment folder on Command Prompt, navigate to ‘scripts’ folder, and run ‘activate’ command.

Creating requirements.txt

Managing the required Python packages in requirements.txt is a best practice. If you have already installed the required packages and want to create requirements.txt, then run the below command.

pip freeze > requirements.txt

Note: Once the command is executed successfully, it creates the requirements.txt with the list of installed packages.

Behave JSON Report Generation

If you are using behave BDD framework and would like to generate JSON report after automated script execution, then kick-off the behave execution using the below command.

behave -f json -o reports.json

Customized PDF Report Generation

Publishing readable and useful report is one of the important test automation success factors. You can create customized PDF report using behave JSON report. Refer the following URL for more details – Customized Test Automation PDF Report. You can create PDF report as shown below using pdf_reports package & Pug template.

Customized Test Automation PDF Report

Python Selenium Headless Chrome

Starting Chrome in headless mode using Selenium WebDriver can be done using ChromeOptions. Refer the below Python snippet.

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(executable_path='chromedriver.exe',chrome_options=options)

Behave Teardown

In most of the BDD frameworks, you need to write setup and tear-down in two different methods. However, in behave framework, you can write both in one method. Refer the below snippet.

from behave import fixture, use_fixture
from selenium import webdriver

@fixture
def launch_browser(context):
    #Launch Browser
    context.driver = webdriver.Chrome(executable_path='driverschromedriver.exe')
    print("=============>Browser is launched")
    yield context.driver

    #Clean Up Browser
    context.driver.quit()
    print(context.scenario.duration)
    print("=============>Browser is quit")

def before_scenario(context,scenario):
    the_fixture1 = use_fixture(launch_browser, context)

Network Throttling

In Selenium WebDriver, you can set network upload & download throughput and latency to run the automation testing scripts in different network conditions.

driver.set_network_conditions(
        offline=False,
        latency=5,  # additional latency (ms)
        download_throughput=500 * 1024,  # maximal throughput
        upload_throughput=500 * 1024)  # maximal throughput

Desktop App Automation Testing

Using pywinauto package, you can automate Desktop App Test cases.

from pywinauto.application import Application
app = Application().start("notepad.exe")

BuildBot CI

If you want to manage all CI related operations using Python code, you can try BuildBot CI.

In ConclusionAs an automation testing company, we use Python and Selenium WebDriver for multiple projects. We hope you have gained incredible insights about various test automation tips that’s has been shared in this blog article, As a continuing trend we will be keep sharing more and more useful automation testing related articles in the coming weeks.

Test Automation Effort Estimation

Test Automation Effort Estimation

Software testing ensures your product meets all customer requirements and addresses each product risk with a proper test plan. Testing can uncover failures of many kinds, and in today’s agile world, automation testing is a part of the work to be done for the story and the benefit of test automation is quite obvious. A properly planned testing process is a must for ensuring the required level of software quality without exceeding a project’s time and budget.

What is Effort Estimation and why is important

Testing is no longer a one-time task but a continuous process. An estimate is a prediction, it could be an approximation of what it would cost, or a rough idea of how long a task would take to complete. Better testing estimates allow for more accurate scheduling, realize results more confidently, and form the foundation of good management credibility.

What are the factors affecting test automation estimation in agile

Estimating testing in the contemporary world of agile and DevOps demands some new rules. Stories with dozens of tasks that lack the value definition for intended users is not helpful. One need to consider the effort required for test design, test implementation, test execution, and the effort to automate while estimating the story. Especially when you are conducting an automation testing to reduce the cost and time, you should consider the below estimation techniques.

Scope

Scope usually means finding the right test cases for automation. The deciding factor for any test to be automated is linked with how many times that particular test can be repeated. When new functionalities get added or if there exist any modification in existing functionality then the automation scripts need to be added/ modified, reviewed and maintained for each release cycle.

• Split the application into separate modules and analyse each module to determine possible testing options

• Prioritize the list of modules and assess the history of each and every test case (as many of the test cases may not have been run often enough to get into the right priority)

• Analyse and classify the Test cases into various categories like API, Web, DB etc and choose the ideal candidate for automation

• Identify the complexity of the test case like Number of verification point or check points for each of the test cases

• Calculate the ROI for the identified test cases

Supporting Tools

Selecting an automated testing tool is essential for test automation. There are plenty of automated testing tools available in the market, it is important to choose the automated testing tool that best suits your overall requirement. Consider the below factors when selecting the automation tools

• Understand your project requirements and identify the scenarios you want to automate.

• Finalize the budget for automation and search the tool that suits your requirement.

• Compare and choose the tools that fall well within your budget and easy utilisation.

• Check for Logging and Reporting mechanism

• Underlying language which is used to build automation script and check for the feasibility of integrating with the build tools

Below is the combination of tools selection for framework development:

1. Eclipse / RAD – as IDE

2. Ant / Maven – As build tool

3. jUnit / TestNG – as unit test framework

4. Log4j – as Logger

5. ReportiNG – as reporting tool

6. Text files – for tracking the environments/credentials

7. Excel files – for tracking the test data

8. Perl / Python – for setting up an environment and triggering the test scripts.

Framework Implementation

Framework implementation means designing input files like Excel / JSON / XML etc, designing folder structure, implementation of logger, utilizing build tools and environment related data and credentials.

Framework means a real or conceptual structure created to provide support or guidance to an entity that could expand in future. In simple terms, a test automation framework can be defined as a set of processes, standards and interactions between the components in which scripts are designed and executed. While implementing a framework one should consider handling scripts and data separately, reuse of code, high extensibility, library creation and maintainability.

We are detailing out the below variables and calculation methods that helps in estimation:

Test Case ComplexityWe classify the Test case based on the complexity of the Test case and the complexity of the test case is based on four elements including checkpoint, precondition, test data, and types of test case, which effectively assumes that the complexity is centred at these four elements. Below is the complexity assignment of the test case.

Test Case Complexity

Transactions are measured while hitting /submitting a page / screen. In an ideal scenario a simple Test case should have less than 2 submits or it covers less than 2 navigations from a page. When we read the Test case, we focus on these navigations to calculate the Test case complexity.

Interface complexity

Interface complexity

Estimators view and review the user interfaces, API, DB and network to measure the accuracy of the interfaces in providing the service. This complexity describes the external integration/interfaces that are associated with the proposed software. These integrations could be hardware, software, network and communication based on the deployment of the proposed software.

Verification Points

Verification Points are used to verify whether the value of an Application Under Test matches with the expected value. This output value can be considered as input data for other verification points. The complexity is measured using the Test Conditions, Test Data identification, Test Script preparation and Test Execution.

Listed below are the other variables which we need to consider while estimating

QA Automation Estimation

While it is quite obvious that the strategic goal of automation testing is to ensure business value, it is just as essential to articulate it periodically to stakeholders on where we stand in the journey towards it. This can be projected in two broad areas – savings in terms of time and cost. Our estimation approach must be dynamic and responsive to changing requirements with the various variables and components described above and the effort is calculated based on test design, test implementation, test execution, and the effort to automate. I hope this will give a head start to those who are seriously considering to calculate the automation testing effort estimation.

XPath vs CSS Selectors

XPath vs CSS Selectors

by | Jun 17, 2020 | Automation Testing, Fixed, Blog | 0 comments

XPath vs CSS Selectors is a captivating subject for any automation test engineer. Sometimes, teams try to convert their locators from XPath to CSS Selectors with the objective of achieving better improvement in script execution. We, at Codoid, focus on robust automated test script development to avoid false positives and negatives. Object locating performance is our next priority. If you have technical know-how of CSS Selector & XPath work, then you can write concrete object locators within a short span of time by revisiting locators thereby improving your scripts performance.

Let’s say for instance if all the XPath locators have been converted to CSS Selectors. You might have a false perception that you have accomplished something and your scripts will run fast now, which is not the case in real time. If you are not familiar in writing CSS Selector effectively, then your CSS locators won’t outperform XPath locators.

How CSS Selector selects an element

You normally write a CSS Selector from left to right. Wherein your browser parses the other way round i.e. from right to left. This is a very vital concept one needs to understand to write robust and performant CSS Selectors with ease. Always provide Class or other important locating information to the right most CSS Selector clause since your browser starts evaluating the CSS Selector from right to left. Try not to provide only tag name to right most selector clause. In case if you have provided only anchor tag to the right most clause. The parser evaluates all the anchor tags in HTML DOM to narrow down the particular anchor tag from the parent information. That’s why we insist you to provide more information to the right most clause.

Let’s say you want to locate two anchor tags which is inside the DIV tag in the below diagram. You can write the following CSS Selector – div a As we mentioned before, browser needs more information for the right most clause to identify the object quickly. As per div a CSS selector, it will parse all the anchor tags and subsequently locates the two anchor tags based on the parent information. If you provide more information for anchor tag clause, then your CSS Selector will identity the objects quickly.

XPath vs CSS Selectors

How XPath works

XPath locates an element from left to right. That’s why we see some performance latency. However, XPath can traverse between descendant to ancestor and vice versa. XPath is powerful locator to identify dynamic objects. For example: if you want to identify parent nodes based child node information, then XPath will be the right choice.

In Conclusion

We, as an automation testing company, follow test automation best practices to create robust automated test suites. Whether it is XPath or CSS Selector, we recommend you write it effectively and eventually focus on how to avoid false positives & negatives than spending time in improving object locating performance at micro level.

Automation Testing Best Practices and Tips

Automation Testing Best Practices and Tips

by | Mar 13, 2020 | Automation Testing, Fixed, Blog | 0 comments

As we all know that the importance of automation in the IT industry revolution is in pinnacle. If we just hold breathe and ask ourselves a question as to why? Due to its high accuracy of executing the redundant things, reporting results and it needs no or less human intervention hence the cost that a company spends on a resource is relatively reduced in a long run.

Whilst it’s true that the automation is so much beneficial in terms of bringing accuracy in and cost savings to the company, it is also true that if at all the planning and implementation is not taken utmost care it equally gives the negative results

So, in this blog, we are going to talk about the automation best practices.

Understand the application technology then identify the tool

Before we kick start with automation, there has to be a lot of groundwork to be done from the application perspective. Thorough understanding of Application development infrastructure like

What technologies are being used to develop

It’s front end

Business logic

Backend

This will help us identify the tool that best fit for the application which in turn helpful for hassle-free test automation implementation.

Eg:- if at all the application front end is developed with angular js then protractor is preferred to selenium because it’s not possible for selenium to deal with some of the locators.

Determine the type of automation tests. We need to identify what types of testing to be performed on the application then do a feasibility study to proceed with automation. When we say types of test we are dealing with two things

Levels of testing

This is a conventional test approach in almost all the projects, that first unit testing then integration testing followed by system testing. In this testing pyramid as we reach from the top to the base we intensify the test process to make sure there are no leaks, in the same fashion we need to ensure that each level of these tests are automated as well.

Unit tests

This is anyways done by the development team, these tests are automated most likely in the process of building and deployment process. Automated unit tests can give us some confidence that all components are running properly and can further be tested.

Integration tests

It’s well known that Integration tests are performed after unit tests. In the recent agile model in order to conduct parallel testing alongside development activities, we need to consider automating the integration tests as well
These tests come under the classification API and involve verifying the communication between specified microservices or controllers. UI might not have been implemented by the team we perform this.

System testing

System tests are designed when the system is available, in this level we deal with writing more number of UI tests which would deal with the core functionalities of the application. It adds great value when we consider these tests for automation

Types of tests that can be automated

UI layer tests

User interfaces the most important piece of the application because that’s what exposed to the customer, more often than not business focuses on automating the UI tests. Alongside doing in sprint automation leveraging the regression test suit gives a great benefit.

API layer tests

We should be relying on UI tests alone, given their time-consuming factor. API tests are par quicker than UI tests, automating tests in this layer will help us confirm the application stability without UI. This way we can conduct some early testing on the application to understand any major bugs earlier.

Database tests

Database test automation adds a great value to the team when there is a need to test new schema or during data migration or to test any quartz job that runs in the DB table.

Conduct feasibility study diligently to deem the ROI

While bringing automation into the testing process is essential, it is also very much needed to do an analysis to understand the return on investment factor. Jumping on to automate everything is not a good approach. A proper understanding of the application then taking a decision on the tool and framework selection is recommended.

Failing to conduct feasibility study will lead to problems like weak scripts with flakiness, more maintenance effort.

Points to Consider as a best practice for Automation

Choose the best framework

Choosing a suitable framework is part of a feasibility study. Based on the agreed test approach such as TDD- test-driven development or BDD- behavior-driven development, framework selection, and implementation should be taken into consideration

It’s recommended to go with the BDD framework approach considering the current agile methodologies. As the spec file which can be understood by any non-technical professional drives the test case, its quite easy to follow and define the scope of any test case in the application.

Separate tests and application pages code

In test automation while designing the tests, it’s essential to write test cases and the application pages method. This kind of page factory implementation helps us to get rid of unnecessary maintenance. It’s expected that the application screens likely be changing over cycles if at all the tests are not separated from pages we need to edit all the test cases even for a single change.

Showcase meaningful reports

The main purpose of test execution is to observe the results, be it manual testing or automated testing. Given the context, we need to integrate a reporting mechanism that should clearly state each test step with the corresponding results. When we share the reports to any business stakeholders they should find these meaningful and seem to capture all the correct information.

We have many third party reports being integrated to our test suites such as extent reports, allure reports, and testing reports. The choice of reporting tool should be based on the framework implementation. Dashboards should be very clear. Again BDD frameworks such as cucumber, the gauge would produce better Html reports and these are inbuilt.

Follow distinguishable naming convention for test cases

Not naming the tests properly is the silly mistake we ever do and its costlier. A good name given to the test case itself will speak for the functionality it checks for. This will also make the reports appear better as we are going to showcase the test case name and test case description in the report, it will also help the stakeholders to decipher the reports. Alongside naming the tests a meaningful name, it would be of great help if we can agree to a similar pattern for all test cases in test suit.

Follow the best coding standards as recommended

Despite the programming language when we are scripting the test cases it’s highly important to use the right methods and data structures. It’s not just recommended to find the solution but also to think of the best approach that reduces the execution time. Peer review and review by a senior or team leader in the team before it has been pushed to VCS system.

Here are some best practices when we say coding standards

Use try- catch blocks

Whenever we are writing any generic method or any test method we must ensure its being surrounded by try with possible catch blocks and as a good practice we must print a useful, relevant message according to the exception that’s being caught.

Use static variable to set some constant values

In any automation framework we certainly have some variables which we don’t want to change them at all it’s always a best practice to have them declared as static ones. One good example of this is web driver object is made as static variable.

Considering the scope of variables, we must consider declaring them. Global variables are recommended as we can use them in different methods as the test case executes

Generate random data and append to testdata

In recent times applications have become more advanced when it comes to the point of dealing with the data. In a data-driven test when we are fetching the data from an excel workbook, since the same test data is going to be used upon multiple runs, during the second run if at all application doesn’t accept the duplicate data, we need to supply another set of data. Instead, if we can just append a random number or an alphabet by using the java Random class, it serves the purpose.

Write generic methods

While designing the test automation framework and designing the tests, it’s very important to understand the common functionalities and write them as generic methods. Anyone in the team who is developing a new script needs to make use of these methods as much as possible and any new method that doesn’t exist can be added with the discretion of senior automation developer or team lead. Failing to implement this process will add so much of maintenance to the test code which is tedious.

Relevant comments to the code

Comments are much needed to any code snippet to help with understanding. It need not be a comment good documentation such as,

What exception is being thrown by the method upon failure?

What parameters it takes?

What it returns back?

Documenting the above things would give crystal clear understanding to any newbie who joins the team and there won’t be any hassles to kick start with script development

Using of properties files/ xml files in the code base

Instead of hard coding or supplying a few of the parameters required for a test such as a browser info, driver exe path, environment URLs, database connection related passwords, hostnames it would be good practice to have them mentioned in a properties file or any XML file, the one advantage is that, these files need not be built every time we trigger the execution. It makes the process a lightweight one also it is easy for maintenance.

Use of proper wait handling

On many occasions we see some of our tests will exhibit flakiness, its highly uncertain to find them why are they failing. If we ever conduct a proper triage we might end up answering ourselves that it has to do with waits. It’s better to go with implicit wait and wherever it’s required we can go with explicit wait so that we are not adding too much of execution time to the script. Unless there is a specific requirement it’s not recommended to use Thread.sleep

VCS system availability

When we as a team automating the application, it must have a version controlling system in place, so that we can manage the code changes and merge without any conflicts or re-works if all goes good under proper guidance. Having a VCS system is ideally recommended for any project that has automation test service.

Bring CI/CD flavor to test automation

DevsecOps is the buzzing thing in the industry in this era, this not just for developers to build the code and deploy but also for testing to automate the execution process, having this infrastructure will help set the execution on a timely fashion or with a particular frequency. We can set the goals as to what should be pre-execution goals and post-execution goals. It can also help the team with sending the reports as an email, the only job left is to analyze the results. This is one good thing to execute the regression tests with more frequency to ensure all functionalities work intact.

Capture screenshots upon failure and implement proper logging mechanism

As the test runs we need to capture the screenshots and have them in a specific directory as evidence. We can take a call whether or not screenshots required for all passed steps or only for failed scenarios based on the memory constraints. The screenshot can further be used share with the development team to understand the error when we report that as a bug.

Also a good framework must write log files to a directory, in order to see the steps have been executed. Dumping these into a file would also help future reference.

Best practices are the things learned from experiences, so adopting them would help us developing and maintaining the automation framework easily and that’s how we pave a tussle free path for our daily routines, some part of this discussion can be a debated as well because in automation world we have many flavors of tools, applications and frameworks so probably there could have been different solutions. The best thing to remember here is, basis the need for analyzing and finding a solution then make it as a practice is recommended.

Hope there could have been some takeaways while thanks a ton

Feasibility Analysis in QA Automation

Feasibility Analysis in QA Automation

by | Mar 1, 2020 | Automation Testing, Fixed, Blog | 0 comments

In this blog we are going to discuss the software test automation lifecycle followed by the feasibility analysis that is required. The feasibility study is a must before taking any action with the automation since it is the deciding factor for automation sign-off based on the value that is going to add to the business.

Life cycle of Software Test Automation

Life Cycle in layman definition is the series of steps/changes that happens in a process to get the desired result.

Life cycle denotes the subsequent actions in a timely fashion. Below are the lists of things to be considered for test automation life cycle.

Feasibility study

Tool identification

Framework identification

Proof of concept

Test scripts design

Test scripts execution

Test scripts review

Feasibility analysis & its significance

As discussed at the start, the feasibility study is something without which we can’t judge the outcome of automation efforts also can’t identify the right automation candidate. This study helps the test team in the forecast on the following activities.

Can the application be automated or not?

What type of tool/ test automation framework can be used?

How much automation is possible?

In spite of high efforts, what’s the value add in automating?

Below are some key parameters while performing the feasibility study, let’s look into each one of them in brief

Feasibility study on the application and understand the functional flow

Before we proceed with automating any application, the automation tester must possess the knowledge of the application. Without having this understanding when any test scenario is considered for automation and we may get into several problems and the task either would be left incomplete or likely delayed.

As an automation tester the focus would be to gain sufficient functional knowledge, get the relevant test cases from the functional (manual) team then conduct feasibility analysis to know how many scenarios can be automated. If at all some cases can’t be automated there must be a valid rationale and the agreement with the stakeholders must be taken.

The analysis helps the test team to showcase their deliverables because after thorough examination team will be in a position to understand what will be covered in automation and how long they require to complete them. Failing to conduct this study could lead to irksome state.

Feasibility study in tool selection

We must conduct a careful study before finalizing the tool. The key points to be considered are

Whether or not the tool can detect all the objects of an application?

The tool that we are going to use for automation must be able to locate all the elements of the application as the locators are the key for the script to interact with the application elements

In case of selenium, we rely on Xpath, CSS selectors, name, Id..etc

If the case is to automate the windows application then selection of a tool that can interact with windows must be chosen

Eg: Coded UI – can locate the windows much better.

Whether or not the tool is best compatible with the application technologies?

There should be a sample POC conducted with all the list of proposed tools to automate the applications then decide which one should be of the good match by considering the application development technologies and its compatibility with the tool.

Eg: while selenium is used to automate all the java, .net, PHP oriented applications, it’s essential to opt for protractor when the application front end is mainly designed with Angular JS. Because angular elements can’t be caught with selenium

Whilst choosing the tool, the cost that would be required for investment should be taken care of. If at all there is a tool exists which does the job w/o any degradation of quality we can fairly go with that as that’s going to add a lot of savings, which will eventually prefer to get better ROI.

Community that’s available for that tool, should be given the importance to an extent as that helps in troubleshooting some of the issues we see in our daily routines.

More the community more preferable the tool is

Feasibility study on framework development

Once the tool choice has come to a conclusion, the next step is to perform the study on framework piece. It should be chosen in a way that the tool supports also it should be quite generic. It should give us better reports to analyze the results

A POC has to be conducted, then after observed the results, we must think of coming up with more reusable components. We might take a lot of hours of time than what is really required for manual validation. But in the long run, as we pass by different phases, the suite adds a lot of value since the execution time will come down to a great level.

A proper check on the regression scripts and baselining them is needed as well because that helps to add more coverage.

Feasibility study on test strategical approach

When it comes to the test approach, the business should take a call whether what between the below strategies should be followed.

Test driven approach

This approach is first to write the tests and then try to accomplish the fix for it. This would be a sophisticated approach and it’s not that easy for non-technical stakeholders to decipher properly. This is completely a call taken by the business based on their budget and other parameters that make sense for a project.

Behavior driven approach

This is buzzing in recent times, as the progress is made by documenting the task in plain English then try to map them with the technical actions. This gives more insight into what a particular test case was written for, what validations are performed. This business model delivers a better report than the above model.

Eg: Cucumber, Specflow, Gauge..etc

Feasibility study on infrastructure availability

In order to proceed with hassle-free automation the test team must not have any issues at infra level, the possible issues that might fall under this category are

Not having access to create project/ branch in a chosen configuration management tool

Not having access to the application/ DB servers to work independently

Software license procurement by the business

Network availability and kind of access to Application, which will delay the execution and cause failures at times

Not holding admin rights to perform certain tasks

The above-listed problems will prohibit automation activities from point to point. Test team must raise the access requests to all the needed things in the project and gain access.

Stable environment and a major part of development should be completed

As a test team we should know when to automate a particular application. If the build quality is at an infancy stage, we see the basic smoke tests are failing then there is no point in automating the test cases at that stage.

When we go for automation when the major development is in progress, we end up adding a lot of maintenance to the test suite as the UI locator elements might get changed often or at times there are some changes expected at functional level, then we may need to re-write the scripts as per new design which is tedious.

Assessing how much automation can be achieved

100% automation is fallacy! Given the complexities of whether or not they are technical or no-technical, that may occur during automation development.

As an automation tester doing this exercise helps the business understand the index of cost and effort saving. Ideally, this is achieved by comparing the functional test cases with the automation test cases. This metric defines what percentage of the tests has been automated and accordingly, the savings were understood.

Calculating the ROI metrics

Metrics are key numbers, which will denote the status, progress, outcome in various ways. As a test engineer/ development engineer when we bother about the accomplishment of tasks, but the management always looks at the numbers extracted as metrics. This is one short and explainable way of presenting data to understand where we are? What have we achieved?

In the same way, in automation world we have certain metrics to be calculated to project the savings to the business, following are a couple of quick examples

Automation savings

This is to understand how much time in man-hours and effort saved because of bringing in automation

Savings = Manual test efforts – Automation test efforts

Return on investments

Certainly we are investing during automation in the means of script development, managing talents and the cost of procuring the infrastructure that’s needed.

Cost of automation investments = Cost of talents + Cost of script development and maintenance + Cost of infrastructure.

Conclusion

More the ROI, the more the profits and that is what business needed as well. In order to achieve better ROI, we should focus on below

Try to bring in more automation

Focus of in-sprint automation development

Right choice of tools, which will incur no or as minimal budget as possible

Develop a generic framework with more reusable components, to avoid extra and often maintenance


Frequently Asked Questions

Customized Test Automation PDF Report

Customized Test Automation PDF Report

by | Apr 16, 2020 | Automation Testing, Fixed, Blog | 0 comments

Generating Customized Test Automation PDF report is a great value add to your team. Let’s say for instance if you wish to share a high-level automation test report with your business stakeholders. Then emailing the report as a PDF is a simple and viable solution. However, sending predefined report or technical information is insignificant and uninteresting to the business. As a software testing services company, we use different report templates for different audiences. In this blog article, you will learn how to create Customized Automation Testing report using Behave & Python.

PDF Report Package Installation

pip install pdf_reports
  

For Windows users: If you see OSError: dlopen() failed to load a library: cairo / cairo-2, then you need to install GTK+. Refer the following URL for more details – Install GTK+ with the aid of MSYS2

Generating Behave JSON Outputs

In this blog article, we are using behave framework JSON output to create PDF report. To create JSON report from behave, use the below command.

behave -f json -o reports.json
  

Consuming the JSON Output

Create a python file and paste the below code.

from pdf_reports import pug_to_html, write_report
import json
file = open(r'../reports.json')
json_report = json.load(file)
html = pug_to_html("template.pug", title1="My report", json_report=json_report)
write_report(html, "example.pdf")
  
Code Explanation

Line #1 & #2 – Package Imports

Line #3 – Opening the json output file which is generated by behave framework.

Line #4 – Loading the json file

Line #5 – Calling pug_to_html method to generate the PDF report.

Note – To generate the report, you need template.pug file. Please refer the pug_to_html method call, you can see template.pug file as one of the arguments.

Template.pug file

Pug is a template engine. The PDF_Reports package uses Pug to generate the PDF output. Let’s see how to create the template file in your project.

1) File Creation – Create & open template.pug file in your project

2) Report title – The below line creates an H1 tag and applies Semantic UI CSS.

h1.ui.header Behave Report
  

3) Sidebar – Creating sidebar in the report which enhances the look and feel.

#sidebar: p Test Automation Report
  

4) Iterate features from the json data

each feature in json_report
    if feature.keyword =='Feature'
        div.ui.piled.segment
            h4.ui.header Feature: {{feature.name}}
  

5) Iterate Scenarios

each scenario in feature.elements
  if scenario.type =='scenario'
  h5.ui.header Scenario: {{scenario.name}}
  

6) Iterate Steps

table.ui.olive.table
 thead
  tr
   th Step Type
   th Description
   th Status
   th Duration			
 each step in scenario.steps
  tr
   td {{step.keyword}}
   td {{step.name}}
   if step.result.status == 'passed'
    td.positive.center.aligned Passed
   else
    td.negative.center.aligned Failed
   td {{step.result.duration}}
  

7) Run the python file which is calling pug_to_html method. If the report is generated successfully, you can see the ouput as shown below.

Customized Test Automation PDF Report

Full Code
h1.ui.header Behave Report

#sidebar: p Test Automation Report

each feature in json_report
    if feature.keyword =='Feature'

        div.ui.piled.segment
            h4.ui.header Feature: {{feature.name}}
            each scenario in feature.elements
                if scenario.type =='scenario'
                    h5.ui.header Scenario: {{scenario.name}}
                    table.ui.olive.table
                        thead
                            tr
                                th Step Type
                                th Description
                                th Status
                                th Duration
                        each step in scenario.steps
                            tr
                                td {{step.keyword}}
                                td {{step.name}}
                                if step.result.status == 'passed'
                                    td.positive.center.aligned Passed
                                else
                                    td.negative.center.aligned Failed
                                td {{step.result.duration}}
  

In ConclusionThe above template is ( quite simple / very straightforward,) it does not have implementation to handle BDD Scenario Outline, Tags, and Screenshots. As an automation testing company, we use comprehensive Pug reporting template to generate PDF reports. Once the template is in place, you can create multiple reports for different audiences. For successful test automation, make your reports easily accessible to everyone in the team.