Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 db
  • returned id > 0

2 (updateEnvironment())

updateEnvironment(...)

the environment stored in test case 1 will be updated

no DataAccessException thrown
if values are really updated will be tested in test case 3

3 (getEnvironments())

getEnvironments(...) retrieving of two environments from

  • storage of an environment into the db
;
therefore add a second environment
  • receive the environment and compare the values
  • returned list is not empty (size =
2
  • 1)
  • values of the retrieved
environments
  • environment must be equal to the values of the
initial environments
  • stored environment

4 3 (deleteExistingEnvironmentupdateEnvironment())

deleteEnvironments updateEnvironment(...)

deletion of the first added environment

no EntityNotFoundException is thrown
if environment is really deleted will be tested in test case 5

5 (deleteNonExistingEnvironment())

deleteEnvironments
  • storage of an environment into the db
  • change the environment and perform update
  • receive the environment and compare the values
  • no DataAccessException thrown
  • values of the retrieved environment must be equal to the values of the updated version of the environment
  • values of the retrieved environment must be unequal to the values of the initial version of the environment

4 (deleteEnvironment())

deleteEnvironment(...) again deletion of the first added environment

  • storage of an environment into the db
  • 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.

Method to test

Scenario

Outcome of successful test

1 (addProfile())

addProfile(...)
add

  • storage of a profile
to a previous stored
  • into the db
  • returned id > 0

2 (updateProfilegetProfile())

updateProfile getProfile(...)

  • storage of a profile into the db
  • receive the profile
stored in test case 1 will be updated

no DataAccessException thrown
if values are really updated will be tested in test case 3

3 (getProfile
  • and compare the values
  • return ProfileData is not null
  • values of the retrieved profile must be equal to the values of the stored profile

3 (updateProfile())

getProfile updateProfile(...)
retrieving of the profile stored in test case 1

  • storage of a profile into the db
  • change the profile and perform update
  • receive the profile and compare the values
  • no DataAccessException thrown
  • values of the retrieved profile must be equal to the values of the updated version of the profile
  • values of the retrieved profile must be unequal to the values of the initial version of the profile

4 (deleteExistingProfiledeleteProfile())

deleteProfile(...)

  • storage of a profile into the db
  • deletion of the profile
  • second deletion of the profile to ensure that the profile
stored in test case 1
  • is really deleted
  • no EntityNotFoundException is thrown

if environment is really deleted will be tested in test case 5

5 (deleteNonExistingProfile())

deleteProfile(...)

again deletion of the profile stored in test case 1
  • during first deletion
  • EntityNotFoundException is thrown during second deletion

6 5 (getNoneExistingProfile())

getProfile(...)
retrieving the already deleted profile (done in test case 4)

  • receive a profile which is not inside the database
  • returned ProfileData object is null

7 (cascadeDeleteOfProfile())

  an environment which has one profile defined is deleted. Then the profile will be retrieved.

  • storage of a profile into the db
  • deletion of the environment
  • receive the profile
  • returned ProfileData object is null

Lazy Initialization Tests

Before the below tests are performed an Environment and a profile are added into the database. Afterwards he 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 the first service call
  • profileWithOutSensorDefinitions: This is the profile retrieved with the environment in the first service call (should not have sensor definitions)
  • profileWithSensorDefinitions: This is the profile retrieved as result of the second service call (should have sensor definitions)

Test Case No.

Name of Test Method

Scenario

Outcome of successful test

1

getSensortype()

  • check if retrievedEnvironment has sensor types
are also retrieved with an environment
  • No LazyInitializationException is thrown
  • Set of sensor types is empty

2

getProfile()

  • check if
profiles are also retrieved with an environment
  • retrievedEnvironment has profiles
  • No LazyInitializationException is thrown
  • Set of profiles is 1

3

getExceptionSensorDefinitionsFromEnvironmentProfile()

  • check if profileWithOutSensorDefinitions has exception sensor definitions
are also retrieved with an environment
  • LazyInitializationException is thrown

4

getMethodSensorDefinitionsFromEnvironmentProfile()

  • check if profileWithOutSensorDefinitions has method sensor definitions
are also retrieved with an environment
  •  
  • LazyInitializationException is thrown

5

getPlatformSensorDefinitionsFromEnvironmentProfile()

  • check if profileWithOutSensorDefinitions has platform sensor definitions
are also retrieved with an environment
  • LazyInitializationException is thrown

6

getExceptionSensorDefinitionsFromProfile()

  • check if profileWithSensorDefinitions has exception sensor definitions
are also retrieved with a profile
  • no LazyInitializationException is thrown

7

getMethodSensorDefinitionsFromProfile()

  • check if profileWithSensorDefinitions has method sensor definitions
are also retrieved with a profile
  • no LazyInitializationException is thrown

8

getPlatformSensorDefinitionsFromProfile()

  • check if profileWithSensorDefinitions has platform sensor definitions
are also retrieved with a profile
  • no LazyInitializationException is thrown