[英]what is the best way to create test data for javascript applications?
I'm looking for a package that let me create test data for javascript applications.我正在寻找一个可以让我为 javascript 应用程序创建测试数据的包。 Is not all that relevant, but to give you some context I'm working with a react application that uses typescript.并不是那么相关,但为了给你一些上下文,我正在使用一个使用打字稿的反应应用程序。 The thing is, sometimes to reacreate the data the application uses in the run time is not an easy thing to do.问题是,有时重新创建应用程序在运行时使用的数据并不是一件容易的事情。 You may need an array of object that in turn contain an array of other type of objects, each containing data in some particular format.您可能需要一个对象数组,该数组又包含其他类型对象的数组,每个对象都包含某种特定格式的数据。 The task can easily become a chore all by itself.这项任务本身很容易变成一件苦差事。
So I'm looking for somewhat that helps me to the the setup of the data to be able to test the application with data that resembles the real data.所以我正在寻找一些可以帮助我设置数据的方法,以便能够使用类似于真实数据的数据来测试应用程序。
For example, if you have worked with Ruby on Rails there is a good change you know factory_bot Is a tool that let you create templates of objects with data you can provide in the template, it also let you override the data partially, when you are creating the data.例如,如果您使用过 Ruby on Rails,那么您知道有一个很好的变化factory_bot是一种工具,可以让您使用可以在模板中提供的数据创建对象模板,它还可以让您部分覆盖数据,当您创建数据。 I'm looking for something similar in javascript, any idea or suggestion?我在 javascript 中寻找类似的东西,有什么想法或建议吗?
查看factory_girl/factory_bot
这个节点实现: https : factory_girl/factory_bot
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.