I came across Google Truth https://google.github.io/truth/ and thought to try it out. I read the information on that site but still have a basic question.
Is Truth a substitute for JUnit? How should I write the @test methods and test suites the way I write in JUnit and automate the test execution say through Jenkins? Or is it that Truth is just about making your assertion code beautiful and everything else stays the same?
Does Truth still needs help of JUnit framework (or something like JUnit)?
Thanks!
What is Truth? Truth makes your test assertions and failure messages more readable. Similar to AssertJ, it natively supports many JDK and Guava types, and it is extensible to others. Truth is owned and maintained by the Guava team. It is used in the majority of the tests in Google's own codebase.
You use an assert method, provided by JUnit or another assert framework, to check an expected result versus the actual result. These method calls are typically called asserts or assert statements.
There are several JUnit extensions such as: JWebUnit. XMLUnit. Cactus.
No, Google Truth isn't a full replacement for JUnit/TestNG. Truth is an assertion framework which allows you to write assertions more flexibly (see their Comparison page for details).
Truth however doesn't have a concept of tests/test suites/test runs/... so you'll still need a testing framework (like JUnit or TestNG) to actually execute your tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With