开发者

How do I add some test data to appengine local datastore file?

We are using GAE java. As part of every build we want to refresh the data in the local datastore file (/WEB-INF/appengine-generated/local_db.bin) to contain some reference data, i.e some specific data that is neede开发者_运维百科d for running integration tests and for testing the application. Is there some way to import this reference data into local datastore? We want to automate this as part of every build. Thanks in advance.


  1. Write some type of handler / servlet to wipe the local_db.bin and import your reference data.

  2. Keep a good copy of your local_db.bin and replace it when you need to refresh your data. You'll probably need to stop, replace, then restart the dev server each time you need to refresh the data.


You have 2 options - wipe and replace the .bin file as robert mentions, or you can wipe/add data with normal datastore calls (JDO/JPA/Objectify/whatever). In either case, you should definitely read this link for hints on unit testing. in particular you can set the datastore to run in memory only, which can help speed up unit tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜