Selenium.docx

  • Uploaded by: Shriya Shri
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Selenium.docx as PDF for free.

More details

  • Words: 296
  • Pages: 2
In order to execute the remaining statements even if it is failed we use SoftAssert. SoftAssert has all the methods of assert class but all of them are non static. When we use softassert statement(assertequals) it will only compare actual result with expected result. And it will not report the status. In order to report the statuswe use assertAll. Make the assertAll statement as the last statement in the method. Ex: public void testA(){ SoftAssert sa=new SoftAssert(); System.out.println(“Please enter expected title:”); Scanner sc=new Scanner(System.in); String etitle=sc.nectLine(); WebDriver driver=new ChromeDriver(); Driver.get(http://www.google.com); String title=driver.getTitle(); Reporter.log(title,true); Sa.assertEquals(title,etitle); Driver.close(); Sa.assertAll(); } @test Public void testB(){ Reporter.log(“testB”,true); }

What are the differences b/w assert and SoftAssert? 1.It will not execute remaining statements of current test method if the comparison fails. It will execute remaining statemnts of current test method even if the comparison fails. 2.All the methods are static. All the methods are Non-static. 3.We do not call assertAll(). We must call assertAll().

When to use assert and When to use SoftAssert If we are testing basic and critical features then we use assert statements. When ever we are testing minor features then we use SoftAssert. NOTE: While comparing the results we take actual results from application and we take expected result from excel sheet. In order to handle excel file we use API given by APACHE called POI. POI stands for Poor Obfuscation Implementation. It can be downloaded from following url: https://poi.apache.org/download.html Latest version POI 4.0.1. Goto binary distribution. If the OS is windows download the zip file or else download the tar.gz file. After downloading extract the file. Note: After extracting we get 19 jar files out of that following 6 jar files are mandatory to read and write the data in excel. 1.commons-collections4-4.2.jar 2.commons-compress-1.18.jar. 3.poi-4.0.1.jar. 4.poi-ooxml-4.0.1.jar. Poi-ooxml-schemas-4.0.1.jar. 6.xmlbeans-3.0.2.jar.===

More Documents from "Shriya Shri"