Comments (14)
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.
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.
Also, AssertJ. http://joel-costigliola.github.io/assertj/
from truth.
@jaredsburrows what library did you end up using?
from truth.
I'd be interested in the comparison with FEST, as Truth seems very similar.
from truth.
AssertJ seems to be the most complete of the lot. I wonder if Truth has some advantages over it at the moment.
from truth.
Me either
from truth.
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.
I currently use Hamcrest. I am thinking of switching to AssertJ. Why would I use Truth over AssertJ?
from truth.
@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.
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.
@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.
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.
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)
- Consider reducing ImmutableList array copying HOT 1
- Wanted: Truth8Junit to support Java 8 types with assume() HOT 3
- Compatibility with gradle 7.6 HOT 2
- UsingCorrespondence should fail on use of equals(), like Subject does
- 1.1.4, Guava update leads to java.lang.UnsupportedOperationException at WindowsSecurityDescriptor.java:358 HOT 2
- Add StringSubject isNotBlank or hasText HOT 2
- Idk
- com.google.guava:guava library version update HOT 2
- Matching on exact class type, not a subtype HOT 2
- Can Truth assert a method throw exception? HOT 1
- Protobuf: allow unpopulated required fields when `comparingExpectedFieldsOnly` HOT 5
- Truth 1.1+ depends on Java 8 bytecode HOT 3
- FAQ entry: Why we don't support multiple chained calls to assertion methods on the same Subject HOT 3
- Port a core set of unit tests to kotlin HOT 2
- JUnit5 support for the existing soft-assertions support (Expect.create JUnit4 Rule) HOT 5
- Document when arrays are compared by their contents vs. their object identity HOT 3
- New extension for Gradle's TestKit HOT 1
- Asymmetric matchers like Jest's expect.stringContaining("") ? HOT 3
- Add MapSubject#containsAnyOf HOT 2
- Allow logical operations on assertions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from truth.