Instead of writing a custom logic, the TestNG library itself offers the facility to perform Soft Assertions in your test.
To use testng soft assertion, you have to use testng SoftAssert class. This class will helps to not throw an exception on assertion failure and recording failure. If you will use soft assertion then your test execution will remain continue even If any assertion fails. Another most Important thing Is your assertion failure will be reported In report so that you can view It at end of test. You can use soft assertion when you are using multiple assertions In same test method and you wants to execute all of them even If any one In between fails.
To use testng soft assertion, you have to use testng SoftAssert class. This class will helps to not throw an exception on assertion failure and recording failure. If you will use soft assertion then your test execution will remain continue even If any assertion fails. Another most Important thing Is your assertion failure will be reported In report so that you can view It at end of test. You can use soft assertion when you are using multiple assertions In same test method and you wants to execute all of them even If any one In between fails.
SoftAssert s_assert = new SoftAssert();
@Test //In this method, Test execution will not abort even If any assertion fail. Full Test will be executed. public void soft_assert_text() { Actualtext = driver.findElement(By.xpath("//h2/span")).getText(); //Text on expected side Is written Incorrect intentionally to get fail this assertion. s_assert.assertEquals(Actualtext, "Tuesday, 01 January 2014", "1st assert failed."); System.out.println("Soft Assertion -> 1st pagetext assertion executed.");
Software testing is an investigation conducted to determine the quality and performance of a product under test. This validation provides clear and independent review about the software. Software testing professionals have huge demand in leading software development industries.
ReplyDeletetesting training in chennai
Thanks for sharing informative article on TestNG Soft Assertions. Your code is working great and recommended for software testing professionals.
ReplyDeleteQTP Course In Chennai
Thanks for your informative post; selenium is portable automation testing tool to validate the performance and behavior of a software application or environment.
ReplyDeleteBest Selenium training institute in Chennai
This comment has been removed by a blog administrator.
ReplyDeleteThank you for sharing TestNG soft Assertions. We also have another simple way for Soft Assertion which will not fail the test
ReplyDelete@Test
public void testForSoftAssertWithNoFailure() {
softAssert.assertTrue(false);
}
Test Automation
Thanks for sharing it Pavithra.
DeleteMyself mathews, working as a software tester in leading software development firm. Having a blog is very useful for me to share my experience and get assistance from co-software testing professionals. You can explore my blog @ software testing training in chennai.
ReplyDeleteExcellent article!!! LoadRunner is popular automation testing tool used for validating a software application/system under load. It delivers most precise information about the performance, functionality and behavior of the software product. Loadrunner Course in Chennai
ReplyDeleteI learned a lot at thedevmasters.com. It is an amazing service special there mentoring program gave me real hand on experience in troubleshooting. I was able to create a full selenium testing Project in less than 4 hour time all by myself. Amazing professional team of mentors and software educators.
ReplyDeleteDevMaster also got me selenium testing . They gave very good exam preparation material
Visit www.thedevmasters.com and robin@thedevmasters.com, 1(866)340-1375
Good one. Check this Selenium Automation Testing Framework
ReplyDeleteThanks for sharing such a informative blog with us..
ReplyDeleteSoftware Testing Course at Learn Software Testing. We prepares individuals with current digital skills for the competitive global workforce.
Your information about Selenium scripts is really interesting. Also I want to know the latest new techniques which are implemented in selenium. Can you please update it in your website? Selenium testing training in Chennai
ReplyDeleteHi, this is Yasmin from Chennai. I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog. Thanks..
ReplyDeleteRegards.
Selenium Training in Chennai | Selenium Training in Chennai
Assam 2564 Police Constable Recruitment 2016 Apply Online
ReplyDeleteGood post. This is a very clear, informative and helpful post for all people...........
Naval Dockyard Visakhapatnam Tradesman Skilled Recruitment 2016
ReplyDeleteThank you, This is a very clear, informative and helpful post.......
Mobile application testing is the application software that is developed to handle hand held mobile devices. The testing in mobile application can be done by automated or maual type.
ReplyDeleteMobile Application Testing Training in Chennai | mobile application testing | Appium Training in Chennai
ReplyDeleteThis is excellent information. It is amazing and wonderful to visit your site.Thanks for sharng this information,this is useful to me...
Android training in chennai
Ios training in chennai
ReplyDeletei am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up
PSD to Wordpress
wordpress website development
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteHardware training| Networking training in chennai | Hardware and networking in chennai KK nagar
Embedded Training| Embedded in chennai| Embedded training in chennai| best training institute in chennai
Best training in Blockchain in kk nagar chennai |Check Best Training @ Chennai in KK nagar, vadapalani in chennai |Blockchain institute in Chennai | Blockchain
Check Best Digital Marketing Training institute in KK nagar, Chennai | Software Courses| Real time Projects
This post shares some valuable information.
ReplyDeleteAWS Training in Bangalore
AWS Training in Chennai
AWS Training in BTM
AWS Training in Marathahalli
Best AWS Training in Marathahalli
Data Science Courses in Bangalore
DevOps Training in Bangalore
PHP Training in Bangalore
DOT NET Training in Bangalore
Spoken English Classes in Bangalore