Hi,

Prior to installing a specific test class into my test suite, I create a
separate source file and define the tests and environment inside it.
Selecting Ctrl-F6 while focused on that tab inside NetBeans runs the tests
as expected.

However, if the test fails and I go and investigate the issue, I end up
being focussed on another source tab (e.g a java class file where I made
the correction). In order to re-run the test, I have to first focus back to
the tab containing the test defined above before I can use Ctrl-F6

I have discovered that I could make sure that if the test file has the same
file (class) name as the class that I made the correction in, Ctrl-F6 would
identify the test to run by matching the file name. This is too restrictive
as the file I made the correction in is likely to be in another class, so
again, I have to first focus back on the tab before using Ctrl-F6.

Netbeans publishes "Could not find tests for selected files. Skipping
execution." in the status bar.

I have found that in "Run > Set Project Configuration > Customize" from the
Netbeans Menu Bar, in the left hand Panel there is a Category of 'Actions'
and selecting that, gives me a list of Actions, one of which is "Test file".

This has two fields filled in and looks like Maven commands (I am working
with a Maven project).

"Execute goals:" process-test-classes surefire:test
"Set Properties:" test=${packageClassName}

The "test=" property looks promising. Looking at the on-line documentation
under https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html,
it seems to imply that I can set the 'test' parameter to a specific file
name. This is exactly what I want as I am quite happy to amend the
parameter back to its default or to another file once I have completed the
development for  the specific test class.

I have tried amending the parameter (say that my test file name is
EnvironmentTest.java, containing the class EnvironmentTest) to the
following variants :-

test=EnvironmentTest   // This is what the Maven documentation seems to
think it should be
test="EnvironmentTest"

test=${EnvironmentTest}     // These two based on the help that Netbeans
has published with the panel indicating that 'className - name of a
specified class - e.g. String' is a suitable replacement for
'packageClassName'
test=${"EnvironmentTest"}

All of the above have no effect on the use of Ctrl-F6. Interestingly,
whatever I change the 'test' parameter to, the Ctrl-F6 still works when
focused on the test file tab (i.e. EnvironmentTest.java), which makes me
think that the changes are being ignored.

I could provide screenshots to illustrate the environment if my description
has not been clear.

Has anyone advice as to how I might make my testing more streamlined or has
an alternative methodology that they use.

Thanks in advance,

John (Barrow)

Reply via email to