Can anyone explain which all methods are contained by Hard Assertion

0 votes
May 14, 2019 in Selenium by Monika
705 views

1 answer to this question.

0 votes

Hello @Monika, a Hard Assertion contains following methods:

  • AssertEquals: It is used to compare the actual and expected results. If both the actual and expected results are same, then the assertion pass with no exception and the test case is marked as "passed". If both the actual and expected results are not the same, then the assertion fails with an exception and the test case is marked as "failed". Syntax of an AssertEquals() method is given below:

    • Assert.assertEquals(actual,expected);  
  • AssertNotEquals: It is opposite to the function of AssertEquals() method. AssertNotEquals() is a method used to compare the actual and expected results. If both the actual and expected results are not the same, then the assertion pass with no exception and the test case is marked as "passed". If both the actual and expected results are same, then the assertion fails with an exception and the test case is marked as "failed". Syntax of an AssertNotEquals() method is given below:

    • AssertNotEquals(actual,expected,message);  
  • AssertTrue: Assertion verifies the boolean value returned by a condition. If the boolean value is true, then assertion passes the test case, and if the boolean value is false, then assertion aborts the test case by an exception. Syntax of AssertTrue() method is given below:

    • Assert.AssertTrue(condition);  
  • AssertFalse: This verifies the boolean value returned by a condition. If the boolean value is false, then assertion passes the test case, and if the boolean value is true, then assertion aborts the test case by an exception. Syntax of AssertFalse() method is given below:

    • Assert.AssertFalse(condition);
  • AssertNull: It is a method that verifies whether the object is null or not. If an object is null, then assertion passes the test case, and the test case is marked as "passed", and if an object is not null, then assertion aborts the test case and the test case is marked as "failed". Syntax of AssertNull() method is given below:

    • Assert.assertNull(object);  
  • AssertNotNull: AssertNotNull() is a method that verifies whether the object is null or not. If an object is not null, then assertion passes the test case and test case is marked as "passed", and if an object is null, then assertion aborts the test case and test case is marked as "failed". Syntax of AssertNotNull() method is given below:

    • Assert.assertNotNull(object);  
answered May 14, 2019 by Pratibha
• 3,690 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What all test methods are provided by Assert class in JUnit?

Hello Apeksha, JUnit provides static methods in the ...READ MORE

answered Oct 17, 2019 in Selenium by Abha
• 28,140 points
7,076 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,756 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,182 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,255 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,893 views
0 votes
2 answers

What are the wait methods which can be used to handle AJAX calls?

Hi , for Ajax call better to use Explicit ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
1,621 views
0 votes
1 answer

Can anyone explain how an AJAX call can be handled in Selenium webdriver?

Hello Megha, to demonstrate how AJAX calls are ...READ MORE

answered May 9, 2019 in Selenium by Pratibha
• 3,690 points
1,434 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP