• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Multi AssertEquals

 
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Scala IntelliJ IDE Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 42165
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic