This is exactly as you should expect - every unit test needs to run with a fresh Moodle database
, without it containing any data from previous test runs (which would break many of the subsequent tests).
There are two methods for doing this:
a) wrapping the entire test in a database transaction, which is rolled back at the end of the test - this is the usual method and means that the data never makes it into the 'real' database tables at all
b) by writing the data, then restoring it at the end of the test - this is needed in a few cases (including when you are trying to debug a test that is paused in the debugger) and can be achieved by adding $this->preventResetByRollback() at the start of the test
You should certainly not expect to be able to run a unit test in order to configure data in the database that you can make use of outside of the test (although you can do that, to an extent, with behat tests).