SlideShare a Scribd company logo
1 of 13
Download to read offline
Accessibility Testing using Axe
Accessibility Testing using Axe
© RapidValue Solutions 2
How to Achieve Accessibility Testing using Axe
You can achieve Accessibility Testing with the help of the following methods/approaches, using
Accessibility Testing engine Axe,
 Axe Browser Extension
 Axe Command Line
 Axe Core Library
Axe Browser Extension
This approach is a pretty straight-forward to perform the Accessibility Testing. Using the Axe browser
extension, you can directly analyse and see the violation details per web page. The Axe browser extension is
available for Google Chrome, Firefox and Edge browser. Following are the direct links to get the browser
extension based on your browser type,
 Google Chrome: https://chrome.google.com/webstore/detail/axe-web-accessibility-
tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US
 Firefox: https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/
 Edge: https://microsoftedge.microsoft.com/addons/detail/axe-web-accessibility-
t/kcenlimkmjjkdfcaleembgmldmnnlfkn
Here, the Accessibility Testing approach using Firefox browser has been shared for you. When you load the
above Axe browser extension in Firefox, you will get a page like this below,
Accessibility Testing using Axe
© RapidValue Solutions 3
You can add this extension and restart Firefox browser. In the next step, you can load the website that you
need to perform the Accessibility Testing and open the developer tool in the browser (press F12). Go to the
Axe tab and you can see below screen,
Click on the ANALYZE button to begin the test. After few seconds, you will get the result that includes
violation details, issue description, issue information, issue tags. You need to manually go through each and
every violation and share the details with development team to improve the accessibility of your website.
Accessibility Testing using Axe
© RapidValue Solutions 4
Axe Command Line
Axe Command Line approach is another way to test the accessibility and identify the violations. This can be
achieved with support of NodeJS and node package manager (npm). You must install NodeJS in your
system prior to start this way of accessibility testing. Once NodeJS is installed, one can install Axe-core by
the following command:
npm install axe-cli –g
This installs Axe globally and can be accessed from any folder in the file system. Once installed, to test your
web page, use the following command,
Axe web-page-url --timeout=120 --save results.json --tags wcag2a
The above command will test the page at the specific URL and save the results in a file called results.json.
The value of the time out can be changed. The tags option specifies the rules to be run. There are several
tags supported out of the box by Axe framework. For the above example, you are running the WCAG2.0
rules at level A. You can use the same website that used during Axe browser extension and see the output.
Axe www.rapidvaluesolutions.com --timeout=120 --save results.json --tags wcag2a
Accessibility Testing using Axe
© RapidValue Solutions 5
A detailed report is saved in file results.json (available in your system user folder). Open this file in a JSON
editor. Drill down to the violations attribute. The details of the Accessibility violations along with
suggestions for fixes will be seen.
Accessibility Testing using Axe
© RapidValue Solutions 6
Axe Core Library
This is one of the advanced approaches to perform the accessibility testing and identify the violations. In this
approach, you can use Axe core library and automate the accessibility testing in between your functional
regression automation. In the approach, you are using the Selenium dependency of com.deque.html.axe-
core, and analyse method of AxeBuilder class. Once you create Accessibility Testing suite, you can
configure in CI/CD pipelines for continuous testing.
Pre-requisites:
Following are the prerequisites to start Accessibility Testing,
 Install Java SDK 8 and above.
 Install Eclipse or IntelliJ IDEA IDEs.
 Following maven dependencies:
o testng
o selenium-java
o selenium-server
o selenium from the group com.deque.html.axe-core
o jackson-databind
o jackson-dataformat-csv
o poi-ooxml-schemas
o poi-ooxml
o poi
Accessibility Testing using Axe
© RapidValue Solutions 7
Step-by-step Approach:
Step 1: Create a maven project and add the above dependencies in pom.xml of the project.
Step 2: Create a Java class AccessibilityTestHelper to keep the logic to track violations. Implement
following methods:
 trackViolations – This is a public method that can be used in your test classes to track
the violations. In this method, you use analyze method of AxeBuilder class to identify
the violations. After that, create an excel file if not exist with help of createExcelFile
method. Once the file gets created, writing the violation details (violation id, description,
impact, help, help URL, and WCAG tags) into the file using writeToExcel method. Also,
there is logic to track violations in JSON and text files. The actual implementations are
below:
/**
* Method to track the violations using AxeBuilder support
*
* @author sanojs
* @param driver
* @param pageName
*/
public void trackViolations(WebDriver driver, String pageName) {
Results violationResults;
try {
violationResults = new AxeBuilder().analyze(driver);
if (!new File(System.getProperty("user.dir") +
"Results").exists()) {
(new File(System.getProperty("user.dir") +
"Results")).mkdir();
}
int j = 2;
String filePath = System.getProperty("user.dir") +
"ResultsAccessibilityTestReport.xlsx";
createExcelFile(filePath);
for (int i = 0; i < violationResults.getViolations().size();
i++) {
writeToExcel(filePath, pageName, 1, j,
violationResults.getViolations().get(i).getId());
writeToExcel(filePath, pageName, 2, j,
violationResults.getViolations().get(i).getDescription());
writeToExcel(filePath, pageName, 3, j,
violationResults.getViolations().get(i).getImpact());
writeToExcel(filePath, pageName, 4, j,
violationResults.getViolations().get(i).getHelp());
writeToExcel(filePath, pageName, 5, j,
violationResults.getViolations().get(i).getHelpUrl());
writeToExcel(filePath, pageName, 6, j,
violationResults.getViolations().get(i).getTags().toString());
j++;
}
AxeReporter.writeResultsToJsonFile(
System.getProperty("user.dir") + "Results" +
pageName + "_" + getCurrentDateAndTime(),
violationResults);
Accessibility Testing using Axe
© RapidValue Solutions 8
AxeReporter.writeResultsToTextFile(
System.getProperty("user.dir") + "Results" +
pageName + "_" + getCurrentDateAndTime(),
violationResults.getViolations());
} catch (Exception e) {
e.printStackTrace();
}
}
 createExcelFile – this is a private method that helps to create an excel file if not exists.
The file will be created at the project level. The actual implementations are below:
/**
* Method to create a new excel file
*
* @author sanojs
* @param filePath
* @return
*/
private XSSFWorkbook createExcelFile(String filePath) {
XSSFWorkbook workbook = null;
try {
File fileName;
FileOutputStream fos = null;
File file = new File(filePath);
if (!file.exists()) {
fileName = new File(filePath);
fos = new FileOutputStream(fileName);
workbook = new XSSFWorkbook();
workbook.createSheet("Instructions");
XSSFSheet sheet = workbook.getSheetAt(0);
Row header = sheet.createRow(0);
header.createCell(0).setCellValue("Accessibility
Testing Report");
XSSFCellStyle style = workbook.createCellStyle();
style.setBorderTop((short) 6);
style.setBorderBottom((short) 2);
style.setBorderRight((short) 2);
XSSFFont font = workbook.createFont();
font.setFontHeightInPoints((short) 15);
font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
style.setFont(font);
header.getCell(0).setCellStyle(style);
Row row = sheet.getRow(0);
sheet.autoSizeColumn(0);
sheet.autoSizeColumn(1);
row = sheet.getRow(1);
if (row == null)
row = sheet.createRow(1);
Cell cell = row.getCell(0);
if (cell == null)
cell = row.createCell(0);
cell.setCellValue("Please go through following tabs to
know the violations");
workbook.write(fos);
fos.flush();
Accessibility Testing using Axe
© RapidValue Solutions 9
fos.close();
workbook.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return workbook;
}
 writeToExcel – this is a private method that helps to write the violations into the created
excel file. The actual implementations are below:
/**
* Method to write the violations in a excel report
*
* @author sanojs
* @param sheetName
* @param columnIndex
* @param rowNum
* @param data
* @return
*/
private boolean writeToExcel(String filePath, String sheetName, int
columnIndex, int rowNum, String data) {
InputStream in = null;
XSSFWorkbook wb = null;
Sheet newSheet = null;
FileOutputStream fileOutStream = null;
try {
if (filePath == null || filePath.trim().equals(""))
throw (new Exception());
if (filePath.endsWith(".xlsx") || filePath.endsWith(".xls")) {
in = new FileInputStream(filePath);
wb = new XSSFWorkbook(in);
} else {
throw (new Exception());
}
if (rowNum <= 0)
throw (new Exception());
try {
newSheet = wb.getSheet(sheetName);
if (newSheet != null) {
throw new Exception("Sheet Already exist...");
}
newSheet = wb.createSheet(sheetName);
} catch (Exception e) {
}
int index = wb.getSheetIndex(newSheet);
if (index == -1)
throw (new Exception());
XSSFCellStyle style = wb.createCellStyle();
style.setBorderTop((short) 6);
style.setBorderBottom((short) 1);
XSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 15);
font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
style.setFont(font);
XSSFSheet sheet = wb.getSheetAt(index);
Accessibility Testing using Axe
© RapidValue Solutions 10
Row header = sheet.createRow(0);
header.createCell(0).setCellValue("Violation ID");
header.createCell(1).setCellValue("Violation Description");
header.createCell(2).setCellValue("Violation Impact");
header.createCell(3).setCellValue("Violation Help");
header.createCell(4).setCellValue("Violation Help URL");
header.createCell(5).setCellValue("Violation Issue Tags");
for (int j = 0; j <= 5; j++)
header.getCell(j).setCellStyle(style);
Row row = sheet.getRow(0);
if (columnIndex < 1)
throw (new Exception());
sheet.autoSizeColumn(columnIndex - 1);
row = sheet.getRow(rowNum - 1);
if (row == null)
row = sheet.createRow(rowNum - 1);
Cell cell = row.getCell(columnIndex - 1);
if (cell == null)
cell = row.createCell(columnIndex - 1);
cell.setCellValue(data);
XSSFFormulaEvaluator.evaluateAllFormulaCells(wb);
fileOutStream = new FileOutputStream(filePath);
wb.write(fileOutStream);
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
try {
wb.close();
fileOutStream.close();
in.close();
} catch (Exception e) {
}
}
return true;
}
 getCurrentDateAndTime – This is a private method that helps to generate current
timestamp that used suffix to the JSON and text files. The actual implementations are
below:
/**
* Method to get the current date and time
*
* @author sanojs
* @return
*/
private String getCurrentDateAndTime() {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
DateFormat timeFormat = new SimpleDateFormat("HH-mm-ss");
Date date = new Date();
String currdate = dateFormat.format(date);
String currtime = timeFormat.format(date);
return currdate + "_" + currtime;
}
Accessibility Testing using Axe
© RapidValue Solutions 11
Step 3: Create a TestNG class SampleAccessibilityTest with logic to start the driver session and
create a test case, let’s say accessibilityTesting. In the test case, you just need to load the browser
that you need to perform the Accessibility Testing and after that call the method trackViolations.
The actual implementations are below:
@BeforeClass
public void setUp() throws InterruptedException {
try {
ChromeDriverService chromeservices = new ChromeDriverService.Builder()
.usingDriverExecutable(new File("path to your driver
executable")).usingAnyFreePort().build();
driver = new ChromeDriver(chromeservices);
} catch (WebDriverException e) {
e.printStackTrace();
}
}
@Test
public void accessibilityTesting() {
try {
driver.get("https://www.rapidvaluesolutions.com/");
new AccessibilityTestHelper().trackViolations(driver, "Home Page");
} catch (Exception e) {
e.printStackTrace();
}
}
Step 4: Execute above test case and see the reports in the format of excel, JSON and text files. These
reports will be generated in Results folder of the project structure. Based on the above
trackViolations method, a sheet Home Page will be created in the excel report to track all the
violations. If you are using trackViolations method for different pages of your web application, it
will create new sheets to track the violations of your different pages. Below is the project structure:
Accessibility Testing using Axe
© RapidValue Solutions 12
Conclusion
Accessibility Testing is one of the important types of testing that add value to your business and deliver
user friendly applications. Axe Core is a very powerful framework that can help the team to build web
products that are inclusive.
In this article, different ways to test the Accessibility and the automation part have been discussed in full
length. Hope this throws some light on the concept of testing the Accessibility and the implementations.
Please try to utilize this while carrying out and utilizing Accessibility Testing.
By,
Sanoj S
Test Architect
Accessibility Testing using Axe
© RapidValue Solutions 13
About RapidValue
RapidValue is a global leader in digital product engineering solutions including mobility, omni-channel, IoT, AI, RPA
and cloud to enterprises worldwide. RapidValue offers its digital services to the world’s top brands, Fortune 1000
companies and innovative emerging start-ups. With offices in the United States, the United Kingdom, Germany and
India and operations spread across the Middle-East, Europe and Canada, RapidValue delivers enterprise services
and solutions across various industry verticals.
Disclaimer: This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No
part of it may be used, circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the
intended recipient of this report, you are hereby notified that the use, circulation, quoting, or reproducing of this report
is strictly prohibited and may be unlawful.
www.rapidvaluesolutions.com/blog
www.rapidvaluesolutions.com
+1 877.643.1850 contactus@rapidvaluesolutions.com
Disclaimer: This document contains information that
is confidential and proprietary to RapidValue
Solutions Inc. No part of it may be used, circulated,
quoted, or reproduced for distribution outside
RapidValue. If you are not the intended recipient of
this report, you are hereby notified that the use,
circulation, quoting, or reproducing of this report is
strictly prohibited and may be unlawful.

More Related Content

What's hot

Practical tools for Web Accessibility testing
Practical tools for Web Accessibility testingPractical tools for Web Accessibility testing
Practical tools for Web Accessibility testingToufic Sbeiti
 
Performance Testing using LoadRunner
Performance Testing using LoadRunnerPerformance Testing using LoadRunner
Performance Testing using LoadRunnerKumar Gupta
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Mobile Test Automation - Appium
Mobile Test Automation - AppiumMobile Test Automation - Appium
Mobile Test Automation - AppiumMaria Machlowska
 
Hands-On Mobile App Testing
Hands-On Mobile App TestingHands-On Mobile App Testing
Hands-On Mobile App TestingDaniel Knott
 
API Testing With Katalon Studio
API Testing With Katalon StudioAPI Testing With Katalon Studio
API Testing With Katalon StudioKnoldus Inc.
 
Test Strategy-The real silver bullet in testing by Matthew Eakin
Test Strategy-The real silver bullet in testing by Matthew EakinTest Strategy-The real silver bullet in testing by Matthew Eakin
Test Strategy-The real silver bullet in testing by Matthew EakinQA or the Highway
 
Designing, Developing & Testing for Accessibility
Designing, Developing & Testing for AccessibilityDesigning, Developing & Testing for Accessibility
Designing, Developing & Testing for AccessibilityEric Malcolm
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API TestingSauce Labs
 
Types of test tools
Types of test toolsTypes of test tools
Types of test toolsVaibhav Dash
 
Automated vs manual testing
Automated vs manual testingAutomated vs manual testing
Automated vs manual testingKanoah
 
Automation With Appium
Automation With AppiumAutomation With Appium
Automation With AppiumKnoldus Inc.
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With AppiumKnoldus Inc.
 
Appium basics
Appium basicsAppium basics
Appium basicsSyam Sasi
 
Automation testing introduction for FujiNet
Automation testing introduction for FujiNetAutomation testing introduction for FujiNet
Automation testing introduction for FujiNetHai Tran Son
 

What's hot (20)

Practical tools for Web Accessibility testing
Practical tools for Web Accessibility testingPractical tools for Web Accessibility testing
Practical tools for Web Accessibility testing
 
Performance Testing using LoadRunner
Performance Testing using LoadRunnerPerformance Testing using LoadRunner
Performance Testing using LoadRunner
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Mobile Test Automation - Appium
Mobile Test Automation - AppiumMobile Test Automation - Appium
Mobile Test Automation - Appium
 
Hands-On Mobile App Testing
Hands-On Mobile App TestingHands-On Mobile App Testing
Hands-On Mobile App Testing
 
API Testing With Katalon Studio
API Testing With Katalon StudioAPI Testing With Katalon Studio
API Testing With Katalon Studio
 
Test Strategy-The real silver bullet in testing by Matthew Eakin
Test Strategy-The real silver bullet in testing by Matthew EakinTest Strategy-The real silver bullet in testing by Matthew Eakin
Test Strategy-The real silver bullet in testing by Matthew Eakin
 
Designing, Developing & Testing for Accessibility
Designing, Developing & Testing for AccessibilityDesigning, Developing & Testing for Accessibility
Designing, Developing & Testing for Accessibility
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
Types of test tools
Types of test toolsTypes of test tools
Types of test tools
 
Automated vs manual testing
Automated vs manual testingAutomated vs manual testing
Automated vs manual testing
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Automation With Appium
Automation With AppiumAutomation With Appium
Automation With Appium
 
Test automation process
Test automation processTest automation process
Test automation process
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With Appium
 
Appium basics
Appium basicsAppium basics
Appium basics
 
Automation testing introduction for FujiNet
Automation testing introduction for FujiNetAutomation testing introduction for FujiNet
Automation testing introduction for FujiNet
 
Web Accessibility
Web AccessibilityWeb Accessibility
Web Accessibility
 

Similar to Accessibility Testing using Axe

Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work EverywhereDoris Chen
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web ApplicationsTed Husted
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questionsAkhil Mittal
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks TriviaCognizant
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applicationsqooxdoo
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
Serverless 프레임워크로 Nuxt 앱 배포하기
Serverless 프레임워크로 Nuxt 앱 배포하기Serverless 프레임워크로 Nuxt 앱 배포하기
Serverless 프레임워크로 Nuxt 앱 배포하기Changwan Jun
 
Ajax toolkit framework
Ajax toolkit frameworkAjax toolkit framework
Ajax toolkit frameworkSunil Kumar
 
Javascript-heavy Salesforce Applications
Javascript-heavy Salesforce ApplicationsJavascript-heavy Salesforce Applications
Javascript-heavy Salesforce ApplicationsSalesforce Developers
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsKai Cui
 
Cm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configurationCm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configurationdcervigni
 

Similar to Accessibility Testing using Axe (20)

Qa process
Qa processQa process
Qa process
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
 
Webpack
Webpack Webpack
Webpack
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work Everywhere
 
Qa process
Qa processQa process
Qa process
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web Applications
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Serverless 프레임워크로 Nuxt 앱 배포하기
Serverless 프레임워크로 Nuxt 앱 배포하기Serverless 프레임워크로 Nuxt 앱 배포하기
Serverless 프레임워크로 Nuxt 앱 배포하기
 
Ajax toolkit framework
Ajax toolkit frameworkAjax toolkit framework
Ajax toolkit framework
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Javascript-heavy Salesforce Applications
Javascript-heavy Salesforce ApplicationsJavascript-heavy Salesforce Applications
Javascript-heavy Salesforce Applications
 
Webdriver.io
Webdriver.io Webdriver.io
Webdriver.io
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensions
 
Cm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configurationCm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configuration
 

More from RapidValue

How to Build a Micro-Application using Single-Spa
How to Build a Micro-Application using Single-SpaHow to Build a Micro-Application using Single-Spa
How to Build a Micro-Application using Single-SpaRapidValue
 
Play with Jenkins Pipeline
Play with Jenkins PipelinePlay with Jenkins Pipeline
Play with Jenkins PipelineRapidValue
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinRapidValue
 
Automation in Digital Cloud Labs
Automation in Digital Cloud LabsAutomation in Digital Cloud Labs
Automation in Digital Cloud LabsRapidValue
 
Microservices Architecture - Top Trends & Key Business Benefits
Microservices Architecture -  Top Trends & Key Business BenefitsMicroservices Architecture -  Top Trends & Key Business Benefits
Microservices Architecture - Top Trends & Key Business BenefitsRapidValue
 
Uploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADIUploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADIRapidValue
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with KotlinRapidValue
 
Build UI of the Future with React 360
Build UI of the Future with React 360Build UI of the Future with React 360
Build UI of the Future with React 360RapidValue
 
Python Google Cloud Function with CORS
Python Google Cloud Function with CORSPython Google Cloud Function with CORS
Python Google Cloud Function with CORSRapidValue
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelRapidValue
 
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDDAutomation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDDRapidValue
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkRapidValue
 
Video Recording of Selenium Automation Flows
Video Recording of Selenium Automation FlowsVideo Recording of Selenium Automation Flows
Video Recording of Selenium Automation FlowsRapidValue
 
JMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeterJMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeterRapidValue
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4RapidValue
 
The Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QAThe Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QARapidValue
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsRapidValue
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon StudioRapidValue
 
How to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using ValgrindHow to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using ValgrindRapidValue
 
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueDevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueRapidValue
 

More from RapidValue (20)

How to Build a Micro-Application using Single-Spa
How to Build a Micro-Application using Single-SpaHow to Build a Micro-Application using Single-Spa
How to Build a Micro-Application using Single-Spa
 
Play with Jenkins Pipeline
Play with Jenkins PipelinePlay with Jenkins Pipeline
Play with Jenkins Pipeline
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
 
Automation in Digital Cloud Labs
Automation in Digital Cloud LabsAutomation in Digital Cloud Labs
Automation in Digital Cloud Labs
 
Microservices Architecture - Top Trends & Key Business Benefits
Microservices Architecture -  Top Trends & Key Business BenefitsMicroservices Architecture -  Top Trends & Key Business Benefits
Microservices Architecture - Top Trends & Key Business Benefits
 
Uploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADIUploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADI
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with Kotlin
 
Build UI of the Future with React 360
Build UI of the Future with React 360Build UI of the Future with React 360
Build UI of the Future with React 360
 
Python Google Cloud Function with CORS
Python Google Cloud Function with CORSPython Google Cloud Function with CORS
Python Google Cloud Function with CORS
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack Channel
 
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDDAutomation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
Video Recording of Selenium Automation Flows
Video Recording of Selenium Automation FlowsVideo Recording of Selenium Automation Flows
Video Recording of Selenium Automation Flows
 
JMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeterJMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeter
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4
 
The Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QAThe Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QA
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
 
How to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using ValgrindHow to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using Valgrind
 
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueDevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
 

Recently uploaded

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 

Recently uploaded (20)

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 

Accessibility Testing using Axe

  • 2. Accessibility Testing using Axe © RapidValue Solutions 2 How to Achieve Accessibility Testing using Axe You can achieve Accessibility Testing with the help of the following methods/approaches, using Accessibility Testing engine Axe,  Axe Browser Extension  Axe Command Line  Axe Core Library Axe Browser Extension This approach is a pretty straight-forward to perform the Accessibility Testing. Using the Axe browser extension, you can directly analyse and see the violation details per web page. The Axe browser extension is available for Google Chrome, Firefox and Edge browser. Following are the direct links to get the browser extension based on your browser type,  Google Chrome: https://chrome.google.com/webstore/detail/axe-web-accessibility- tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US  Firefox: https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/  Edge: https://microsoftedge.microsoft.com/addons/detail/axe-web-accessibility- t/kcenlimkmjjkdfcaleembgmldmnnlfkn Here, the Accessibility Testing approach using Firefox browser has been shared for you. When you load the above Axe browser extension in Firefox, you will get a page like this below,
  • 3. Accessibility Testing using Axe © RapidValue Solutions 3 You can add this extension and restart Firefox browser. In the next step, you can load the website that you need to perform the Accessibility Testing and open the developer tool in the browser (press F12). Go to the Axe tab and you can see below screen, Click on the ANALYZE button to begin the test. After few seconds, you will get the result that includes violation details, issue description, issue information, issue tags. You need to manually go through each and every violation and share the details with development team to improve the accessibility of your website.
  • 4. Accessibility Testing using Axe © RapidValue Solutions 4 Axe Command Line Axe Command Line approach is another way to test the accessibility and identify the violations. This can be achieved with support of NodeJS and node package manager (npm). You must install NodeJS in your system prior to start this way of accessibility testing. Once NodeJS is installed, one can install Axe-core by the following command: npm install axe-cli –g This installs Axe globally and can be accessed from any folder in the file system. Once installed, to test your web page, use the following command, Axe web-page-url --timeout=120 --save results.json --tags wcag2a The above command will test the page at the specific URL and save the results in a file called results.json. The value of the time out can be changed. The tags option specifies the rules to be run. There are several tags supported out of the box by Axe framework. For the above example, you are running the WCAG2.0 rules at level A. You can use the same website that used during Axe browser extension and see the output. Axe www.rapidvaluesolutions.com --timeout=120 --save results.json --tags wcag2a
  • 5. Accessibility Testing using Axe © RapidValue Solutions 5 A detailed report is saved in file results.json (available in your system user folder). Open this file in a JSON editor. Drill down to the violations attribute. The details of the Accessibility violations along with suggestions for fixes will be seen.
  • 6. Accessibility Testing using Axe © RapidValue Solutions 6 Axe Core Library This is one of the advanced approaches to perform the accessibility testing and identify the violations. In this approach, you can use Axe core library and automate the accessibility testing in between your functional regression automation. In the approach, you are using the Selenium dependency of com.deque.html.axe- core, and analyse method of AxeBuilder class. Once you create Accessibility Testing suite, you can configure in CI/CD pipelines for continuous testing. Pre-requisites: Following are the prerequisites to start Accessibility Testing,  Install Java SDK 8 and above.  Install Eclipse or IntelliJ IDEA IDEs.  Following maven dependencies: o testng o selenium-java o selenium-server o selenium from the group com.deque.html.axe-core o jackson-databind o jackson-dataformat-csv o poi-ooxml-schemas o poi-ooxml o poi
  • 7. Accessibility Testing using Axe © RapidValue Solutions 7 Step-by-step Approach: Step 1: Create a maven project and add the above dependencies in pom.xml of the project. Step 2: Create a Java class AccessibilityTestHelper to keep the logic to track violations. Implement following methods:  trackViolations – This is a public method that can be used in your test classes to track the violations. In this method, you use analyze method of AxeBuilder class to identify the violations. After that, create an excel file if not exist with help of createExcelFile method. Once the file gets created, writing the violation details (violation id, description, impact, help, help URL, and WCAG tags) into the file using writeToExcel method. Also, there is logic to track violations in JSON and text files. The actual implementations are below: /** * Method to track the violations using AxeBuilder support * * @author sanojs * @param driver * @param pageName */ public void trackViolations(WebDriver driver, String pageName) { Results violationResults; try { violationResults = new AxeBuilder().analyze(driver); if (!new File(System.getProperty("user.dir") + "Results").exists()) { (new File(System.getProperty("user.dir") + "Results")).mkdir(); } int j = 2; String filePath = System.getProperty("user.dir") + "ResultsAccessibilityTestReport.xlsx"; createExcelFile(filePath); for (int i = 0; i < violationResults.getViolations().size(); i++) { writeToExcel(filePath, pageName, 1, j, violationResults.getViolations().get(i).getId()); writeToExcel(filePath, pageName, 2, j, violationResults.getViolations().get(i).getDescription()); writeToExcel(filePath, pageName, 3, j, violationResults.getViolations().get(i).getImpact()); writeToExcel(filePath, pageName, 4, j, violationResults.getViolations().get(i).getHelp()); writeToExcel(filePath, pageName, 5, j, violationResults.getViolations().get(i).getHelpUrl()); writeToExcel(filePath, pageName, 6, j, violationResults.getViolations().get(i).getTags().toString()); j++; } AxeReporter.writeResultsToJsonFile( System.getProperty("user.dir") + "Results" + pageName + "_" + getCurrentDateAndTime(), violationResults);
  • 8. Accessibility Testing using Axe © RapidValue Solutions 8 AxeReporter.writeResultsToTextFile( System.getProperty("user.dir") + "Results" + pageName + "_" + getCurrentDateAndTime(), violationResults.getViolations()); } catch (Exception e) { e.printStackTrace(); } }  createExcelFile – this is a private method that helps to create an excel file if not exists. The file will be created at the project level. The actual implementations are below: /** * Method to create a new excel file * * @author sanojs * @param filePath * @return */ private XSSFWorkbook createExcelFile(String filePath) { XSSFWorkbook workbook = null; try { File fileName; FileOutputStream fos = null; File file = new File(filePath); if (!file.exists()) { fileName = new File(filePath); fos = new FileOutputStream(fileName); workbook = new XSSFWorkbook(); workbook.createSheet("Instructions"); XSSFSheet sheet = workbook.getSheetAt(0); Row header = sheet.createRow(0); header.createCell(0).setCellValue("Accessibility Testing Report"); XSSFCellStyle style = workbook.createCellStyle(); style.setBorderTop((short) 6); style.setBorderBottom((short) 2); style.setBorderRight((short) 2); XSSFFont font = workbook.createFont(); font.setFontHeightInPoints((short) 15); font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD); style.setFont(font); header.getCell(0).setCellStyle(style); Row row = sheet.getRow(0); sheet.autoSizeColumn(0); sheet.autoSizeColumn(1); row = sheet.getRow(1); if (row == null) row = sheet.createRow(1); Cell cell = row.getCell(0); if (cell == null) cell = row.createCell(0); cell.setCellValue("Please go through following tabs to know the violations"); workbook.write(fos); fos.flush();
  • 9. Accessibility Testing using Axe © RapidValue Solutions 9 fos.close(); workbook.close(); } } catch (Exception e) { e.printStackTrace(); } return workbook; }  writeToExcel – this is a private method that helps to write the violations into the created excel file. The actual implementations are below: /** * Method to write the violations in a excel report * * @author sanojs * @param sheetName * @param columnIndex * @param rowNum * @param data * @return */ private boolean writeToExcel(String filePath, String sheetName, int columnIndex, int rowNum, String data) { InputStream in = null; XSSFWorkbook wb = null; Sheet newSheet = null; FileOutputStream fileOutStream = null; try { if (filePath == null || filePath.trim().equals("")) throw (new Exception()); if (filePath.endsWith(".xlsx") || filePath.endsWith(".xls")) { in = new FileInputStream(filePath); wb = new XSSFWorkbook(in); } else { throw (new Exception()); } if (rowNum <= 0) throw (new Exception()); try { newSheet = wb.getSheet(sheetName); if (newSheet != null) { throw new Exception("Sheet Already exist..."); } newSheet = wb.createSheet(sheetName); } catch (Exception e) { } int index = wb.getSheetIndex(newSheet); if (index == -1) throw (new Exception()); XSSFCellStyle style = wb.createCellStyle(); style.setBorderTop((short) 6); style.setBorderBottom((short) 1); XSSFFont font = wb.createFont(); font.setFontHeightInPoints((short) 15); font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD); style.setFont(font); XSSFSheet sheet = wb.getSheetAt(index);
  • 10. Accessibility Testing using Axe © RapidValue Solutions 10 Row header = sheet.createRow(0); header.createCell(0).setCellValue("Violation ID"); header.createCell(1).setCellValue("Violation Description"); header.createCell(2).setCellValue("Violation Impact"); header.createCell(3).setCellValue("Violation Help"); header.createCell(4).setCellValue("Violation Help URL"); header.createCell(5).setCellValue("Violation Issue Tags"); for (int j = 0; j <= 5; j++) header.getCell(j).setCellStyle(style); Row row = sheet.getRow(0); if (columnIndex < 1) throw (new Exception()); sheet.autoSizeColumn(columnIndex - 1); row = sheet.getRow(rowNum - 1); if (row == null) row = sheet.createRow(rowNum - 1); Cell cell = row.getCell(columnIndex - 1); if (cell == null) cell = row.createCell(columnIndex - 1); cell.setCellValue(data); XSSFFormulaEvaluator.evaluateAllFormulaCells(wb); fileOutStream = new FileOutputStream(filePath); wb.write(fileOutStream); } catch (Exception e) { e.printStackTrace(); return false; } finally { try { wb.close(); fileOutStream.close(); in.close(); } catch (Exception e) { } } return true; }  getCurrentDateAndTime – This is a private method that helps to generate current timestamp that used suffix to the JSON and text files. The actual implementations are below: /** * Method to get the current date and time * * @author sanojs * @return */ private String getCurrentDateAndTime() { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); DateFormat timeFormat = new SimpleDateFormat("HH-mm-ss"); Date date = new Date(); String currdate = dateFormat.format(date); String currtime = timeFormat.format(date); return currdate + "_" + currtime; }
  • 11. Accessibility Testing using Axe © RapidValue Solutions 11 Step 3: Create a TestNG class SampleAccessibilityTest with logic to start the driver session and create a test case, let’s say accessibilityTesting. In the test case, you just need to load the browser that you need to perform the Accessibility Testing and after that call the method trackViolations. The actual implementations are below: @BeforeClass public void setUp() throws InterruptedException { try { ChromeDriverService chromeservices = new ChromeDriverService.Builder() .usingDriverExecutable(new File("path to your driver executable")).usingAnyFreePort().build(); driver = new ChromeDriver(chromeservices); } catch (WebDriverException e) { e.printStackTrace(); } } @Test public void accessibilityTesting() { try { driver.get("https://www.rapidvaluesolutions.com/"); new AccessibilityTestHelper().trackViolations(driver, "Home Page"); } catch (Exception e) { e.printStackTrace(); } } Step 4: Execute above test case and see the reports in the format of excel, JSON and text files. These reports will be generated in Results folder of the project structure. Based on the above trackViolations method, a sheet Home Page will be created in the excel report to track all the violations. If you are using trackViolations method for different pages of your web application, it will create new sheets to track the violations of your different pages. Below is the project structure:
  • 12. Accessibility Testing using Axe © RapidValue Solutions 12 Conclusion Accessibility Testing is one of the important types of testing that add value to your business and deliver user friendly applications. Axe Core is a very powerful framework that can help the team to build web products that are inclusive. In this article, different ways to test the Accessibility and the automation part have been discussed in full length. Hope this throws some light on the concept of testing the Accessibility and the implementations. Please try to utilize this while carrying out and utilizing Accessibility Testing. By, Sanoj S Test Architect
  • 13. Accessibility Testing using Axe © RapidValue Solutions 13 About RapidValue RapidValue is a global leader in digital product engineering solutions including mobility, omni-channel, IoT, AI, RPA and cloud to enterprises worldwide. RapidValue offers its digital services to the world’s top brands, Fortune 1000 companies and innovative emerging start-ups. With offices in the United States, the United Kingdom, Germany and India and operations spread across the Middle-East, Europe and Canada, RapidValue delivers enterprise services and solutions across various industry verticals. Disclaimer: This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No part of it may be used, circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the intended recipient of this report, you are hereby notified that the use, circulation, quoting, or reproducing of this report is strictly prohibited and may be unlawful. www.rapidvaluesolutions.com/blog www.rapidvaluesolutions.com +1 877.643.1850 contactus@rapidvaluesolutions.com Disclaimer: This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No part of it may be used, circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the intended recipient of this report, you are hereby notified that the use, circulation, quoting, or reproducing of this report is strictly prohibited and may be unlawful.