Comments (13)
Thanks for raise the issue, I‘ll have a try and check it.
Actually we have a much larger test case pool including all demo cases and issue related cases, which run with JUnit 4 and maven. Sorry cannot open source it because it also contains several internal issue cases with biz related code. Combine JUnit 4 with Gradle has never been tried before, but should have not reason to fail.
from testable-mock.
Compate with junit very important after all there are lot of users of junit.
Thanks.
from testable-mock.
checkout branch junit4 and try : )
it works as expected (with Gradle 6.7).
from testable-mock.
cool, so cute.
But can you explain the function of below:
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}"
useJUnit()
}
How I deploy the testable-mock with Robolectric to test Android project?
Thanks.
from testable-mock.
can you explain the function of below
the first line jvmArgs ...
will found the full path of testable-agent.jar
file from jvm classpath, and set a -javaagent
parameter it to jvmArgs
property correcting to the jar file found, and this agent jar do all the mock magics. look up -javaagent
parameter of jvm for more details.
second line useJUnit()
is a standard configuration for Junit 4.
How I deploy the testable-mock with Robolectric to test Android project?
that's a good question, TestableMock and Robolectric are technically match, however I don't have a simple enough demo at my hand. maybe could you found an android demo with recent Robolectric release? I'll show how to fit it.
from testable-mock.
Sure, check the attachment which is I write a sample demo using Robolectric, you can try.
Good luck.
from testable-mock.
hey... I did not see the attachment
from testable-mock.
Sorry, please check the attachment.
testablemock.zip
from testable-mock.
Emm, looks like google repository get blocked from my home network, some android dependence not downloadable, and I'm having 2 days off tomorrow and the day after tomorrow.
Will try to get it done next Monday when back to office, sorry man.
from testable-mock.
Hello, did you have time to try the attchment demo?
from testable-mock.
Sure : )
Checkout the attached zip.
The key point is below configuration inside the app/build.gradle
file.
android {
testOptions {
unitTests {
all {
jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}"
}
}
}
}
from testable-mock.
Cool, Thank you very much.
from testable-mock.
Happy to help, also thx for your Robolectric demo 😀.
from testable-mock.
Related Issues (20)
- java.lang.NoSuchMethodError:Mock容器类下的@MockNew方法,无法通过@MockContainer继承生效
- OmniConstructor工具类,开启了字节码增强,但mock对象时还是会随机偶发报错 HOT 3
- when use MockWith annotation, mockClass not right HOT 2
- 包路径映射后,mock未生效
- Maven package failed due to EnablePrivateAccessProcessor HOT 5
- 建议:建议增加两个快速开始文档 HOT 1
- OmniConstructor.newInstance(RyNormalTask.class) 报错 Failed to invoke constructor HOT 1
- 如何避免mock代码异常提交 HOT 3
- @MockContainer 注解对于继承类的void方法不能正常生效
- 被测试类的方法没有被mock HOT 1
- 使用@RequiredArgsConstructor出现Failed to load ApplicationContext
- 与Jacoco一起使用时,不支持Java17
- 使用OmniConstructor.newInstance()报错 HOT 1
- 从0.7.7升级到0.7.9,启用OmniConstructor的字节码增强模式效率变得非常慢
- 按文档在test里设置jvmArgs报空指针
- 测试service 中调用dao 中继承自mybatis中basemapper通用方法,mock dao层 不生效
- dao层mock 新增 修改 返回int类型接口,启动test报错,类型不匹配,改成Integer,mock不生效
- SpringBoot3中@{argLine} 和 -javaagent不能同时使用
- springboot框架下拦截器中的方法怎么修改
- 一个被测试类可以有个多个Mock类吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testable-mock.