Code Monkey home page Code Monkey logo

Comments (14)

cgruber avatar cgruber commented on May 22, 2024 5

I'm closing this, as we have a preliminary comparison page here: http://google.github.io/truth/comparison

Any inaccuracies or improvements are welcome, but should be new issues.

from truth.

cgruber avatar cgruber commented on May 22, 2024 2

I wrote a G+ comment about FEST/AssertJ that I should turn into a FAQ answer, but have to dig it out.

The core difference is that the design of Truth includes two specific areas of extensibility - that of a strategy for proposition failure - such that a "subject" for Integers, or a subject for Strings can be re-used in the context of completely different results for failure.  A notable example is the distinction between JUnit's use of AssertionError and it's AssumptionViolationException.  Truth lets you use the same proposition classes for both.

The other area of flexibility is the ability to create new assertion/proposition types and hook them in without declaring possibly conflicting static methods to import.  This can be for new types (say, adding protobufs) or for new uses of existing types (say, Strings that are treated as Uris).  This is the assertAbout() feature.

Other than that, Truth is very similar to AssertJ, since it was inspired by FEST, of which AssertJ is a fork of the 2.0 development line.

Leaving this here for reference until I update the docs.

from truth.

JanecekPetr avatar JanecekPetr commented on May 22, 2024 1

Also, AssertJ. http://joel-costigliola.github.io/assertj/

from truth.

qinfchen avatar qinfchen commented on May 22, 2024 1

@jaredsburrows what library did you end up using?

from truth.

mwanji avatar mwanji commented on May 22, 2024

I'd be interested in the comparison with FEST, as Truth seems very similar.

from truth.

wernight avatar wernight commented on May 22, 2024

AssertJ seems to be the most complete of the lot. I wonder if Truth has some advantages over it at the moment.

from truth.

velo avatar velo commented on May 22, 2024

Me either

from truth.

kevinb9n avatar kevinb9n commented on May 22, 2024

I think the most important ones to compare against are assertj (because it's the strongest) and hamcrest (due to its legacy popularity).

from truth.

jaredsburrows avatar jaredsburrows commented on May 22, 2024

I currently use Hamcrest. I am thinking of switching to AssertJ. Why would I use Truth over AssertJ?

from truth.

jaredsburrows avatar jaredsburrows commented on May 22, 2024

@qinfchen I use AssertJ.

For Java 7 builds(mainly for Android) - I use Squares AssertJ: com.squareup.assertj:assertj-android:1.1.1

For Java 8+ builds or Android +Retrolambda - I use AssertJ 3+: org.assertj:assertj-core:3.4.1

from truth.

qinfchen avatar qinfchen commented on May 22, 2024

thanks! @jaredsburrows Any particular reasons? I am leaning toward using AssertJ as well. Truth is a great assertion library and it woks well in conjunction with other assertion libraries. Hamcrest is more composble and more powerful. Assertj seems to do everything that hamcrest does, but better IMO.

from truth.

jaredsburrows avatar jaredsburrows commented on May 22, 2024

@qinfchen
Google Truth and AssertJ both are very similar. I first saw Square's AssertJ library with Android matchers. I got hooked and started using it everywhere.

Hamcrest is more composble and more powerful.

I find this hard to use as it is not "fluent" like AssertJ is.

from truth.

IgorGanapolsky avatar IgorGanapolsky commented on May 22, 2024

It's funny that Google themselves are advocating Hamcrest, and Hamcrest only (nothing else) here: https://developer.android.com/studio/test/index.html. Don't they think developers should know about other options?

from truth.

jaredsburrows avatar jaredsburrows commented on May 22, 2024

Google uses hamcrest in Espresso. But yes, there are other options.
On Jun 14, 2016 6:18 AM, "Igor Ganapolsky" [email protected] wrote:

It's funny that Google themselves are advocating Hamcrest, and
Hamcrest only (nothing else) here:
https://developer.android.com/studio/test/index.html. Don't they think
developers should know about other options?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#43 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABqMSMLmJLAWXp3XY9T_7suKubYOvOD0ks5qLqo7gaJpZM4AJFIP
.

from truth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.