Automation Framework Structure

 Automation Framework Structure

  1. Programming language: Java
  2. Testing tool: Selenium
  3. Test Framework: TestNG
  4. Log details: Log4J
  5. Design pattern: Page Object Model
  6. Encapsulation: Keep fields private, methods are public
  7. Fluent builder pattern: methods
  8. Test Script repository: Test scripts are based on functional areas
  9. Inheritance: Test scripts are extended base class
  10. Inheritance: Pages are extended PageObject class
  11. Data-driven: Use CSV file to keep the data
  12. pom.xml file configurations for test script repository
  13. test project name
<name>cam-taf-cos-cd-test</name>

 14. Client path

15. Test suite name

<cos.client.path>CHANGE ME!!</cos.client.path>
<cos.client.debug.port>950</cos.client.debug.port>
<test.suite.file.name>regression.xml</test.suite.file.name>

16. Dependency projects

<dependency>
<groupId>se.camb.qa</groupId>
<artifactId>camb-taf-cos-cd-pageobjects</artifactId>
</dependency>

17. Mail receivers list

<developer>
<name>Kerry Hawke</name>
<email>kerry@gmail.com</email>
</developer>

18. Pom file configurations for Page Object Repository

<dependency>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>

19. Inside each page object class below is the structure

20. Log4J for login info about each method

private final static Logger log = Logger.getLogger(class)
log.info("Initiate " + this.getClass().getName());

log.info("Step:Click 'Add keyword' button in Keyword editor window.
[Class#Method]"
);

21. JavaDoc for each method and whole class

/**
* Class name and description
*
* @author
* @version 1.0
* @since 26/12/2019
*/


/**
* Select Record in Table using row_id
*
* @param row_id - row id of the required row to select
* @param columnName - column name
* @throws FrameworkException
*/

22. Fluent builder pattern in each method: Return type is always class name

23. Configurations in environment.xml file

* Manage project configurations under **```environment.xml```** file,
> - ```<embedded-mode></embedded-mode>``` **```: If 'ON' test project will support chromium emmberdard mode, if 'OFF' test project only support swing gui mode or pure web```**
> - ```<app-mode></app-mode>``` **```: If 'GUI' test project support for pure swing or chrommium emmberdard mode, if 'WEB' test project support only for pure web application```**
> - ```<dashboard>OFF</dashboard>``` **```: If 'OFF' while during the execution listeners will disable and not collect execution results for dashboard```**

24. chrome driver is located under the resources folder

25. log4j.xml file is located in the resources folder

26. Data input files like images and pdf are located in the resources folder

27. testNG test suite XML looks like the below

<suite name="Regression Suite">
<listeners>
<listener class-name="se.test.runner.framework.runner.DelegatingTestRunner"/>
<listener class-name="se.test.taf.core.listener.TestNgListener"/>
</listeners>
<test name="Regression Test Suite">
<groups>
<run>
<include name="data"/>
<include name="reg"/>
</run>
</groups>
<packages>
<package name="se.qa.cd.cps.*"/>
</packages>
</test>
</suite>

28.environment.xml looks like this

<environment name="QA">
<!-- For chrome driver location add the path on your local directory -->
<browser-type>
<name>chrome</name>
<driver>webdriver.chrome.driver</driver>
<location>chromedriver.exe</location>
</browser-type>
<os-type>Windows</os-type>
<grid-mode>OFF</grid-mode>
<headless-mode>OFF</headless-mode>
<embedded-mode>ON</embedded-mode>
<app-mode>GUI</app-mode>
<dashboard>OFF</dashboard>
<baseurl>
<!-- protocol types http , https -->
<protocol>http</protocol>
<server>puppies.herokuapp.com</server>
<port/>
<directory/>
<page/>
</baseurl>
<!-- application client location -->
<application-path>C:\\Client</application-path>
<timeout>
<implicit>8000</implicit>
<script>2000</script>
<pageload>10000</pageload>
<env-timeout>3000</env-timeout>
</timeout>
</environment>
</environments >


Comments

Popular posts from this blog

False Positive

100% Percent Test Coverage