• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how many test cases in this case ?

 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Please advise how many test should be there for below method ? And also all test cases should be check in one test method or separate ?




This method is expecting:
(i) car should not be null
(ii) car should not be empty
(iii) car should have at least one character
(iv) car may contain comma separated characters

Bye,
Viki.
 
author & internet detective
Posts: 41878
909
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
Vikrama,
I'm not sure what you mean by a car containing characters.

Another criteria for tests may be an empty list returns vs matching results returned. Each test should definitely be in a separate test method to keep them independent. You want all the tests to run so you know which pass.
 
Vikrama Sanjeeva
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,

Car containing characters is just used for example. This can be string as well. But let's keep it to characters to avoid any confusion.

In my opinion, we should have "at-least" below test cases.

1: car should not be null and empty
2: car should have "at-least" once character
3: Only comma is considered as delimiter
3: return type CarNames should not be null

and then

4: car should be compared against true car value (s)
5: CarNames value (s) should be compared against true CarNames.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First ,

May I know what is that ? a method signature ? with two return type String class an CarNames class ?

Second,
What you want to test? Are you testing the Car class? or are you testing your utility Class with the getCarNames method?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic