You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 8
Next »
TODO: short introduction (order of tests, realized in test suite, every table stands for one test class, extends Abstract...)
EnvironmentData DAO Tests
Test Case No. (Test method) |
Method to test |
Scenario |
Outcome of successful test |
1 (addEnvironment()) |
addEnvironment(...) |
- storage of an environment into the database
|
|
2 (getEnvironments()) |
getEnvironments(...) |
- storage of an environment into the database
- receive the environment and compare the values
|
- returned list is not empty (size = 1)
- values of the retrieved EnvironmentData object must be equal to the values of the stored EnvironmentData object
|
3 (updateEnvironment()) |
updateEnvironment(...) |
- storage of an environment into the database
- change the environment and perform update
- receive the environment and compare the values
|
- no DataAccessException thrown
- values of the retrieved EnvironmentData object must be equal to the values of the updated version of the EnvironmentData object
- values of the retrieved EnvironmentData object must be unequal to the values of the initial version of the EnvironmentData object
|
4 (deleteEnvironment()) |
deleteEnvironment(...) |
- storage of an environment into the database
- deletion of the environment
- second deletion of the environment to ensure that the environment is really deleted
|
- no EntityNotFoundException is thrown during first deletion
- EntityNotFoundException is thrown during second deletion
|
ProfileData DAO Tests
Test Case No. (Test method) |
Method to test |
Scenario |
Outcome of successful test |
1 (addProfile()) |
addProfile(...) |
- storage of a profile into the database
|
|
2 (getProfile()) |
getProfile(...) |
- storage of a profile into the database
- receive the profile and compare the values
|
- return ProfileData is not null
- values of the retrieved ProfileData object must be equal to the values of the stored ProfileData object
|
3 (updateProfile()) |
updateProfile(...) |
- storage of a profile into the database
- change the profile and perform update
- receive the profile and compare the values
|
- no DataAccessException thrown
- values of the retrieved ProfileData object must be equal to the values of the updated version of the ProfileData object
- values of the retrieved ProfileData object must be unequal to the values of the initial version of the ProfileData object
|
4 (deleteProfile()) |
deleteProfile(...) |
- storage of a profile into the database
- deletion of the profile
- second deletion of the profile to ensure that the profile is really deleted
|
- no EntityNotFoundException is thrown during first deletion
- EntityNotFoundException is thrown during second deletion
|
5 (getNoneExistingProfile()) |
getProfile(...) |
- receive a profile which is not inside the database
|
- returned ProfileData object is null
|
6 (cascadeDeleteOfProfile()) |
|
- storage of a profile into the database
- deletion of the environment
- receive the profile
|
- returned ProfileData object is null
|
SensorTypeData Dao Tests
Test Case No. (Test method) |
Method to test |
Scenario |
Outcome of successful test |
1 (addSensorType()) |
addSensorType(...) |
- storage of a sensor type into the database
|
|
2 (getSensorType()) |
getSensorType(...) |
- storage of a sensor type into the database
- receive the sensor type and compare the values
|
- return SensorTypeData object is not null
- values of the retrieved SensorTypeData object must be equal to the values of the stored SensorTypeData object
|
3 (updateSensorType()) |
updateSensorType(...) |
- storage of a sensor type into the database
- change the sensor type and perform update
- receive the sensor type and compare the values
|
- no DataAccessException thrown
- values of the retrieved SensorType object must be equal to the values of the updated version of the SensorType object
- values of the retrieved SensorType object must be unequal to the values of the initial version of the SensorType object
|
4 (casdadeDeleteOfSensorType()) |
|
- storage of a sensor type into the database
- deletion of the environment
- deletion of the sensor type
|
- EntityNotFoundException is thrown during deletion of the sensor type
|
ExceptionSensorDefinitionData Dao Test
Lazy Initialization Tests
Before the below tests are performed an environment and a profile are added into the database. Afterwards the environment is retrieved with the profile. The sensor definitions of that profile should not be received with this service call. The second service call receives the profile with its defined sensor definitions. Following names are used to distinguish between the three different objects used in the tests:
- retrievedEnvironment : This is the environment retrieved as result of calling environmentDataDao.getEnvironments()
- profileWithOutSensorDefinitions: This is the profile retrieved with the retrievedEnvironment (should not have sensor definitions)
- profileWithSensorDefinitions: This is the profile retrieved as result of calling profileDataDao.getProfile(long profileId) (should have sensor definitions)
Test Case No. |
Name of Test Method |
Scenario |
Outcome of successful test |
1 |
getSensortype() |
- check if retrievedEnvironment has sensor types
|
- No LazyInitializationException is thrown
- Set of sensor types is empty
|
2 |
getProfile() |
- check if retrievedEnvironment has profiles
|
- No LazyInitializationException is thrown
- Set of profiles is 1
|
3 |
getExceptionSensorDefinitionsFromEnvironmentProfile() |
- check if profileWithOutSensorDefinitions has exception sensor definitions
|
- LazyInitializationException is thrown
|
4 |
getMethodSensorDefinitionsFromEnvironmentProfile() |
- check if profileWithOutSensorDefinitions has method sensor definitions
|
- LazyInitializationException is thrown
|
5 |
getPlatformSensorDefinitionsFromEnvironmentProfile() |
- check if profileWithOutSensorDefinitions has platform sensor definitions
|
- LazyInitializationException is thrown
|
6 |
getExceptionSensorDefinitionsFromProfile() |
- check if profileWithSensorDefinitions has exception sensor definitions
|
- no LazyInitializationException is thrown
|
7 |
getMethodSensorDefinitionsFromProfile() |
- check if profileWithSensorDefinitions has method sensor definitions
|
- no LazyInitializationException is thrown
|
8 |
getPlatformSensorDefinitionsFromProfile() |
- check if profileWithSensorDefinitions has platform sensor definitions
|
- no LazyInitializationException is thrown
|