Thursday, 5 June 2014

TestNG Soft Assertions

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.

SoftAssert s_assert = new SoftAssert();

   //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."); 


  1. 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.

    testing training in chennai

  2. Thanks for sharing informative article on TestNG Soft Assertions. Your code is working great and recommended for software testing professionals.
    QTP Course In Chennai

  3. Thanks for your informative post; selenium is portable automation testing tool to validate the performance and behavior of a software application or environment.
    Best Selenium training institute in Chennai

  4. This comment has been removed by a blog administrator.

  5. Thank you for sharing TestNG soft Assertions. We also have another simple way for Soft Assertion which will not fail the test

    public void testForSoftAssertWithNoFailure() {

    Test Automation

  6. Myself 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.

  7. Excellent 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

  8. I learned a lot at 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.
    DevMaster also got me selenium testing . They gave very good exam preparation material
    Visit and, 1(866)340-1375

  9. Thanks for sharing such a informative blog with us..

    Software Testing Course at Learn Software Testing. We prepares individuals with current digital skills for the competitive global workforce.

  10. 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

  11. Thanks for sharing informative article on mobile testing. It helped me to understand the future of mobile application development and need of mobile application testing training. Think of joining mobile application testing training in Chennai from reputed IT placement or training academy.

  12. Thanks for sharing this information. I read your blog and found it very useful. I used i in my training as it is easy to understand for beginners. It is important to make sure that the software application working precisely for the reason it originally designed for.
    best software testing training institute in Chennai | mobile application testing training in T Nagar | best software testing training institute in Chennai

  13. Hi, 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..
    Selenium Training in Chennai | Selenium Training in Chennai

  14. Assam 2564 Police Constable Recruitment 2016 Apply Online

    Good post. This is a very clear, informative and helpful post for all people...........

  15. 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.
    Mobile Application Testing Training in Chennai | mobile application testing | Appium Training in Chennai

  16. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    salesforce training in chennai | salesforce training institute in chennai


  17. This 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


  18. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Android App Development Company

  19. This article is very much helpful and i hope this will be an useful information for the needed one.Keep on updating these kinds of informative things...
    iOS App Development Company
    iOS App Development Company

  20. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    <Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text
    Mobile Marketing Services
    mobile marketing companies
    Sms API

  21. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India


  22. i 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

  23. The information which you have provided is very good. It is very useful who is looking for selenium Online course Hyderabad

  24. Hey there! I know this is kind of off-topic, but I’d figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?
    iosh course in chennai