GithubHelp home page GithubHelp logo

peterxiao / testable-mock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/testable-mock

0.0 0.0 0.0 649 KB

换种思路写Mock,让单元测试更简单

Home Page: https://alibaba.github.io/testable-mock/

License: MIT License

Java 100.00%

testable-mock's Introduction

TestableMock

换种思路写Mock,让单元测试更简单。

无需初始化,不挑测试框架,甭管要换的是私有方法、静态方法、构造方法还是其他任何类的任何方法,也甭管要换的对象是怎么创建的。写好Mock定义,加个@MockMethod注解,一切统统搞定。

阅读这里了解更多故事。

特别说明

  1. 如遇到"Attempt to access non-static member in mock method"错误,参见常见问题第8条
  2. 如果有遇到其他任何使用问题和建议,请直接在Issue中提出,也可通过Pull Request提交您的代码,我们将在24小时内回复并处理

版本计划

TestableMock正在持续迭代演进,以下版本计划可能在开发过程中发生调整

  • 0.4 当前版本,进行中的工作内容参考Issue清单
  • 0.5 实现以"独立Mock类"为单元的Mock方法复用机制,让测试类之间可以方便复用相同的Mock方法
  • 0.6 实现将Mock方法的默认生效范围缩小至当前被测类,避免Mock方法在测试类之间相互影响
  • 1.0 功能稳定,一个崭新的开始

目录结构

|-- testable-parent       ➜ 提供各子模块的公共父pom文件
|-- testable-all          ➜ 依赖聚合,便于一次性引用所有子模块功能
|-- testable-processor    ➜ 编译期代码预处理模块,提供测试辅助功能
|-- testable-agent        ➜ JavaAgent模块,提供Mock测试相关功能
|-- testable-core         ➜ 基础功能模块,提供Mock相关注解和工具类
|-- testable-maven-plugin ➜ Maven插件模块,用于简化JavaAgent注入
|-- demo
|   |-- java-demo         ➜ Java语言的示例代码
|   `-- kotlin-demo       ➜ Kotlin语言的示例代码
`-- docs                  ➜ 项目使用文档

构建项目

主项目使用JDK 1.6+和Maven 3+版本构建,其中demo子项目需要JDK 1.8+版本。

mvn clean install

本地生成文档

docsify serve docs

TestableMock文档使用docsify工具生成,构建前请安装nodejs运行时,并使用npm install -g docsify命令安装文档生成工具。

testable-mock's People

Contributors

linfan avatar ningtalk avatar

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.