Newer
Older
labs / tiddlers / content / labs / lab02 / _Labs_02_Make the Tests Fail.md

Let's see what happens when we run the tests without actually implementing them. Use <

Test Project">>. This causes NetBeans/Gradle to run all of the tests that it can find in the project. Basically, NetBeans tells Gradle to run the tests, then Gradle finds them and runs them, and reports the result back to NetBeans which displays the results to you. IDEs like NetBeans usually have very good integration with major testing frameworks like JUnit.

You will see a pop-up window in the lower right corner of NetBeans that tells you that two tests were run successfully. That message box has an <

> link in it --- click the link. If the dialog vanishes before you can click the link, you can open the test results pane using < IDE Tools > Test Results">>.

You will see the test results pane that tells you that all tests passed. That is not ideal since we haven't implemented them yet. It is a convention that we explicitly make all tests fail to remind us to come back to implement them. Add the following line of code to both test methods to cause the tests to fail:

fail("not implemented yet");

You may need to import the fail method if NetBeans is complaining about it (via red squiggly lines under the method name). Use <

Fix Imports">> to do this.

Run the tests again. You should see that they now fail. This is what we want --- we will remember to come back and add the real testing code now since the tests will keep failing until we complete them.