SonnetTEST Framework Features Components - sonnettest/TestAutomation GitHub Wiki

Configuration file - sonnettest.properties

It is a key value pair built using java properties. It should be placed in eclipse project root folder. User can define keys that can be consumed within the code. Framework expects certain keys (used as global parameter) including value that is used within the framework. In the absence of the same or invalid path, default path will be considered.

Project workspace will be considered as default path. Eclipse is used for developing test scripts.

TestNG Unit Testing Framework

It will be used in the driver scripts. Driver script should extend "SonnetTestNGBase" to take advantage of TestNG features. User is allowed to override methods in SonnetTestNGBase. Pl discuss with testing competency team before implementing the same.

public class driverScript extends SonnetTestNGBase {

@Test(priority=1, description="order booking by guest user using cc")

public void OrderBookingGuestUserCC() throws Exception {

It is customized to support different format like PDF, DOC.

JUnit Unit Testing Frameworks

It can be used. But reporting format is NOT customized, which is WIP.

Design test scripts / page objects

The class should extend **SonnetElement ** to find all functions / methods required to write scripts.

public class googleSearch extends SonnetElement {

Test data

User can maintain test data either in CSV, excel or database. Test data can be read using datasource. It is suggested to maintain test data file name in sonnettest.properties file mapping to a key (refer usage of global variables).

DataSource productData = new DataSource();

productData.GetCSVDataFile("<csv file path & name>"); // in case test data is maintained in CSV file productData.GetExcelData("<excel file path & name>") // in case test data is maintained in EXCEL file

While consuming or parameter to the script, test data should be filter to a particular valid row. Post this, value can extracted from a particular column (as in test data file header).

productData.SetFilterTo(dataRow);

findElement(By.xpath(".//*[@id='qty']")).sendKeys(productData.GetData("quantity"));

Test Report

At the end of test run, test report will be generated with PDF, DOC, XLXS format. User needs to configure against format. Default format is PDF.

Error Snapshot

Automatically captures screen snapshot in case of error and stores it in configured folder. Error file name is also referred in Test Report mapping to the test case.

Usage of Global Variables

User is allowed to use the following global variables while scripting on need basis. It is not suggested to override and unless it is required and sure of the requirement.

  • _Properties - Holds all key / value defined in sonnettest.properties.
  • _Element_wait - Wait for element to be identified. User needs to configure against key "element_wait" Default wait is 60 seconds.
  • _Default_wait - default wait for page navigation, page load etc. User needs to configure against key "default_wait" Default wait is 60 seconds.
  • _DateFormat - Used to display date in a specified format in test report. User needs to configure against key "date_format". Default date format is yyyy.MM.dd H:mm.
  • _OutputFolder - Where the test report, error snapshot to be stored. User needs to configure against key "output" Default location is project work space.
  • _Capabilities - used for add / override browser settings.

Error Log

Maintained separately to enable user to simulate error. It also captures previously successful steps before logging complete error stack trace.

It is also being enhanced to capture other log types supported by Selenium WebDriver.

Keyboard events

Supports keyboard keys to perform certain actions on need basis.