简体   繁体   English

导入大量数据仅供测试。

[英]Importing a large amount of data for testing only.

Here is some background: 这是一些背景:

I have a client that wants me to test a rails app against a large number of potential inputs in a form page. 我有一个客户端希望我针对表单页面中的大量潜在输入测试rails应用程序。 He has an Excel spreadsheet with about 200 potential input combinations that will be entered into the form. 他有一个Excel电子表格,其中包含大约200个潜在的输入组合,这些组合将输入到表单中。

The client want's the app to be able to "read" the spreadsheet and execute the couple hundred form submissions. 客户希望应用程序能够“阅读”电子表格并执行几百个表单提交。

My solution was to just import the spreadsheet into a database table, but the client doesn't want an extra database table in the application. 我的解决方案是将电子表格导入数据库表,但客户端不希望应用程序中有额外的数据库表。

So here is the question: 所以这是一个问题:

Is it possible/not exceptionally complicated to read/crawl a spreadsheet or csv file to do the above, or import data into only the test database? 读取/抓取电子表格或csv文件以执行上述操作或仅将数据导入测试数据库是否可能/不特别复杂?

I haven't been able to find any resources that aren't about simply importing the spreadsheet. 我无法找到任何与简单导入电子表格无关的资源。

Thanks! 谢谢!

Use spreadsheet gem to read and parse your data from excel. 使用电子表格 gem从excel中读取和解析数据。

Use capybara to automate the form submission. 使用capybara自动提交表单。 Initial learning curve will be steep, but once you get a hang of it, it comes really handy to automate web interactions. 初始学习曲线会很陡峭,但是一旦掌握了它,就可以自动化网络交互。

There is a ruby gem called roo which allows you to access the contents of: 有一个名为roo的红宝石宝石,可以让你访问以下内容:

  1. Open-office spreadsheets (.ods) 开放式电子表格(.ods)
  2. Excel spreadsheets (.xls) Excel电子表格(.xls)
  3. Google (online) spreadsheets 谷歌(在线)电子表格
  4. Excel's new file format .xlsx Excel的新文件格式.xlsx

Using this gem, you can read test data from file and use them in tests to execute. 使用此gem,您可以从文件中读取测试数据并在测试中使用它们来执行。

Do you have some magical method for importing the spreadsheet into the database already? 您是否有一些将电子表格导入数据库的神奇方法? Because the way I see it, you're going to have to parse the spreadsheet at some point anyway and there's no good reason to add overhead by throwing all of this into a database. 因为我看到它的方式,你将不得不在某个时候解析电子表格,并且没有充分的理由通过将所有这些放入数据库来增加开销。 Write a script that takes the entries and tries them, submission by submission, that way you won't need to store anything. 编写一个脚本来获取条目并尝试它们,通过提交提交,这样您就不需要存储任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM