Comments (6)
Hi!
Here are a few things factories provide:
- simple per table syntax
- an easy way to generate multiple records by provide a second argument
- however, they can’t be used to define complex operations such as using user_save() or entity_save()
Seeders:
- usually used to run complex operations
- can be run using the command line using “tripaltest db:seed”
- the most important feature is that seeders can be used to populate the database with persistent data. So you’d run the seeder once to add the data and be able to use and test the GUI
BTW, both the seeder class and the tripal test case class provide a “$this->publish($chado_table_name, $record_id)” method to convert chado records into entities in case you wanted to run tests on entities
from tripaltestsuite.
Precisely!
from tripaltestsuite.
Seeders don't run automatically. You have to use MySeeder::seed()
in the test method (which you can run within a transaction) or by running them through the command line which is not revertible.
from tripaltestsuite.
Oh, I think I see! :-) Thanks!
Just to check my understanding:
- I would create a database seeder for creating fake "BlastDB" nodes used for testing the blast form or job since it should be done with
node_save()
? - I could use a factory for creating fake dbxrefs when testing "BlastDB" node CRUD and for use in the database seeder above?
from tripaltestsuite.
@almasaeed2010 do seeders do inserts only or updates? I'm thinking about seeders running multiple times and getting db errors because of it.
@laceysanderson i think if you are using seeders in the context of testing, then you'll want to a) run the seeders in the Travis container before running your tests and b) document that you need to run them for tests to pass for contributors. Factories on the other hand are meant to be lightweight, run once per test.
from tripaltestsuite.
oh thats neat, so running within test, with transactions, is do-able. So in that case its for "complex operations" as you say. Cool.
from tripaltestsuite.
Related Issues (20)
- Let's give MenuCaller another go HOT 1
- video tutorials should be in RTD not README HOT 3
- reflect method cant set private properties
- error testing API that uses exec to run python script HOT 1
- Testing Tripal Fields HOT 9
- Move DBTransaction trait to Database folder
- Add collaboration instructions to documentation HOT 3
- instructions for drupal standards, sniffing, and perhaps automated integration with a sniffer service HOT 1
- `activeAs` method uses undefined user variable HOT 1
- documentation: style and coverage integration HOT 1
- Create a base test class that extends TripalTestCase HOT 7
- DBTransaction might be failing HOT 9
- QOL: Should we create a project level config file? HOT 4
- db transactions are not compatible with chado_db_query HOT 2
- How to test update functions? HOT 1
- provide loader for citrus HOT 5
- Dev Seed Fails HOT 3
- Need to add packigist hooks HOT 1
- Tripal test suite does not support PHP 8.x HOT 1
- Security alert for guzzlehttp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tripaltestsuite.