AnsweredAssumed Answered

How to resolve relative file paths from within a test blaze rule?

Question asked by pedro.silva@wonga.com on Jul 2, 2015

I saw an example of a brUnit test that extends NdJavaTestCase that calls getBaseFilePath to resolve relative paths to files...
Like on the NdTestCase documentation in C:/Blaze/Advisor72/doc/api/server/com/blazesoft/test/framework/NdTestCase.html

 

basePath = getBaseFilePath();

testFile = new File(basePath + "mySimpleTest.xml");

 

Is there something similar when the test is implemented as a blaze advisor function having TestRole="Test"?

I would like to open an xml file from the function without specifying the full path to it...
Is it possible to embed this file into the project as some kind of resource?

I tried to use the code below after I imported the file as a resource from the local file system to my eclipse project but it is not working:

ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

URL resource = classLoader.getResource(name);

 

 

Regards,

Pedro

Outcomes