简体   繁体   English

为 javascript 应用程序创建测试数据的最佳方法是什么?

[英]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.

相关问题 测试javascript的最佳方法是什么? - What is the best way to test javascript? 在Web应用程序中存储大型会话数据的最佳方法是什么? - What is the best way to store large session data in web applications? 在 javascript 中创建队列的最佳方法是什么? - What is the best way to create a queue in javascript? 创建javascript菜单的最佳方法是什么? - what is the best way to create javascript menu? 在Javascript中创建对象数组的最佳方法是什么? - What is the best way to create an array of objects in Javascript? 在JavaScript中创建类成员的最佳方法是什么 - what is the best way to create a class members in JavaScript 使用Google Charts的Spring MVC,创建javascript数据表的最佳方法是什么? - Spring MVC with Google Charts, what is the best way to create javascript data tables? 为网站自动化生成JavaScript测试对象的最佳方法是什么? - What is the best way to generate JavaScript test objects for website automation JavaScript 中测试给定参数是否为平方数的最佳方法是什么? - What's the best way in JavaScript to test if a given parameter is a square number? 连接多个JavaScript应用程序/类的最佳方法 - The best way for connecting multiple JavaScript applications/classes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM