Selenium WebDriver Data Driven Framework - Implement Logging Using Log4j

Data driven framework for selenium webdriver software testing tool must convey facility to Insert assay out execution log to rails the execution process, debugging as well as failures afterward completion of software test. Test execution logs volition helps you lot to rails your software assay out execution steps. In STEP 17, We convey successfully reported assay out cases results In excel file. Now permit us Implement log generation business office In our selenium webdriver software automation testing framework.

STEP 18

Prerequisite : Previous all 17 steps of selenium webdriver information driven framework creation should last Implemented. You volition honor the links for all previous steps on THIS PAGE.

For log generation, We volition use Apache Log4j Logging service. It Is real practiced service to generate assay out execution log for our selenium webdriver information driven framework project.

How To Generate Log
As you lot know, We convey already added required Apache Log4j software Logging service scandalise file "log4j-1.2.17.jar" In our project's construct path during webdriver framework creation STEP 3 as well as STEP 4. If you lot convey non followed those steps hence delight do so. So right away you lot are gear upwards to role Apache Log4j Logging service.

Now, You convey to add together "log4j.properties" file nether "src" folder of your project. "log4j.properties" file contains all the settings for log generation. I convey prepared "log4j.properties" file amongst all the required settings to generate the assay out execution log.

Also you lot convey to do "applog.log" file nether "com.stta.Logging" packet to shop the execution log.

Download Required Files To Enable Logging
As described above, you lot necessitate "log4j.properties" as well as "applog.log" files to generate as well as shop execution log. 
  • I convey created "log4j.properties" file as well as laid all required properties to generate execution log.
  • I convey created "applog.log" file. "applog.log" file Is only blank file to shop log In It.
  • I convey Implemented sample Logs In "SuiteBase.java", "SuiteOneBase.java" as well as "SuiteOneCaseOne.java" files to explicate you lot how to generate assay out execution log. 
  • Right now, I convey Implemented assay out execution log solely In "SuiteOneCaseOne.java" assay out case. Based on that, You tin Implement test execution log In all other assay out cases likewise past times your self.
Download bellow given nothing folder to teach all higher upwards required files for log generation.
Extract the folder as well as copy-paste files every bit described bellow.
  • Paste log4j.properties File on "src" folder of "WDDF" project.
  • Paste applog.log File on com.stta.Logging Package.
  • Paste SuiteBase.java File on com.stta.TestSuiteBase Package.
  • Paste SuiteOneBase.java File on com.stta.SuiteOne Package.
  • Paste SuiteOneCaseOne.java File on com.stta.SuiteOne Package.
Note : Do non alter whatever affair "log4j.properties" file.
Now your selenium webdriver information driven framework project's construction volition expression similar bellow.



Running Test To Generate Execution Log
Now nosotros are gear upwards to run our software assay out suites to verify that execution log Is generated every bit expected or not. Run your assay out suites using testng.xml file.

On completion of assay out execution, execution log volition last generated as well as stored Inside applog.log file. If you lot volition open applog.log file, It volition looks similar bellow.


Note : Above log Is solely for "SuiteBase.java", "SuiteOneBase.java" as well as "SuiteOneCaseOne.java" files. You tin Implement log In all your assay out cases In same way. You tin role bellow given syntax to Insert log In whatever assay out representative or suite files.

Add_Log.info("Your Log Text");

So nosotros convey successfully Implemented assay out execution log generation business office In our selenium automation framework, And right away our selenium software assay out information driven framework Is able to generate assay out execution log.


More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post