• 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

Reading test data from a file and doing i/o in a test class.

 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am planning to store the test data in a file and make a program to read it because i have lot of different test data to input.
and would use StringTokenizer for that and use TAB (\t) as a delimiter or separator for columns .

My question is :
1.Would TestNg support that kind (i am new to TestNG) of development?
2.Also my test data is going to include lot of sourcecode and marked up source code with HTML tags as expected and real output.
It would include \t \t all kind of whitespaces.I am kind of worried if Java would messup with \n\t or its going tobe complex using sourcedoe and markups in this format for file.
I am not sure about using XML format for input file too.

Any suggestions would also be appreciated.

like
Language Source Expectedouput
Java Class Test{\n} <span class='k'>Class</span> Test{\n}
XML <Address><city> ......


 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all TestNG is just a framework that automatically runs your tests and collects statistics about them. It also provides some tools, like various assert methods, which can be useful to testing. You actually write the tests though, and you have all of Java and its APIs to work with ... which means that as far as reading input files goes, TestNG supports it because Java does.

For your second question, it's true that parsing complicated input files can be, well, .... complicated. Don't blame Java though! Newlines and tabs won't confuse Java per se, but they might confuse your test program if you're not careful in writing it. XML input can be easier because it forces a well-defined and well-understood format upon the input files, which can be verified independently of your tests. There are also Java parsing frameworks that you can use to jumpstart your parser, and reduce the need to write your own code.
 
reply
    Bookmark Topic Watch Topic
  • New Topic