database-testing

Suggestions to avoid DB deps when using an in-memory sqlite DB to speed up unit tests

喜你入骨 提交于 2019-12-11 02:32:29
问题 I've been using sqlite::memory: for unit tests: it is quick, and makes test clean-up automatic. But I'm concerned my tests could be missing bugs due to SQL server assumptions. (This particular code is supposed to be DB-neutral, but pragmatically it must work with MySQL.) As a specific example, I think date string inputs to sqlite get stored as strings (*), so they get given back to me in exactly the same format. Whereas in MySQL they appear to get parsed, normalized, and returned in a

Generating dummy data for my web application - looking for dictionaries [closed]

强颜欢笑 提交于 2019-12-10 19:09:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Sorry if this is off topic - but it is certainly programming related . I need to test my web application at scale (concurrent users and amount of data in system). For the latter, I need some way of generating dummy data for a variety of types (name, address, email and some other data types) Are there any open

Rails databases, why use same DBMS for development and production?

扶醉桌前 提交于 2019-12-10 13:57:56
问题 I really can't seem to find an accurate explanation on why you should use the same database in development as in production. I personally love using sqlite3 in development (it's light, easy to use, and has a sweet sqlite browser GUI tool), then use postgres in production with heroku. But, I keep hearing whether from RBates or Michael Hartl or someone else that you should use the same database in both, why exactly is this? 回答1: I have used SQLite3 in development and PostgreSQL in production

Complete db schema transformation - how to test rewritten queries?

怎甘沉沦 提交于 2019-12-07 07:49:24
问题 Our database is poorly designed all the way around (we inherited it). I've reworked the schema to something useable and maintainable. Quite a few tables and columns have been dropped, many columns have moved and most tables and columns have been renamed. Some datatypes have been changed also. I've extracted all the queries from our webapps and we've started rewriting them. Our DBA is able to migrate the old data to the new schema, we think. To be sure we need to test each query by comparing

Database integration tests

允我心安 提交于 2019-12-05 20:07:28
问题 When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database? 回答1: Transactions. What the ruby on rails unit test framework does is this: Load all fixture data. For each test: BEGIN TRANSACTION # Yield control to user code ROLLBACK TRANSACTION End for each This means that Any changes your test makes to the database won't

Database integration tests

自古美人都是妖i 提交于 2019-12-04 03:14:25
When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database? Transactions. What the ruby on rails unit test framework does is this: Load all fixture data. For each test: BEGIN TRANSACTION # Yield control to user code ROLLBACK TRANSACTION End for each This means that Any changes your test makes to the database won't affect other threads while it's in-progress The next test's data isn't polluted by prior tests This is about a

How to do database unit testing?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 00:33:18
问题 I have heard that when developing application which uses a database you should do database unit testing. What are the best practices in database unit testing? What are the primary concerns when doing db unit testing and how to do it "right"? 回答1: What are the best practices in database unit testing? The DbUnit framework (a testing framework allowing to put a database in a know state and to perform assertion against its content) has a page listing database testing best practices that, to my

How to do database unit testing?

泪湿孤枕 提交于 2019-12-02 14:08:14
I have heard that when developing application which uses a database you should do database unit testing. What are the best practices in database unit testing? What are the primary concerns when doing db unit testing and how to do it "right"? Pascal Thivent What are the best practices in database unit testing? The DbUnit framework (a testing framework allowing to put a database in a know state and to perform assertion against its content) has a page listing database testing best practices that, to my experience, are true. What are the primary concerns when doing db unit testing Creating an up

How to create unit tests against non in-memory database such as MySQL in Play framework, with resetting to known state?

帅比萌擦擦* 提交于 2019-11-30 10:36:44
问题 I want to create unit tests that cover code that use relational database in Play framework 2.1.0. There are many possibilities for this and all cause problems: Testing on in-memory H2 database Play framework documentation proposes to run unit tests on H2 in-memory database, even if main database used for development and production use other software (i.e. MySQL): app = Helpers.fakeApplication(Helpers.inMemoryDatabase()); My application don't use complicated RDBMS features such as stored

How to create unit tests against non in-memory database such as MySQL in Play framework, with resetting to known state?

不问归期 提交于 2019-11-29 20:28:32
I want to create unit tests that cover code that use relational database in Play framework 2.1.0. There are many possibilities for this and all cause problems: Testing on in-memory H2 database Play framework documentation proposes to run unit tests on H2 in-memory database, even if main database used for development and production use other software (i.e. MySQL): app = Helpers.fakeApplication(Helpers.inMemoryDatabase()); My application don't use complicated RDBMS features such as stored procedures and most database access cases are ebean calls, so it should be compatible with both MySQL and H2