0% found this document useful (0 votes)
13 views17 pages

AT Framework User Guide

Uploaded by

Jeevitha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

AT Framework User Guide

Uploaded by

Jeevitha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

User Guide : AT Framework

RSD - AT Framework

TNQ Tech 1
User Guide : AT Framework

COPYRIGHT NOTICE

© 2023-2024 TNQ Tech. All rights reserved.

These materials are confidential and proprietary to TNQ Tech, Journals and no part of these
materials should be reproduced, published in any form by any means, electronic or
mechanical including photocopy or any information storage or retrieval system nor should
the materials be disclosed to third parties without the express written authorization of TNQ
Tech,

Document History

Version No. Change Section No Prepared/Modified Reviewed By & Approved By &


Summary By & Date Date Date

0.1 ALL 0.1 Elango & 10 Oct 2024

TNQ Tech 2
User Guide : AT Framework

Table of Contents

1. Introduction .............................................................................................................................. 4
1.1 Purpose ....................................................................................................................... 4
1.2 Scope ........................................................................................................................... 4
2. System Overview ...................................................................................................................... 4
3. Setup & Configuration .............................................................................................................. 5
3.1 Ensure the Required Tools Are Installed ...................................................................... 5
3.2 Project Structure .......................................................................................................... 5
3.3 Configure Cucumber Feature Files ............................................................................... 6
3.4 Create Step Definitions ................................................................................................. 6
3.5 Create TestNG Configuration File .................................................................................. 8
3.6 Test Runner Class …...................................................................................................... 9
4. Functional Requirements …..................................................................................................... 10
4.1 Test Execution ………................................................................................................. 10
4.2 Test Case Design …..................................................................................................... 10
5. Run Configuration .................................................................................................................... 11
5.1 Add TestNG Plugin ...................................................................................................... 11
5.2 Create a TestNG Configuration ................................................................................... 11
5.3 Parallel Execution Configuration ................................................................................. 11
5.4 Cucumber Runner Configuration ................................................................................ 12
6. Logging ..................................................................................................................................... 12
7. Reporting .................................................................................................................................. 13
7.1 Report Configuration .................................................................................................. 13
7.2 Report Configuration XML .......................................................................................... 14
7.3 Report View ................................................................................................................ 16

TNQ Tech 3
User Guide : AT Framework

1. Introduction
1.1 Purpose

The purpose of this document is to outline the functional requirements of the automation
framework. This framework will automate test scenarios for both web and API testing, ensuring
faster feedback loops and consistent quality across the software development lifecycle.

1.2 Scope

The automation framework will support:

● UI testing for web applications


● API testing (RESTful services)
● Integration with continuous integration/continuous deployment (CI/CD) systems
● Data-driven testing for scalability
● Parallel execution across multiple environments

This document provides detailed requirements for the framework, which will be used by
developers, QA engineers, and other stakeholders.

2. System Overview

The automation framework will be implemented using a modular, extensible architecture,


supporting multiple platforms and testing types. The framework will allow both manual
triggering of test cases and automatic execution via CI/CD pipelines. The generated reports will
provide actionable insights for both developers and QA engineers.

TNQ Tech 4
User Guide : AT Framework

3. Setup & Configuration


3.1 Ensure the Required Tools Are Installed

Before configuring the project, ensure that the following tools are installed:

● Java Development Kit (JDK) (preferably JDK 11 or higher)


● Apache Maven (for managing dependencies)
● Git (for version control)
● IDE (IntelliJ IDEA or Eclipse)

3.2 Project Structure

To integrate Cucumber with Rest Assured and TestNG, you need to organize the project
into specific folders for feature files, step definitions, test cases, and utilities. The
following structure is commonly used:

TNQ Tech 5
User Guide : AT Framework

/src/main/java // Logic and Reusable methods

/src/main/resources // Configuration & Properties

/src/test/java

/tnq.nimble.pms.definitions // Step definitions (API steps, actions)

/tnq.nimble.pms.hooks //Initialize the browser, log..

/tnq.nimble.pms.pagefactory // Step definition initialize browser

/tnq.nimble.pms.pageObjects // Step definitions dependency

/tnq.nimble.pms.runner // Runner class

/src/test/resources // Contains Feature files (.feature)

/Testdata // External input such as api json..etc

/nimble-pms-ui-qa-runner.xml // TestNG Suite Configuration file)

3.3 Configure Cucumber Feature Files

Cucumber feature files describe the behavior of the API or web services you are testing.
Place your .feature files in the /src/test/resources/features/ directory.

Example of a Feature File (src/test/resourcse/features/LoginPage.feature):

Feature: Login to PMS Application


Background:
Given User is on Home page
@QA
Scenario: Login PMS Application - Feature 1, Scenario - 1
When User enters username as "User" and password as "Password"
Then User should be able to login successfully

3.4 Create Step Definitions

Step definitions map the steps in the feature file to Java code. Place these in the
src/test/java/tnq.nimble.pms.definitions/ directory.

TNQ Tech 6
User Guide : AT Framework

Example Step Definition Class (src/test/java/tnq.nimble.pms.definitions/LoginPageDefinitions.java):

package tnq.nimble.pms.definitions;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import tnq.nimble.pms.common.UIWrapperMethods;
import tnq.nimble.pms.context.FrameworkContext;
import tnq.nimble.pms.hooks.ExtentReportManager;
import tnq.nimble.pms.pageObjects.HomePage;
import tnq.nimble.pms.pageObjects.LoginPage;
import tnq.nimble.pms.pagefactory.PageFactoryManager;
import org.testng.Assert;
import java.io.IOException;
public class LoginPageDefinitions {
//PMSTestSetUp setUp;
FrameworkContext context;
public LoginPage loginPage;
public HomePage homePage;
public UIWrapperMethods common;
public LoginPageDefinitions(FrameworkContext context) throws IOException {
this.context = context;
loginPage = PageFactoryManager.getLoginPage(context);
homePage= PageFactoryManager.getHomePage(context);
}
@Given("User is on Home page")
public void loginTest() throws IOException {
try {
loginPage.openurl();
ExtentReportManager.logStepPass("User is on Home page Opened");
} catch (Exception e) {
ExtentReportManager.logStepError("Failed to Open homepage", e);
}
}
@When("User enters username as {string} and password as {string}")
public void goToHomePage(String userName, String passWord) {
try {
loginPage.login(userName, passWord);
ExtentReportManager.logStepPass("Login Sucessfully");
}catch (Exception e) {
ExtentReportManager.logStepError("Login Failed", e);
}
}
@Then("User should be able to login successfully")
public void verifyLogin() {
Assert.assertTrue(homePage.getHomePageText().contains("PRODUCTIVITY"));
}
}

TNQ Tech 7
User Guide : AT Framework

3.5 TestNG Configuration File (nimble-pms-ui-qa-runner.xml)

TestNG manages the execution of the tests. Place a


nimble-pms-ui-qa-runner.xml file.

Example of nimble-pms-ui-qa-runner.xml:

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Nimble_PMS_UI_QA_Automation" data-provider-thread-count="1">
<test thread-count="1" name="ui_functional_test_qa">
<classes>
<class name="tnq.nimble.pms.runner.PMSRunnerQA"/>
</classes>
</test>
</suite> <!-- Runner Info -->

TNQ Tech 8
User Guide : AT Framework

3.6 Test Runner Class

The TestRunner class executes the Cucumber scenarios using TestNG. Place this file under
src/test/java/tnq.nimble.pms.runner/.

Example TestRunner Class (src/test/java/tnq.nimble.pms.runner/PMSRunnerQA.java):

package tnq.nimble.pms.runner;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import tnq.nimble.pms.utilshandler.ReportingUtils;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.DataProvider;
/**
* https://extentreports.com/docs/versions/4/java/cucumber4.html
* @author Elango Saminathan
*
*/
@CucumberOptions(
tags = "@QA",
features = "src/test/resources/features",
glue = { "tnq.nimble.pms.definitions",
"tnq.nimble.pms.hooks" },
plugin = {"pretty",
"json:target/cucumber.json",
"html:target/cucumber-report.html",
"junit:target/cucumber-report.xml",

"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"timeline:test-output-thread/"
},
monochrome = false,
dryRun = false
)
public class PMSRunnerQA extends AbstractTestNGCucumberTests {

@AfterSuite
public void generateReport(){
ReportingUtils.generateJVMReport();
}

TNQ Tech 9
User Guide : AT Framework

4. Functional Requirements

4.1 Test Execution

● The framework should support the execution of automated test cases for web UI
and API layers.
● Tests should be executable on multiple browsers (Chrome, Firefox).
● API tests should support common RESTful operations like GET, POST, PUT, DELETE.
● The framework should support the execution of both regression and sanity tests
through tagging/grouping of test cases.
● The framework able to execute tests in parallel.

4.2 Test Case Design

● The framework should follow a Page Object Model (POM) for UI test automation
to improve maintainability.
● For API testing, the framework should provide a RESTful methods (e.g.,
APIWrapperMethod classes to handle API calls).
● The framework should support data-driven testing by allowing test data to be
loaded from external sources (Text, JSON).

TNQ Tech 10
User Guide : AT Framework

5. Run Configuration

5.1 Add TestNG Plugin

If you're using Eclipse, make sure the TestNG plugin is installed:

1. Go to Help > Eclipse Marketplace.


2. Search for TestNG and install the plugin.
3. Restart Eclipse if needed.

5.2 Create a TestNG Configuration

1. Right-click on your project in the Project Explorer.


2. Select Run As > TestNG Suite.
3. Select your nimble-pms-ui-qa-runner.xml file from the src/ folder.
4. Click Run.

5.3 Parallel Execution Configuration


In nimble-pms-ui-qa-runner.xml, modify the suite settings to enable parallel
execution:

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Nimble_PMS_UI_QA_Automation" data-provider-thread-count="1"
parallel="classes" thread-count="4">
<test thread-count="1" name="ui_functional_test_qa">
<classes>
<class name="tnq.nimble.pms.runner.PMSRunnerQA"/>
</classes>
</test>
</suite> <!-- Runner Info →

TNQ Tech 11
User Guide : AT Framework

5.4 Cucumber Runner Configuration


You can also configure Cucumber to run scenarios in parallel by using the @Cucumber
Options annotation in your test runner class. For example:
@CucumberOptions(
tags = "@QA",
features = "src/test/resources/features",
glue = { "tnq.nimble.pms.definitions",
"tnq.nimble.pms.hooks" },
plugin = {"pretty",
"json:target/cucumber.json",
"html:target/cucumber-report.html",
"junit:target/cucumber-report.xml",

"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"timeline:test-output-thread/"
},
monochrome = false,
dryRun = false,
parallel = true
)

6. Logging
Detailed logging should be available for all tests. Place this file under logs/main.log

Example of logs/main.log

2024-10-03 15:32:36,357 +0530 [main] INFO (UIWrapperMethods.java:53) - open


url....http://10.0.5.203:8081/index.php/login
2024-10-03 15:32:46,715 +0530 [main] INFO (UIWrapperMethods.java:115) -
clicking the element[[ChromeDriver: chrome on linux
(90eb62c2ac36fbcea64cab58022e2088)] -> xpath: //*[@data-api='loginPost']]

TNQ Tech 12
User Guide : AT Framework

7. Reporting
7.1 Report Configuration
Create an extent.properties file in the src/test/resources folder to
configure the output and appearance of the Extent Reports:

#Report Name
extent.reporter.spark.start=true
extent.reporter.spark.out=Reports/PMS_Report.html
#PDF Report
extent.reporter.pdf.start=true
extent.reporter.pdf.out=PDFReport/ExtentPdf.pdf
#Report Template
extent.reporter.spark.config=src/test/resources/extent-config.xml
#extent.reporter.pdf.additional.config=src/main/resources/pdf-config.yaml
extent.reporter.pdf.title=Automation Test Report # PDF Title
extent.reporter.pdf.author=QA Team # Author of the report
extent.reporter.pdf.subject=Test Execution Summary # PDF subject
# Customization options
extent.reporter.pdf.theme=STANDARD # STANDARD or DARK theme
extent.reporter.pdf.fontName=Arial # Font name
extent.reporter.pdf.fontSize=12 # Font size
extent.reporter.pdf.pageNumbers=true # Include page numbers
(true/false)
# Metadata options
extent.reporter.pdf.keywords=Automation,Testing,PDF # Keywords for the
report
extent.reporter.pdf.company=Your Company Name # Company name for the
report
#FolderName
basefolder.name=ExtentReports/PMSReport_
basefolder.datetimepattern=d_MMM_YY HH_mm_ss
#Screenshot
screenshot.dir=/Screenshots/
screenshot.rel.path=../Screenshots/

TNQ Tech 13
User Guide : AT Framework

# Encrpt Image
extent.reporter.spark.base64imagesrc=true
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,devic
e,log
#System.info
systeminfo.os=Window
systeminfo.Engineer=Elango Saminathan
systeminfo.Build= 1.1
systeminfo.Project = PMS
systeminfo.Browser = Chrome
systeminfo.AppName= NimbleReport

7.2 Report Configuration XML


To customize the appearance of your Extent Report, create an extent-config.xml
file in the src/test/resources directory:

<?xml version="1.0" encoding="UTF-8"?>


<extentreports>
<configuration>
<!-- report theme --> <!-- standard, dark -->
<theme>STANDARD</theme>
<!-- document encoding --> <!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>
<!-- protocol for script and stylesheets --> <!-- defaults to https
-->
<protocol>https</protocol>
<!-- offline report --> <!-- included for pdf -->
<timelineEnabled>true</timelineEnabled>
<!-- offline report --> <!-- included for pdf -->
<enableOfflineMode>false</enableOfflineMode>
<!-- use thumbnails for base64 images -->
<!-- this may slowdown viewing tests -->
<thumbnailForBase64>false</thumbnailForBase64>

<!-- title of the document -->

TNQ Tech 14
User Guide : AT Framework

<documentTitle>Nimble PMS Report</documentTitle>


<!-- report name - displayed at top-nav -->
<reportName>Nimble - PMS</reportName>
<!-- global date format override --> <!-- defaults to yyyy-MM-dd
-->
<dateFormat>yyyy-MM-dd</dateFormat>
<!-- global time format override --> <!-- defaults to HH:mm:ss -->
<timeFormat>HH:mm:ss</timeFormat>
<!-- location of charts in the test view --><!-- top, bottom -->
<testViewChartLocation>bottom</testViewChartLocation>

<displayPassedSteps>false</displayPassedSteps>
<!-- custom javaScript -->
<scripts>
<![CDATA[
$(document).ready(function() {
});
]]>

</scripts>
<!-- custom styles -->
<scripts>
<![CDATA[
]]>
</scripts>
</configuration>
</extentreports>

TNQ Tech 15
User Guide : AT Framework

7.3 Report View


Dashboard

TestSteps

TNQ Tech 16
User Guide : AT Framework

Tags

PDF Report

TNQ Tech 17

You might also like