Convert data file to Java static class constants for JUnit

russian

New Member
I had written few JUnit classes for my app, but I would like to now separate my test data (which is hardcoded now) from the code to a data-only text file/properties file/xml/whatever.So I can easily give various test datas without modifying my JUnit.I was thinking about putting them in a text file, and use a parser to parse it at the very beginning of my JUnit suite, and convert all of the data to a Java static class constants, so I can easily refer it anywhere in my JUnit.\[code\]public final class TestDataConstants {public static final String username = "xbeta";public static final String password = "test123!";public static final String authToken = "f17bf9c8-9d38-47af-a053-210130cac6f7";...}\[/code\]Now I know I can easily write a parser for this, but I'm asking 2 questions for people who had done this before in the past with experience[*]What format is the best and should be using for storing these test data?[*]What are some ways to convert these test data files to Java static class? Like generating Java code on-the-fly using Java.Thanks in advanced.
 
Back
Top