Do not test database columns ; it's just testing the implementation. Do not check the execution, the behavior of the test. Use a test function that uses the attributes that are stored in these columns. Exception: if your circuit has external requirements (this has never happened to me, but I can imagine it), it would be useful to write tests to show that these requirements are met.
Test indices? It depends. If you are strictly controlled by testing, you can write a test for each index that you add solely for performance reasons. I am quite experienced, but I do not write such tests; I just create indexes. The real test of indices is their impact on performance. In any case, it makes no sense to test existing indexes, which must exist in any case to support functions that are already being tested (primary keys, foreign keys, unique constraints, etc.).
source share