mocking

    0热度

    1回答

    在C#下有一个很好的工具,假部分测试实现复杂的接口(服务,存储库等)? 我目前使用的模拟框架(RhinoMocks)太慢,太难以处理这个目的。 先决条件: 没有显著的性能损失,相比于真正的实现(批量测试) 实现与基本的逻辑和数据(例如:字典,而不是数据库表) 无需更换测试,当界面改变时。 全面推行例如: public interface IMyInterface { int Prope

    0热度

    1回答

    我试图做到的是嘲笑一个分裂的方法中这样 def method_separator(s): try: a, b, c = s.split('-') print a, b, c except: ValueError: print "An error occurred or so" 在测试 with self.assertRaises(Valu

    0热度

    1回答

    我想模拟从我的类中使用的pyserial中的Serial对象的读写函数来检查调用参数并编辑返回值,但似乎没有工作。 目前,我有一个文件 'serialdevice.py',像这样: import serial class SerialDevice: def __init__(self): self._serial = serial.Serial(port='somepor

    0热度

    1回答

    我试图让我的模拟API(json-server)以一种方式作出响应,如果客户端发送AUTH_TOKEN在他的请求头,并以另一种方式,如果他没有。这段代码就是我使用的,它来自json-server文档。 const jsonServer = require('json-server') const server = jsonServer.create() const router = jsonS

    0热度

    1回答

    的Mockito 我对我的一些静态字段的使用@Getter符号与龙目岛这样嘲讽龙目岛田@Getter的代码,不会: MyClass.getMyClass(); 嘲笑,我这样做: mock(MyClass.class); when(MyClass.getMyClass()).thenReturn(...); Howeve r,这样的模拟给出了下面的错误。 [testng] org.mock

    0热度

    1回答

    我是一个单元测试函数,它使用由其他函数声明的变量。 def first_fun(): global file_path file_path = get_file_path() . . def second_fun(): with open(file_path, "r") as flz: . . 如何在测试second_f

    1热度

    2回答

    给定一个参数为的Java(例如, public class Foo { public Bar theBar(Bar bar) { /*... */ } } 当磕碰/ foo的嘲讽,我怎么告诉它接受任何参数和返回值呢? (Groovy的) def fooStub = Stub(Foo) { theBar(/*what to pass here*/) >> { x -> x

    0热度

    1回答

    我正在使用Symfony框架的guard component开发phpcas包。我的包正在工作,但我想做一些单元测试。我想测试我的CasAuthenticator。 PhpCAS library正在使用静态方法。所以我决定用Mock Aspect来嘲笑它。 我配置了看点,但我仍然有一个错误。 这是一个正在运行但失败的简化测试。 预计PhpCAS :: setDebug被调用,但它从未发生过。得到:

    0热度

    1回答

    它当它到达方法从我的控制器中删除一个得到棘手试图测试 @RequestMapping(value="/remove", method=RequestMethod.POST) public String remove( @ModelAttribute("id") String id, Model model ) { bookService.removeOne(Long.par

    1热度

    1回答

    我正在尝试为已经实施的注册页面创建端到端测试。这个逻辑为我的API创建一个HTTP请求,但为了使测试独立,我试图创建一个AuthProvider类的模拟器,它是发出HTTP请求的那个类。 所以,Proctator文档之后,我有这个简单的例子: browser.addMockModule('modName', function() { angular.module('modName', [