I use multiple programming languages and writing automated tests is one of the confusing parts. This is a cheat sheet to quickly check the difference of testing libraries.
Go
Go’s standard testing package doesn’t provide assert functions. A lot of projects use testify
.
testify
- assert.Equal(t, expected, actual)
- require.Equal(t, expected, actual)
Perl
Test::More
- is(actual, expected)
Python
pytest
- assert expr
Rust
std
- assert_eq!(left, right)
It let developers decide which one is expected
, according to the Rust Programming Language.
Java
Hamcrest
- assertThat(actual, matcher)
JUnit 5
- assertEquals(expected, actual)
TestNG
- assertEquals(actual, expected)
Source: posts/2020/expected-actual.md