Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Testify | 20,997 | 14,688 | 77,233 | 20 hours ago | 42 | May 30, 2023 | 411 | mit | Go | |
A toolkit with common assertions and mocks that plays nicely with the standard library | ||||||||||
Mockito | 14,328 | 38,950 | 14,259 | 14 hours ago | 346 | November 02, 2023 | 367 | mit | Java | |
Most popular Mocking framework for unit tests written in Java | ||||||||||
Mockery | 10,505 | 112,379 | 18,411 | 4 days ago | 41 | August 06, 2023 | 106 | bsd-3-clause | PHP | |
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). | ||||||||||
Go Sqlmock | 5,523 | 1,435 | a month ago | 21 | June 28, 2020 | 76 | other | Go | ||
Sql mock driver for golang to test database interactions | ||||||||||
Mockery | 5,214 | 314 | 7 days ago | 151 | November 21, 2023 | 33 | bsd-3-clause | Go | ||
A mock code autogenerator for Go | ||||||||||
Mockk | 5,159 | 7 days ago | 257 | apache-2.0 | Kotlin | |||||
mocking library for Kotlin | ||||||||||
Powermock | 4,089 | 8,089 | 2,314 | 6 months ago | 38 | November 01, 2020 | 448 | apache-2.0 | Java | |
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable. | ||||||||||
Pester | 2,968 | 42 | 6 | 5 days ago | 91 | April 05, 2023 | 163 | other | PowerShell | |
Pester is the ubiquitous test and mock framework for PowerShell. | ||||||||||
Vcrpy | 2,489 | 860 | 170 | 2 months ago | 70 | July 31, 2023 | 137 | mit | Python | |
Automatically mock your HTTP interactions to simplify and speed up testing | ||||||||||
Nsubstitute | 2,418 | 9 days ago | 118 | other | C# | |||||
A friendly substitute for .NET mocking libraries. |
Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to good design, but this is not always the case. For example final classes and methods cannot be used, private methods sometimes need to be protected or unnecessarily moved to a collaborator, static methods should be avoided completely and so on simply because of the limitations of existing frameworks.
PowerMock is a framework that extends other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more. By using a custom classloader no changes need to be done to the IDE or continuous integration servers which simplifies adoption. Developers familiar with the supported mock frameworks will find PowerMock easy to use, since the entire expectation API is the same, both for static methods and constructors. PowerMock aims to extend the existing API's with a small number of methods and annotations to enable the extra features. Currently PowerMock supports EasyMock and Mockito.
When writing unit tests it is often useful to bypass encapsulation and therefore PowerMock includes several features that simplifies reflection specifically useful for testing. This allows easy access to internal state, but also simplifies partial and private mocking.
Please note that PowerMock is mainly intended for people with expert knowledge in unit testing. Putting it in the hands of junior developers may cause more harm than good.
@PowerMockIgnore
as well as bug fixes and other improvements. See release notes and change log for details.Please, read the guideline for a new contributor before start.
Join the mailing-list here for questions, feedback and support.