opengeospatial / ets-sta10

Repository for the Executable Test Suite for OGC Sensor Things API
Other
6 stars 8 forks source link

Requires non-empty database, leaves an empty database #3

Closed hylkevds closed 8 years ago

hylkevds commented 8 years ago

Currently the test suite generates errors when it is run on an empty database. It assumes there is already data present. However it leaves an empty database when done.

This is of course quite inconvenient, since it means that for each run one needs to re-insert test data. It's not possible to run the test twice in a row, since the second run will fail.

It should probably check if the database is empty and first insert test data if it is.

taniakhalafbeigi commented 8 years ago

There are pre-conditions and post-conditions for this test suite. The precondition is that the database is not empty. This test suit needs an un-empty small database to begin the test (By small I mean we can see entities for each entity type without the need for pagination). The reason is that for testing Sensing core capabilities there is no access to POST for creating the entities and the test suite assumes the service under test is read-only (which is the case for some services that only implement SensorThings Sensing Core). As a result there should be some data in the service under test at the beginning of test.

If you test the Sensing Core, the database will not be emptied. However after testing Create-Update-Delete and also Filtering Extension the database will be emptied. Because for testing query options we need to know the data in the database beforehand to test the result is correct and complete. That is the same situation for testing deep-insert.

hylkevds commented 8 years ago

Would it be an option to check if data is available, and if there is no data, try to create some test data? I've changed the test so it does that here: https://github.com/hylkevds/ets-sta10/blob/master/src/main/java/org/opengis/cite/sta10/sensingCore/Capability1Tests.java It only needs to count Observations and HistoricalLocations. When those exist all the others should also exist.

If the database is empty and test data can not be created all the test will fail with exceptions, so I would say it's not a problem if an error is thrown when inserting test data fails.

taniakhalafbeigi commented 8 years ago

If we try to create the data and it doesn't work correctly, it will result in misinforming the user. Because we are going to report that READ does not work properly, while it is CREATE that is not working. It happens if the CREATE works but does not work properly, I mean 201 is returned but the service does not create the entities correctly.