mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-06 10:20:43 +08:00
add placeholder for english docs
This commit is contained in:
parent
f01ff10fba
commit
d49f526376
@ -11,9 +11,8 @@ Usage Document: https://alibaba.github.io/testable-mock/#/en-us/
|
||||
|
||||
`TestableMock` is still under heavy development, the following version plans may be adjusted during the iteration
|
||||
|
||||
- `v0.4` it's the current version, refer to the [issue](https://github.com/alibaba/testable-mock/issues) list for the work in progress
|
||||
- `v0.5` implementation mock class inherit mechanism, so that the same mock method can be reused between test classes conveniently
|
||||
- `v0.6` narrows the default effective scope of mock methods to the class under test, to avoid interaction of mocking cross classes
|
||||
- `v0.5` it's the current version, refer to the [issue](https://github.com/alibaba/testable-mock/issues) list for the work in progress
|
||||
- `v0.6` implement the functionality of "parameter constructor"
|
||||
- `v1.0` all functions are stable, a brand-new start
|
||||
|
||||
## Directory Structure
|
||||
|
4
docs/en-us/doc/annotations.md
Normal file
4
docs/en-us/doc/annotations.md
Normal file
@ -0,0 +1,4 @@
|
||||
Available Annotations
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
4
docs/en-us/doc/design-and-mechanism.md
Normal file
4
docs/en-us/doc/design-and-mechanism.md
Normal file
@ -0,0 +1,4 @@
|
||||
How Mock Works
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
4
docs/en-us/doc/javaagent-args.md
Normal file
4
docs/en-us/doc/javaagent-args.md
Normal file
@ -0,0 +1,4 @@
|
||||
Available Global Arguments
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
4
docs/en-us/doc/mock-method-reusing.md
Normal file
4
docs/en-us/doc/mock-method-reusing.md
Normal file
@ -0,0 +1,4 @@
|
||||
Reusing Mock Methods
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
4
docs/en-us/doc/scope-of-mock.md
Normal file
4
docs/en-us/doc/scope-of-mock.md
Normal file
@ -0,0 +1,4 @@
|
||||
Effective Scope Of Mocking
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
@ -1,4 +1,4 @@
|
||||
Upgrade to version 0.5
|
||||
Upgrade To Version 0.5
|
||||
---
|
||||
|
||||
After nearly a month of design and development, the `0.5` version of TestableMock has finally come out. Compared with the `0.4` version, the new version solves the three historical problems left over before:
|
||||
|
4
docs/en-us/doc/use-mock-with.md
Normal file
4
docs/en-us/doc/use-mock-with.md
Normal file
@ -0,0 +1,4 @@
|
||||
Use MockWith Annotation
|
||||
---
|
||||
|
||||
TO BE TRANSLATED
|
@ -7,13 +7,19 @@
|
||||
|
||||
- Usage Guide
|
||||
- [Verify Mock Invocation](en-us/doc/invoke-matcher.md)
|
||||
- [Effective Scope Of Mocking](zh-cn/doc/scope-of-mock.md)
|
||||
- [Reusing Mock Methods](zh-cn/doc/mock-method-reusing.md)
|
||||
- [Use MockWith Annotation](zh-cn/doc/use-mock-with.md)
|
||||
- [Frequently Asked Questions](en-us/doc/frequently-asked-questions.md)
|
||||
- [Use TestableMock In IDE](en-us/doc/use-in-ide.md)
|
||||
- [Self-Help Troubleshooting](en-us/doc/troubleshooting.md)
|
||||
- [Testable Maven Plugin](en-us/doc/use-maven-plugin.md)
|
||||
|
||||
- Technical Reference
|
||||
- [Upgrade To 0.5 Version](en-us/doc/upgrade-to-v05.md)
|
||||
- [Upgrade To Version 0.5](en-us/doc/upgrade-to-v05.md)
|
||||
- [Available Global Arguments](zh-cn/doc/javaagent-args.md)
|
||||
- [Available Annotations](zh-cn/doc/annotations.md)
|
||||
- [How Mock Works](zh-cn/doc/design-and-mechanism.md)
|
||||
- [Mock Tools Comparison](en-us/doc/comparation.md)
|
||||
- [Release Note](en-us/doc/release-note.md)
|
||||
- [About Us](en-us/doc/about-us.md)
|
||||
|
@ -1,9 +1,13 @@
|
||||
常见使用问题
|
||||
---
|
||||
|
||||
#### 1. 如何Mock被测类中通过`@Autowired`初始化的字段?
|
||||
#### 1. 如何初始化被测类中通过`@Autowired`或`@Resource`注入的私有字段?
|
||||
|
||||
直接创建被测类对象,然后利用`TestableMock`访问私有成员的能力直接给这些字段赋值即可。
|
||||
若该对象的方法在测试时需要被Mock,则无需初始化。
|
||||
|
||||
若测试运行时需用到该对象的真实调用,则可以在测试类的构造方法内直接创建对象,然后利用`TestableMock`访问私有成员的能力给这些字段赋值。
|
||||
|
||||
对于JUnit框架,还可以使用`@RunWith(SpringRunner.class)`注解将Spring上下文启动起来,然后在测试类里用`@Resource`把需要依赖对象注入进来,再利用`PrivateAccessor`赋值给被测类的私有字段。
|
||||
|
||||
#### 2. `TestableMock`是否能够与其他Mock工具一起使用?
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class ServiceTest {
|
||||
|
||||
完整代码示例见`java-demo`和`kotlin-demo`示例项目中`OneToMultiSvcTest`测试类的用例。
|
||||
|
||||
> 由于当前版本里,测试类无法通过`@MockWith`与多个Mock容器关联,对生效范围为`MockScope.ASSOCIATED`的Mock方法会遇到Mock无效的情况,为已知BUG,将在未来版本中修复。
|
||||
> 由于当前版本里,测试类无法通过`@MockWith`与多个Mock容器关联,目前这种用法仅支持生效范围为`MockScope.GLOBAL`的Mock方法,这是已知BUG,将在未来版本中修复。
|
||||
|
||||
### 4. 使用不包含Mock方法的Mock容器类
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user