We had the issue before that we made a mistake in our code which would have been discovered by our unit test. However, when we started the game, the tests were not automatically run. I asked the NetBeans project manager, and he said "ah, just set it up in the project properties". I had no idea how to do that. I had looked at the precise place he suggested, but I did not realise that this was the way to solve my problem. NetBeans is the most flexible Java IDE there is, and we can make it do almost anything. We just need to know how :-) Here is how it works:
When we call "Run" it calls a specific task. When we select Project Properties and go to Actions, we then look for the Action "Run project". Click on it, and the "Execute Goals" shows what steps will be taken to run our game. After the "process-classes" we simply add "test" and then every time we run our game, the tests are also automatically called. Now when we run our game, it won't even try start it until all the tests have passed. Easy as pie!
We hope you enjoyed this tutorial. If you did, you will also enjoy our courses. We suggest you start with Extreme Java - Advanced Java, followed by Extreme Java - Concurrency Performance for Java 8.
We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.
We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...