Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Unit Testing in Java How to Test Running Tests and Reading Output

Test isn't running correctly unless i rebuild project

This is what's happening: 1- Run test with empty method body. result: SUCCESS 2- Add fail(); to the body of the method and run test. result: SUCCESS (should be FAIL!) 3- Rebuild project and run test again. result: FAIL.

So, as you see I don't get the correct result unless i rebuild the project (build->Rebuild project).

I'm using IntelliJ IDEA 15 CE.

What do you think might it be? is there some settings i should change? Thanks.

1 Answer

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hmmm...try to again right click the test directory and choose "Run all tests". Only thing I can think of is that it is a messed up Run Configuration.

Yes! it's a Run Configuration thing. Thanks.

Solution:

  1. Run -> Edit Configurations.
  2. Add Make in "Before Launch: Make, Activate tool window".