Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Multi AssertEquals  RSS feed

 
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I am currently is writing an automated test though I am not sure how to handle multiple AssertEquals.

This is my code

if following statements below all of them are true
then print ("test")






Any ideas how to do this nice and smooth?

Thank you in advance
Regards

Xsi
 
Xsi jadu
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:This discussion would fit better in our testing forum. Moving.



I don't agree since its java development I am sure I get more answers in java section.... regardless its for test purpose...
 
Saloon Keeper
Posts: 9707
192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by doing it "nice and smooth"?

What's wrong with what you have now?
 
Ranch Hand
Posts: 239
12
Eclipse IDE IntelliJ IDE Java Scala Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One alternative might be to implement an equals() (or deepEquals?) method in RumbaLabel that compares all the fields you care about and just check that partnr is equal to an instance of RumbaLabel with those values. The problem with such an approach, though, is that it would move visibility of what exactly is different out of the test, so I wouldn't recommend it.
 
author & internet detective
Posts: 39129
723
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend using the optional string parameter. That way you know which field is wrong without having to go into the code.

Also, consider using assert softly so you can see all of the assertion failures in one go.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!