JUnit Properties

NbJUnit recognized properties in the junit.properties file

NetBeans extension to JUnit uses a standard JUnit preferences file to store additional information required when using advanced features of NbJUnit. The junit.properties file is a standard property file, which is stored in the user's home directory (as defined in the user.home system JVM property). Properties recognized by NbJUnit:

  • nbjunit.diff.impl - name of the Java class implementing the org.netbeans.junit.diff.Diff inteface. This class performs a 'diff' between files. In NBJunit, an extension is available - org.netbeans.junit.diff.SimpleDiff - for simple comparisons (this class decides only whether the compared files are equal or not, it does not provide any additional information) and org.netbeans.junit.diff.NativeDiff for comparison of native code (e.g. diff utility on Unix machines).
    • Please note, SimpleDiff is a rather trivial implementation of the diff command, so we recommend using native diff whenever possible.
  • nbjunit.diff.impl.CmdLine - used only when nbjunit.diff.impl is set to org.netbeans.junit.diff.NativeDiff class. This property contains the command line, which is called from the NativeDiff class to perform comparison. This property also uses '%TESTFILE%' and '%PASSFILE%' variables (understood by NbJUnit), which are replaced with real file names when running the tests.
  • nbjunit.linediff.context - number of context lines for org.netbeans.junit.diff.LineDiff. It is number of non-different lines added to the diff's output before and after found difference.
  • nbjunit.workdir - path to a directory, which is used as a root for the tests' working directories (for details see JavaDoc for NbTestCase.getWorkDir()).

Here's an example of a junit.properties file:

   nbjunit.workdir=/space/netbeans/tests/workdir
   nbjunit.diff.impl=org.netbeans.junit.diff.NativeDiff
   nbjunit.diff.impl.CmdLine=/usr/bin/diff -bw %TESTFILE% %PASSFILE%
   nbjunit.linediff.context=0
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo