V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
KeatingSmith
V2EX  ›  问与答

请教:后端模拟数据方法

  •  
  •   KeatingSmith · 2018 年 10 月 9 日 · 1752 次点击
    这是一个创建于 2674 天前的主题,其中的信息可能已经有所发展或是发生改变。

    现在使用的是 MySQL,但是测试的时候没啥数据。

    因此,想问下各位,作为后端,怎么模拟 MySQL 数据进行测试呢?

    9 条回复    2018-10-09 11:02:48 +08:00
    wysnylc
        1
    wysnylc  
       2018 年 10 月 9 日
    insert
    Mazexal
        2
    Mazexal  
       2018 年 10 月 9 日
    直接 mock 返回结果, 数据?不存在的
    x66
        3
    x66  
       2018 年 10 月 9 日 via iPhone
    最方便的是 Mock,如果后端先开发的话,自测的时候就插入一些数据进去吧
    gaius
        4
    gaius  
       2018 年 10 月 9 日
    mock
    loveCoding
        5
    loveCoding  
       2018 年 10 月 9 日
    Mockito,powermock
    KeatingSmith
        6
    KeatingSmith  
    OP
       2018 年 10 月 9 日
    @x66

    就是插入时数据挺麻烦的,想了解一下有没有自动化工具。
    Mutoo
        7
    Mutoo  
       2018 年 10 月 9 日
    搜索一下 Database Seeding 有专门的工具做这件事
    Faker https://github.com/fzaninotto/Faker
    xiaoxinshiwo
        8
    xiaoxinshiwo  
       2018 年 10 月 9 日
    先把插入接口做好
    reus
        9
    reus  
       2018 年 10 月 9 日
    你不测试数据插入的?
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1362 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:09 · PVG 01:09 · LAX 09:09 · JFK 12:09
    ♥ Do have faith in what you're doing.