All Projects → powermock → Powermock

powermock / Powermock

Licence: apache-2.0
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Powermock

Mimic
Seamless client side mocking
Stars: ✭ 380 (-89.75%)
Mutual labels:  mocking, mocking-framework
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (-91.18%)
Mutual labels:  mocking, mocking-framework
mock-inspect
Mocks network requests and allows you to make assertions about how these requests happened. Supports auto-mocking of graphQL requests given a valid schema.
Stars: ✭ 19 (-99.49%)
Mutual labels:  mocking, mocking-framework
Kakapo.js
🐦 Next generation mocking framework in Javascript
Stars: ✭ 535 (-85.57%)
Mutual labels:  mocking, mocking-framework
Msw
Seamless REST/GraphQL API mocking library for browser and Node.js.
Stars: ✭ 7,830 (+111.17%)
Mutual labels:  mocking, mocking-framework
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (-94.17%)
Mutual labels:  mocking, mocking-framework
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+235.84%)
Mutual labels:  mocking, mocking-framework
umock-c
A pure C mocking library
Stars: ✭ 29 (-99.22%)
Mutual labels:  mocking, mocking-framework
TestBox
TestBox is a next generation testing framework for ColdFusion (CFML) that is based on BDD (Behavior Driven Development) for providing a clean obvious syntax for writing tests. It also includes MockBox, our mocking and stubbing framework.
Stars: ✭ 54 (-98.54%)
Mutual labels:  mocking
Pook
HTTP traffic mocking and testing made simple in Python
Stars: ✭ 257 (-93.07%)
Mutual labels:  mocking
dummyjdbc
dummyjdbc answers database requests with dummy data to be independent of an existing database.
Stars: ✭ 20 (-99.46%)
Mutual labels:  mocking
Thinktecture.Abstractions
Interfaces for commonly used .NET types like `File`, `Directory`, `Stream`, `Path`, `Math`, `Environment`, `Task`, etc. for better testability.
Stars: ✭ 25 (-99.33%)
Mutual labels:  testability
Aioresponses
Aioresponses is a helper for mock/fake web requests in python aiohttp package.
Stars: ✭ 278 (-92.5%)
Mutual labels:  mocking
node-muk
Mock object methods and dependencies.
Stars: ✭ 57 (-98.46%)
Mutual labels:  mocking
Unmock Plugin
Gradle plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio to use real classes for e.g. SparseArray.
Stars: ✭ 304 (-91.8%)
Mutual labels:  mocking
amoss
Amoss - Apex Mock Objects, Spies and Stubs - A Simple Mocking framework for Apex (Salesforce)
Stars: ✭ 55 (-98.52%)
Mutual labels:  mocking-framework
Firebase Mock
Firebase mock library for writing unit tests
Stars: ✭ 319 (-91.4%)
Mutual labels:  mocking
TestableDesignExample
Sample App to learn a testable design (Smalltalk flavored MVC)
Stars: ✭ 80 (-97.84%)
Mutual labels:  testability
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-99.3%)
Mutual labels:  mocking
Mockingbird
A convenient mocking framework for Swift
Stars: ✭ 302 (-91.86%)
Mutual labels:  mocking

PowerMock

Build Status Maven Central Download Javadoc

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.

News

  • 2019-04-21: PowerMock 2.0.2 has been released and is avaliable in Maven Central. The release includes fixes for issue with PowerMock JavaAgent and the latest JDK and a security issue with the build script.
  • 2019-01-07: PowerMock 2.0.0 has been released. Main changes: offical supporting Mockito 2.x and dropping supporting Mockito 1.x. This release also supports Java 9. Other change read in release notes.
  • 2017-08-12: PowerMock 1.7.1 has been released with one, but significant change: the old API for verifying static mock has been deprecated and a new one has been added. Old API will be removed in version PowerMock 2.0 due to incompatibility with Mockito Public API.
  • 2017-06-16: PowerMock 1.7.0 has been released with support for Mockito 2 (not only beta versions) and new features such as global @PowerMockIgnore as well as bug fixes and other improvements. See release notes and change log for details.
  • 2017-02-03: Johan blogs about how to mock slf4j with PowerMock at his blog

Older News

Documentation

Contributing to PowerMock

Please, read the guideline for a new contributor before start.

Support and discussion

Join the mailing-list here for questions, feedback and support.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].