0

I am writing unit tests and want to test parsing of an XML document. To parse not too complicated XML document I use standard NSXMLParser and state pattern.

I will test proper parsing of a document by checking result object created by NSXMLParserDelegate. I will have some proper XML files and some improper ones.

Should I also check each state-class separately, or is checking only final result enough ?

Added after Edit
By state-class I mean ConcreteState in State Pattern.
My NSXMLParserDelegate has its own delegates which have only three methods:
- didStartElement
- didEndElemenn
- foundCharacters

Each of my State-class implements above methods and stores data or,and changes NSXMLParserDelegate state to another State-class.
I think that this is quite standard ...

My question is:
Should I unit test each State-class (ConcreteState) or is it enough to test only parsing of specially prepared correct and incorrect XML files?

jaco0646
  • 15,303
  • 7
  • 59
  • 83
MichK
  • 3,202
  • 3
  • 29
  • 33

0 Answers0