Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-dev] enable assert during tests?

Hi

I happened to realize that JDT tests are executed without the recommended "-ea" switch, both during gerrit tests and during production builds. I also took a few samples of other tests and nowhere could I find "-ea".

Shouldn't this be globally enabled for all tests?
Bonus question: can this be set globally without interfering with individual test bundles declaring <tycho.surefire.argLine>?

For test launches in the IDE this was fixed via https://bugs.eclipse.org/479553 so why do those builds behave differently?

Scanning the code I could not find an overwhelming number of assert statements in productive code, but if we promise that those will be checked during tests maybe we can encourage developers to make more use of this facility (despite how it failed to deliver the promised support for design-by-contract ... remember the long-time #1 hit in the Java Bug Parade? ...).

That said, in my case I was actually happy that one test run did NOT have "-ea" because it detected one of the stupidest mistakes I had made: putting a state-changing operation into "assert". Ergo: ideally between gerrit and production builds one should *enable* assert, the other should *disable* to get maximum coverage.

best,
Stephan


Back to the top