![]() ![]() GetResource looks for the file, relative to the Class in the class hierarchy. How to check if you have organised this properly? ![]() Where linksToCheck.txt is a file in the casestudy_002_buildAnHttpLinkChecker folder listed above. I could access a resource in the folder structure from within the LinkCheckerTest using URL fileToRead = ("linksToCheck.txt") The full folder structure for a resource file used by the LinkCheckerTest would be: - src if I have a test called LinkCheckerTest and it is in a package called package .casestudy.casestudy_002_buildAnHttpLinkChecker Īppologies for the length, this is from an example in my Face to Face Java For Testers Training Course The folder hierarchy below resources is my package hierarchy. src\test\resources - for resources available to my test code.src\main\resources - for resources available to my main ’live’ code.I can have two obvious resource folder hierarchies: We make things easy for ourselves by sticking to this layout. How to Create a Resource Folder Structure This is important because your test resources will be put in your test-classes folder hierarchy and your main resources will be put in your classes folder hierarchy - both in your target folder. What is a Resource?Ī resource is a file in the class path folder structure for your project. As evidenced by my own experiences trying to use them and the number of queries on stack overflow. getResourceAsStreamīut, they can be hard to wrap your head around. They are essentially files in the project which are compiled into the. Resources are a very useful concept in Java. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |