Netbeans JUnit Tests Tutorial

I'm assuming that you are working on a project and would like to create a JUnit test file using Netbeans. For your information, I'm currently using Netbeans 6.7. My simple tutorial here will be using SudSolver v0.23(the download link is on the right bar).

1. Right click on the file that you wish to test -> Tools -> Create JUnit Tests (shortcut key: Ctrl + shift +U)
2. Click ok. The class name needs to be appended with "Test". Other than that, it's ok to change the class name though it's recommended to stick to the default. As for the checkboxes, you can leave them as they are. You can modify them those things in the test file later anyway.

3. Modify the class however you want it. I recommend reading the following JUnit tutorial. You may refer to my SudokuTest.java to see how I implemented it.

4. Once you're done, right click on the test file -> Test File (shortcut key: Ctrl + F6) or right click on the file that you're testing -> Test File. The difference between the two methods is that the latter will run all test files associated with the file being tested.

SudSolver v0.23

I created the JUnit test file to replace my older testing methods. View the tutorial for JUnit test file to see how it works.

In the next version, the random puzzle button and the brute force search should work correctly(I hope).

Random puzzle and brute force search

I have been trying to implement the "random puzzle" function. So far, I have two versions of it in my program and both are behaving in a weird manner.

After some investigations I found out that my brute force search function isn't correct actually. It gives the correct solution in some situations but in tough cases where the number of solved cells is low, it doesn't solve the puzzle correctly.

I should mention that there's also the possibility that my function is correct, but I didn't get the correct result because of memory restrictions(from the way I implement the function, quite a lot of memory has to be consumed to hold all the temp variables).

Anyway, I'm currently working on a correctly implemented brute force search and hopefully, in my next version, you'll also see a working "random puzzle" button.