gpt4 book ai didi

unit-testing - 在 dart 中重构友好的 mocking

转载 作者:行者123 更新时间:2023-12-03 02:54:09 34 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

7年前关闭。




Improve this question




到目前为止,我在 dart 中看到的所有模拟库(unittest/mock、dartmocks)都使用字符串来表示方法调用。例如

foo.when(callsTo('fum')).thenReturn(...);

问题是当我想重命名 fum 时,IDE 不会接收我的模拟方法调用,所以我必须手动更改它们。

任何人都知道任何与实际方法调用( foo.fum() )一起使用的方法吗?即类似于Java中的mockito等

最佳答案

我写了一个工具叫 mockito让这更容易一些。它很好地支持重构。

关于unit-testing - 在 dart 中重构友好的 mocking,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20768280/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com