Table stability of the build. Due to the increase

Table of ContentsINTRODUCTION Test Automation What is Test Automation Framework? Need of Test Automation FrameworkTypes of Test Automation Framework Tools Specification Supported browsers and Platforms Framework Components Project StructurePackaging UI Maps MetadataPanel Element Types Base Elements (Primitives) Asset List Composite ElementsTable Data Structure Apache POI Namespaces Verification and LoggingCustomAssertVerify Logging Steps for Test Creation REFERENCES AND CREDITS 3IntroductionTest AutomationIn software industrythe products are releasing more frequently. Whenever we have a new productrelease it is required to perform smoke test or regression test to ensure thestability of the build.

Due to the increasein the frequency of the build release It becomes very difficult for the manualtesters to execute every test case due to time constraints and urgency ofdelivery. To overcome this problem test automation is used as a method toperform more repetitive task. Test automation means using a software tool torepeatable tests automatically and within a less time an application can betested. Selenium is one of the most popular and open source tool for testautomationFramework which is created using Selenium RC or web driverand Java and can be used across projects for testing web based applications,independent of programming language used during development of the application.What is TestAutomation FrameworkA set of guidelines like coding standards, test-datahandling, object repository treatment, folder structure,reporting formats etc.

Best services for writing your paper according to Trustpilot

Premium Partner
From $18.00 per page
4,8 / 5
Writers Experience
Recommended Service
From $13.90 per page
4,6 / 5
Writers Experience
From $20.00 per page
4,5 / 5
Writers Experience
* All Partners were chosen among 50+ writing services by our Customer Satisfaction Team

, which when followed duringautomation scripting produces beneficial outcomeslike increase code re-usage, higher portability, reducedscript maintenance cost etc.//refered def- of TestAutomation FrameworkAn automation test suite can be built by simply recordingvarious test cases using IDE. However, making changes to the recorded scriptsafter application changes with new commits and release is very difficult.However, testing framework that is application independentand has the capability to expand and incorporate changes is better solution.Also, organized test framework helps avoiding duplication of tests.

In short,Framework increases efficiency of testing. Types of TestAutomation FrameworkAutomation frameworks can broadly be classified into threetypes.Type Description(intable)Data Driven -Inthis approach, Test data are stored in external files like (Excel files, textfiles, CSV files, ODBC Sources, DAO Objects, ADO Objects) and are loaded intovariables inside the test script during runtime. This approach reduces theproblem of hard coding for input data.Keyword Driven-In this approach, you would first identify a set of Keywords and thenassociate an action (orfunction) which each of these keywords.

So basically aKeyword Driven Framework is nothingbut a collection of keywords & functions and theassociation between these two entities.Hybrid -Thisapproach combines the two approaches outlined above, and brings in benefitsderived fromboth. Over a period of time, hybrid frameworks have emergedas the de facto standard forautomation requirements.Automation Workflow1. A well-structured Framework should be in place2. Identify all the Business flow that should be automated3. Necessary input data has to be created4.

Expected results have to be defined in order one canjudge that an application workscorrespondingly5. Execute a Test6. Compares expected results with actual results, anddecides whether the test has been passed orbug is to be raised After covering basics of Test Automation and details aboutAutomation Framework, we will now coverdetails of a Generic Automation Framework which is createdusing Selenium RC, Java and some othersupporting tools like TestNG (execution engine), Apache POI,Log4J Logging  etc. This framework can beimplemented for any webapplication, independent of its domain and programminglanguage.

5FrameworkSpecificationsThis framework is designed using Core library. This core canbeused with any web application and supports the followingfunctionality. • Selenium Controller and UI primitives• AssetList functionality.• DataProvider for XLS input data processing.• Custom Asserts• DB connectors• Reporting• Logging Tools SpecificationThis Framework has the following tools:1. Selenium RCSelenium              is a test tool that allows you to write automated webapplication UI tests in any programminglanguage against any HTTP website using any mainstreamJavaScript-enabled browser.

Selenium RemoteControl is great for testing complex AJAX-based web userinterfaces.Selenium RC comes in two parts.1. A server which automatically launches and kills browsers,and acts as a HTTP proxy for webrequests from them2. Client libraries for computer language that is used forAutomationIn this framework, Selenium RC provides various APIs thatenables automation for web application.

2. Eclipse IDEEclipseis an integrated development environment (IDE) for Java.Eclipse is written mostly in Java and itsprimary use is for developing Java applications, but it mayalso be used to develop applications in otherprogramming languages through the use of plugins.In this framework, Eclipse IDE is used by Automationdeveloper for accessing /modifying/ managing javaclasses.3. TestNGis a testing framework inspired from JUnit and NUnit. It hasextended new functionalities whichmade it more powerful and easier than the other testingframeworks.

It supports ReportNG, a simple HTML reporting plug-in. It isintended as a replacement for the defaultTestNG HTML report. The default report is comprehensive butis not so easy to understand at-a-glance.ReportNG provides a simple, color-coded view of the testresults.In this framework, TestNG is used for defining end-to-endtesting framework.4. Log4j-Log4j is a Java library that specializes in logging.Typically logs are output to console window, using Log4Joutput can also go to an email server, a database table, alog file, or various other destinations.

In this framework, Log4J is used for logging various informationwhen test is run.5. Apache POIApachePOI is a popular API that allows programmers to create,modify, and display MS Office files usingJava programs. It is an open source library developed anddistributed by Apache Software Foundation.

In this framework, Apache POI is used for dealing with MSExcel Input/Output.7Supported browsersand PlatformsTable below lists different Operating Systems and browserthat are supported by Selenium RC Browser             Selenium (RC)         Operating Systems Firefox 2,3,3.x    Start browser, run tests Windows, Linux, Mac IE 8,7,6               Start browser, run tests Windows Safari 4,3,2             Start browser, run tests Windows, Mac Opera 10,9,8         Start browser, run tests Windows, Linux, Mac Google Chrome Start browser, run tests Windows, Linux, Mac Framework ComponentsThe framework that is depicted as part of this document hasspecific structure and frameworkcomponents. They can be used as-is or can be modified as perproject requirements and specification ofAUT. Below are high level framework components and theirdescription, detailed explanation will becovered under Project Structure.Business Layer1. Configuration File – Config file is used for storingparameters such as log file path, databaselocation, host details, results path, selenium executionspeed, wait period, etc.

This is the placewhere all global configuration settings will be stored.2. UI Maps – These are also java classes, however these areused for storing xpath/IDs of applicationelements such as Text Box, Drop downs, Radio buttons, Tabs,Links etc. To help manage UI Maps,different classes are created for different panels.

Note: Panel refers to any tabs / web page commonly seen inany web application and is used inthis framework for grouping each component logically.3. Meta information – As the name suggests, these are javaclasses that provide information. Incontext of this framework, meta classes are storage forconstants, variables for e.g.

ui label,dropdown values that will be frequently referred in testcases4. Panels –These java classes are used for panel management.These defines all elements of thepanels stored in UI maps and also contains reusableapplication functions pertaining to panels.

For e.g. AddDriver(), CalculatePremium() etc.Test Layer1. Test Scripts – These are Java classes used for codingtest case flow. Core Java programming is usedfor building test logic in these files.2.

XML Suite – XML suite is required for running tests, theymake call to individual java classes. XMLsuite also defines parameter that are required for executinga java file, for e.g. Data file name3. Data Files – This framework uses MS Excel for providinginput data to tests. Excel Input data isstructured using Namespace feature of MS Excel.8ProjectStructurePackagingThis section provides details about folder structure anddifferent files that are part of framework.As described earlier this framework is packaged into twolayers – 1.

Business Layer 2. Test LayerBusiness layercontains the framework components that are written during framework developmentandrequires changes only when AUT changes. Components from thislayers are used during test casedevelopment.

Sample components:1. ui: storage for ui related entities. This is the place tostore locators (xpath/IDs) for ui objects,constants related to ui labels, panel management etc.2. utilities: storage for different utilities/functions thataids test case development3. config: storage for all configuration related entitiesthat are required during test runSuggested Folder Location: src/mainTest Layercontains components that form test logic of the framework. A new file is addedto test layrevery time a new test case is automated. Folder structure iscreated based on test case grouping of yourproject.

For E.g. Functional tests, timepoint tests etc.Helper files are also part of this layer, and containsdifferent useful features and functions.

Suggested Folder Location: src/testUI MapsUI maps are the files that stores locators (xpath/ID)details of an UI element, these are used to performAttached theapplication screen like create account pageoperation on that element via test.Screenshot : Application screen showing ‘Policy Information’screenBusiness LayerTest Layer9Usually in any selenium framework, UI maps are stored foreach and every UI element. This results intocreating huge number of locators. In this type offrameworks, 9 UI map will be created for each of thefields in Screenshot 1This framework has very effective way of storing locatorsfor UI. Only one UI Map is added for UI elementshaving same parent. So in this framework, only 1 UI map willbe created as all the 9 fields has same parentelement ‘Policy Information’ as seen below. Attached open google& span id field                QUOTE_GENERAL_POLICY_INFO_ASSET(“//[email protected]=’policyDataGatherform:componentContextHolder'”),UI map is organized as a customized enumeration to achieve- Code unification and segregation- Ability of processing tricky cases with dynamicallygenerated IDsImportant: UI Map for Table and AssetList should be alwaysrepresented as xpath. AssetList is specifictype of element that is used in this framework for groupingdifferent UI fields having same parentstructure.

Suggested Folder Location: src/main/java/ui/mapScreenshot: Enumeration of UI maps. Two enums Policy andRenewal Preview is shown.10MetadataUnder the Metadata term we mean all the constants for names, dropdown values and variablessuch as phone#, email id etc. Metadata is also organized ascustomized enumeration for creatingmanageable groupings.This helps us in controlling hard coding directly into testscases.

This in turn reduces maintenance effort,as only changes are required into metadata files and alltests are updated automatically.Suggested Folder Structure: src/main/ui/app/metadataScreenshot: Metadata showing different payment plans forinsurance policy creation.11PanelPanel is referred for Application panels (tabs/web pages).In general, every application has edit panelwhere data is entered by user and summary panels whichpresents consolidated data that user hasentered. Panel is used for declaring elements and alsocontains reusable functions pertaining to thatpanel.Element declaration means creating an element type variablethat refers to its declaration in UI map files.Element declaration also mentions Ajax associated with thatelement.

Edit PanelsEdit panels contains elements declaration for simpleelements and AssetList elements. Also has functionsfor data filling.Suggested Folder Structure:src/main/java/ui/model/panel/editScreenshot: Edit panel screen showing various components12Summary PanelSummary panels contains element declaration and otheroperations that can be performed on summarypanels.Folder Structure: src/main/java/ui/model/panel/summaryScreenshot: Summary panel showing element declaration andoperations1314Element TypesIn above sections we saw different components that are partof this framework and all of them revolvearound UI elements. UI elements are base of any automationproject, because if you can’t define andaccess UI elements through your automation framework, youcannot perform operation on thoseelements.

And test case flow is simply combination ofoperation performed on UI elements.In this section we will focus on types UI elements that areseen commonly in web applications and howto declare them so that they can be used in test cases.This framework deal with standard UI elements such as Textboxes, radio buttons and some new elementsare created to suit testing requirements such as AssetList,e-folder, calendar etc. All UI elements havetheir own type and these types are implemented in ISTF core.So in business layer we are just instantiatingnew UI elements based on AUT, however their implementationis part of ISTF Core. Almost all elementsand methods are static.

Static declaration permits to getaccess to the element without creating classinstance.The main element types:? Base element (Primitives)? AssetList? Customized composite elements? TableBase Elements (Primitives)These are typical elements that are available on most webapplications.• Button• CheckBox• ComboBox• Label• Link• RadioButton• TextBox … etc.Base Element DeclarationAll primitive elements can be declared and almost all ofthem have 3 constructors:? Button (locator, waitMode , timeout)? Button (locator, waitMode)? Button (locator)locator – locator (xpath/ID) of the element on the pagedefined in UI MapswaitMode – wait mode that should be called after click/editon the element. Wait mode values: PAGE,AJAX, SLEEP, NONE. If not defined wait mode is defaulted toNONE.

timeout – timeout of the wait mode type. If not defineddefault one is used15Example:Each element type have its own set of operations that can beperformed with it. These operations aredefined as part of ISTF Core library.Asset ListAssetList is unique and outstanding feature of thisframework. Elements on the page that can be groupedand have the same block parent are stored as AssetList. Thisreduces the number of elements declared inUI Maps and corresponding element declaration in Panels.Important: One AssetList cannot include 2 elements with thesame name (UI label).

Because each of thefield within AssetList is accessed via UI Label.AssetList DeclarationAssetList is declared using below constructor –AssetList (String ParentFormLocator, ClassNameOfAssetTypeRange)ParentFormLocator – xpath of the block of elements definedin UI MapsNameOfAssetTypeRange – AssetList Attribute descriptor nameAssetList attribute descriptor class stores details about UIelements that are part of an AssetList. Multipleclasses can be created each for different panels. Customizedenumeration is used for grouping theseelements.

Elements within this group are represented withunique name within class and has 3 attributes:? Label name (name of the element on UI)16? Type of the element (textbox, radiobutton,etc.)? WaitMode (if has).Screenshot: AssetList Attribute Descriptor class17Each control has 3 main access methods, which return elementattributes accordingly.

These can be usedfor performing validations in tests.? SearchAssetType.SEARCH_FOR.getLabel() ; -returns element Label name? SearchAssetType.SEARCH_FOR.getControlClass();- returns element Control class? SearchAssetType.SEARCH_FOR.

getWaitMode();returns wait mode of element.AssetList has its own set of operations defined in Corelibrary.Composite ElementsCustomized composite elements – complex elements, usuallyare composed from primitives (commonpanels/pop-up’s/etc.

) Example: Yes/No pop-up, Calendar,Document Folder etc. Based on projectrequirements, new composite elements can be created.Composite Element Declaration Individual java classes arecreated for defining composite elements.Suggested Folder Location: ui/common/model/compositeBelow screenshot show java class created for YesNoDialogbox.18Example:TableTable element provides set of methods to manipulate with thetable structures: Cell, Row, Column etc.Tables DeclarationBelow constructor is used for declaring table element typesTable (String tableLocator).

tableLocator – xpath of table container.19In this case xpath will be: //[email protected]=’ billingDetailedForm:billing_transactions_active’Example:20Data StructureThis framework uses Microsoft Excel for storing input data.Apache POI is used as middleware API thatallows java classes to interact with MS Excel.Apache POIApache POI (Poor Obfuscation Implementation) is an opensource library or API developed anddistributed by Apache Software Foundation. It provides aJAVA based library of classes containing a set ofmethods to create, modify and display Microsoft Office filesusing JAVA. POI has the capabilities to readand write data to and from the Excel files. Apache POI hassupport for both files with “.xls” and “.

xlsx”extension. We have used example file with .xls extension inthis document.

NamespacesThis framework uses concept of Excel Namespaces for creatingKey-Value pairing for UI Field labels andInput Data Values. An Excel Namespace is simply a nameattached to specific cell or group of cell inworksheet. Creating namespaces helps in referring to groupof cells just by using the name given to thatgroup.Namespace structureThis framework follows specific structure for managing datawithin namespaces. Reading data fromnamespaces is part of ISTF Core library that used POI API.Same or different structure can be used in anyweb application.1.

Usually web applications have different tabs forcapturing various data2. Create data for each tab in one worksheet and give sheetsame name as that of tab3. Tabs also have various sections, covering various datafields4. This framework has two level of namespaces, 1- forgrouping different sections on a tab 2- forgrouping different UI labels within a section5. Example – AAA Insurance application21? New sheet will be added in excel datasheetfor each of the tabs, ‘General’, ‘Applicant’,’Property’ etc.? Level 1 namespaces will be created forgrouping ‘List of names insureds’, ‘AAA Membership’and ‘Dwelling address’ under tab ‘Applicant’.? Level 2 namespace will be created for eachof the individual sections covering different datafields.

Creating NamespacesLevel 1 – Key for level 1 namespaces should be same asStrings defined in panels and Value should besame as namespace for level 2Level 2 – Key should be same as attributes defined in metafiles22Level 1Level 2Example:23Below is the details of each functions, implementation ofthese functions are part of ITSF Core.? BaseTest.getDataSuite() – returns excel filename for the current test, defined in suite parameter.? getDataGroup(“QuoteApplicant”) –returns excel sheet. Almost each ui tab has its own sheet.? getDataTable(dataSet) – returns table withdataset for the current test and current sheet.? dataset – namespace of the dataset table forthe current sheet. E.

g. “HO3_Dataset1”?getLinkedData(“AccountGeneralInformation”) – returns test data tablefor the selected asset listfor the current dataset.24Verification and LoggingISTF core has functions created for validating test logic,comparing actual and expected behavior of AUT.CustomAssertThis class is part of this framework that allows youvalidate AUT behavior with expected output.

Here isthe list of available functions,Here is the example of usage,If you need to verify some values, but test must go on evenif verification failed, you should useCustomAssert.enableSoftMode(). This function allows collectverification errors without stopping test run.To stop enableSoftMode() use CustomAssert.

disableSoftMode().And all the collected information will bedisplayed in console after execution is complete.For checking that condition is true useCustomAssert.assertTrue(). Similarly use useCustomAssert.

assertFalse() for checking a value is false.25VerifyEvery control has special function verify that can check ifcontrol is present, enabled, its values etc. Hereis a list of available features.AssetLists verification – It is possible to verify values ofthe entire AssetList:Special functions – Some Framework Panels contain its ownverification functions for different controls.It is done for easier usage and intuitive tests writing.

26LoggingLogging is used to provide additional information for thetester. Logging is displayed on console outputand helps in better understanding of test flow.27Steps for Test CreationStep 1 – Identify test package where you want to add yourjava classStep 2 – Create xml suite that will be used for calling javaclass and pass parameters required for runStep 3 – Create datasheet as per your test need and pass itas parameter in xml suiteStep 4 – Import necessary classes from framework in yourjava class and begin writing step by step flowStep 5 – Put necessary validations using CustomAssert andVerify functionsStep 6 – Run xml suite for executing your test individually.

Step 7 – You can create master suite xml and call multiplejava classes. All tests will run sequentially thiscase.28References and Credits