Dne sobota 5. března 2022 17:22:49 CET, Eric Bresie napsal(a):
> While writing unit tests for my python development (modeled on existing
> unit code in the nbpython codebase) to test "execution of a script", I'm
> having problems injecting the "test.py" code and was hoping someone could
> provide some guidance on standardize unit test setup in Netbeans IDE/Module
> development.
> 
> The previous tests looks for some file in a "target/data" folder which in
> my new codebase is not created in any way.

Using [NbTestCase.getDataDir()](https://github.com/apache/netbeans/blob/
master/harness/nbjunit/src/org/netbeans/junit/NbTestCase.java#L1223).

> So what is the proper way to deal with unit test resources to include
> (1) generate a "test file" in a standardized way (i.e. store in above
> mentioned "target/data" folder)
> (2) reference another file (i.e. a template file associated within the
> code, reference a "test resource", etc.)?

I tend to use `Class.getResource("my.py")` and copy it into a temporary 
directory.

-jt

> I have a "template.py" currently used in "new file creation" which maybe
> could be used and have added a "test resource" hello.py code but not sure
> if there is a standardized way of using either of these in Netbeans unit
> testing.
> 
> Eric Bresie
> [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to