Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:56:54+00:00 2026-05-27T05:56:54+00:00

I have came across many resources which talk about using/not using multiple assertions during

  • 0

I have came across many resources which talk about using/not using multiple assertions during unit testing. But while writing UI level automation integration tests I end up in doing many assertion in one test, which does not seem very bad idea to me, especially when I use soft assertions which fail only during tear down and reporting all assertion failures in a test method, instead of limiting it to one report per test.

One such scenarios is filling a form having 10 fields (text box, drop down etc). Coming back to the form and verifying all entered values are available. What I don’t like with my tests is, it is filled with many assertions. I want to assert all of these values but yet want my tests to look clean and not like –

 public void testMethod() {
  // Some operation here
  softAssert("verification failed for field 1, expected value:" +value, isValuePresent(value));
  softAssert("verification failed for field 2, expected value:" +value, isValuePresent(value));
  softAssert("verification failed for field 3, expected value:" +value, isValuePresent(value));
  // Some more assertions here
}

I could extract these assertions to a different method but then I feel that assertions should be kept in test methods. to make it clear what is being tested in a test method.

Is just a trivial wishy washy feeling I have and such design of tests is justified? Or
I could make design enhancements in my test methods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:56:55+00:00Added an answer on May 27, 2026 at 5:56 am

    you can do what I’d call “assertion by example” which is simply an assertion at the form level. It would look something like this:

    public void testMethod() {
      Form expected = new Form()
                        .field1('value1')
                        .field2('value2')
                        .field3('value3')
                        .field4('value4')
    
      Form result = someFormOperation();
    
      softAssert(expected, result);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have came across many situation where I needed to pass value to an
While testing a program for scalability, I came across the situation where I have
I recently came across the link below which I have found quite interesting. http://en.wikipedia.org/wiki/XOR_linked_list
I have recently read about XSLT and Xpath. But i came across document root
As a new shell developer I came across many new articles that have links
I came across an article about Join decomposition. SCENARIO #1 (Not good): Select *
I came across many other SO question but could not found the answer what
I have came across the following code, and being a C beginner, I came
Few months ago, I have came across a Silverlight tutorial of Eric Cartman (South
I came across this class while reading a C# book and have some questions.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.