How to deal with the test data in Junit?

后端 未结 5 1288
情书的邮戳
情书的邮戳 2021-01-05 15:13

In TDD(Test Driven Development) development process, how to deal with the test data? Assumption that a scenario, parse a log file to get the needed column. For a strong test

5条回答
  •  Happy的楠姐
    2021-01-05 15:35

    Maven, for example, uses a convention for folder structures that takes care of test data:

    src
      main
        java           <-- java source files of main application
        resources      <-- resource files for application (logger config, etc)
      test
        java           <-- test suites and classes
        resources      <-- additional resources for testing
    

    If you use maven for building, you'll want to place the test resources in the right folder, if your building with something different, you may want to use this structure as it is more than just a maven convention, to my opinion it's close to 'best practise'.

提交回复
热议问题