
mework.roo.org.springframework.roo.addon.test.addon.2.0.0.M2.source-code.tests.roo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.springframework.roo.addon.test.addon Show documentation
Show all versions of org.springframework.roo.addon.test.addon Show documentation
Integration of JUnit tests in the target project.
# Create project, add persistence, entities, repositories and services to be able to test subsequent commands.
project setup --topLevelPackage aaaa.bbb.cc
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity jpa --class aaaa.bbb.cc.model.Entity1
field string --fieldName string_field
field number --fieldName number_field --type int
repository jpa --all --package aaaa.bbb.cc.repository
service --all --apiPackage aaaa.bbb.cc.service.api --implPackage aaaa.bbb.cc.service.impl
#=======================================================================================================
# TEST 1: Create unit test for one entity
#-------------------------------------------------------------------------------------------------------
# Goal: Test 'test unit' command with an entity class.
#
test unit --class ~.model.Entity1
#
# Output: Created SRC_TEST_JAVA/aaaa/bbb/cc/model
# Created SRC_TEST_JAVA/aaaa/bbb/cc/model/Entity1Test.java
# Updated ROOT/pom.xml [added dependencies junit:junit:, org.mockito:mockito-core:,
# org.springframework:spring-test:; skipped dependency org.assertj:assertj-core:]
# Created SRC_TEST_JAVA/aaaa/bbb/cc/model/Entity1Test_Roo_UnitTest.aj
#
# Result: Creates test class in test package, creates associated ITD and add test dependencies.
#=======================================================================================================
#=======================================================================================================
# TEST 2: Create unit test for one repository class
#-------------------------------------------------------------------------------------------------------
# Goal: Test 'test unit' command with an repository class.
#
test unit --class ~.repository.Entity1Repository
#
# Output: Created SRC_TEST_JAVA/aaaa/bbb/cc/repository
# Created SRC_TEST_JAVA/aaaa/bbb/cc/repository/Entity1RepositoryTest.java
# Created SRC_TEST_JAVA/aaaa/bbb/cc/repository/Entity1RepositoryTest_Roo_UnitTest.aj
#
# Result: Creates test class in test package and creates associated ITD.
#=======================================================================================================
#=======================================================================================================
# TEST 3: Create unit test for one service class
#-------------------------------------------------------------------------------------------------------
# Goal: Test 'test unit' command with a service class.
#
test unit --class ~.service.api.Entity1Service
#
# Output: Created SRC_TEST_JAVA/aaaa/bbb/cc/service/api
# Created SRC_TEST_JAVA/aaaa/bbb/cc/service/api/Entity1ServiceTest.java
# Created SRC_TEST_JAVA/aaaa/bbb/cc/service/api/Entity1ServiceTest_Roo_UnitTest.aj
#
# Result: Creates test class in test package and creates associated ITD.
#=======================================================================================================
#=======================================================================================================
# TEST 4: Execute same command again
#-------------------------------------------------------------------------------------------------------
# Goal: Test same 'test unit' command and check if it return silently.
#
test unit --class ~.service.api.Entity1Service
#
# Output: ~.service.api.Entity1Service roo>
#
# Result: Nothing occurs.
#=======================================================================================================
##########################################################################
####### MANUAL TESTS #########
##########################################################################
# #
# The following commands must be executed manually because they are #
# supposed to interrupt script execution. #
# #
##########################################################################
#=======================================================================================================
# TEST 5: Try to pass the generated tests
#-------------------------------------------------------------------------------------------------------
# Goal: Test if generated project ignore the methods annotated with @Test (which are commented) and
# there aren't additional problems.
#
# $ mvn clean compile
#
# Output: [INFO] BUILD SUCCESS ...
#
# Result: Project successfully installed and tests passed.
#=======================================================================================================
© 2015 - 2025 Weber Informatics LLC | Privacy Policy