问题描述
实际上为了在 github action 上运行我的测试,我需要将我的测试操作到以下 repo,
UI 测试文件: https://github.com/TheReprator/Wipro/tree/mockwebserver/appModules/factList/src/androidTest/kotlin/reprator/wipro/factlist/test
回购:https://github.com/TheReprator/Wipro
分支:mockwebserver
我的所有 ui 测试都通过 branch(master) 在本地通过,但是当我使用 github action 运行它时,所有 ui 测试用例都失败了。
期待解决方案。
我在github上的问题: https://github.com/square/okhttp/issues/6733
问候,
维克拉姆·辛格
解决方法
当使用 mockWebServer.start() 时,你应该使用 mockWebServer.url(path) 给你 url,而不是在 URL 中硬编码 0。
见https://github.com/square/okhttp/tree/master/mockwebserver
// Start the server.
server.start();
// Ask the server for its URL. You'll need this to make HTTP requests.
HttpUrl baseUrl = server.url("/v1/chat/");