-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development
: Refactor atlas tests
#9352
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
83ecf2d
Enable all architecture tests
MaximilianAnzinger 8b43b93
Move architecture tests and object method tests into shared test package
MaximilianAnzinger adfb778
Restructure integration tests into modules
ole-ve 51a468f
Restructure service tests into modules
ole-ve ceee431
Merge remote-tracking branch 'origin/develop' into chore/restructure-…
ole-ve 81ff31e
Apply spotless
ole-ve 71bdeec
Fix enforceNothing arch test
ole-ve 52778fb
Fix correctServiceAnnotation arch test
ole-ve fefb027
Add architecture test to check for test only queries in prod code
MaximilianAnzinger c563417
Move test repositories to test_repository subdirectory
ole-ve 4ed0b10
Merge remote-tracking branch 'origin/develop' into chore/restructure-…
ole-ve eb34cd8
Move exercise methods to test repository
MaximilianAnzinger b5fb222
Merge branch 'develop' into chore/restructure-tests
MaximilianAnzinger c896c8b
Create ResultTestRepository and improve test repository inheritance
MaximilianAnzinger ac1887b
Create TutorParticipationTestRepository
MaximilianAnzinger c468aa2
Create atlas test repositories
MaximilianAnzinger 6db26fe
move test repos into test modules
MaximilianAnzinger fc4587e
Fix tutorial group repositories
JohannesStoehr 799ac5a
create more test repositories
MaximilianAnzinger ebc8c8b
Fix text and quiz exercises
JohannesStoehr 681ad06
Merge remote-tracking branch 'origin/chore/restructure-tests' into ch…
JohannesStoehr f7b9633
Fix check for method references
JohannesStoehr 5d3792f
create more test repositories
MaximilianAnzinger 9fec368
create more test repos
MaximilianAnzinger 573fa81
Fix check for method references and remove unused methods
JohannesStoehr 5f8e55c
add remaining test repos
MaximilianAnzinger 73fc3c1
add more arch tests
MaximilianAnzinger 6786cfe
User group of user in DatabaseQueryCountTest not saved
ole-ve 8699f6a
Replace all usages of prod repo with test repo (if exists)
ole-ve 93c5066
Annotate all test repositories with @Primary to override prod reposit…
ole-ve 72624ee
Add archTest to enforce @Primary annotation on test repositories
ole-ve f917f45
Remove ToDo
ole-ve ab4eb7f
Merge remote-tracking branch 'origin/develop' into chore/restructure-…
ole-ve c267f28
Fix unintentional change
ole-ve 232d809
Fix unintentional change
ole-ve 1dbb3d7
Use ProgrammingExerciseTestRepository instead of ProgrammingExerciseR…
ole-ve 3245271
Add archTest to check that test repositories are used instead of prod…
ole-ve dde0954
Fix unintentional change
ole-ve 4e68bb7
Disable testCreateAnswerInExamChannel
ole-ve 67105d4
Remove validated todo: https://docs.hazelcast.com/imdg/4.2/configurat…
ole-ve 87c8996
Move JhiMetricsIntegrationTest to core module
ole-ve d065dc8
move tests from competency package into atlas module
MaximilianAnzinger 520bcc5
fix atlas structure
MaximilianAnzinger c96f537
move online course tests to lti
MaximilianAnzinger 591feae
add AbstractAtlasIntegrationTest
MaximilianAnzinger 31ec22b
add arch test to ensure abstract integration test inheritance
MaximilianAnzinger f861722
Merge branch 'develop' into chore/restructure-tests
MaximilianAnzinger c889957
add integration test to prevent autowire in integrationt test impleme…
MaximilianAnzinger a4d4947
Merge branch 'develop' into chore/restructure-tests
MaximilianAnzinger d3ad9a2
Merge branch 'chore/restructure-tests' into chore/refactor-atlas-tests
MaximilianAnzinger 3f77991
Merge branch 'develop' into chore/restructure-tests
MaximilianAnzinger 74556c5
Merge branch 'chore/restructure-tests' into chore/refactor-atlas-tests
MaximilianAnzinger b5a7d6c
merge develop
MaximilianAnzinger ccebd40
fix import
MaximilianAnzinger b35ee1f
remove useless empty line
MaximilianAnzinger 9f0ae88
Merge branch 'develop' into chore/refactor-atlas-tests
MaximilianAnzinger f8df0fd
Merge branch 'develop' into chore/refactor-atlas-tests
MaximilianAnzinger 2bd438d
Merge branch 'develop' into chore/refactor-atlas-tests
MaximilianAnzinger 62a76c6
Merge branch 'develop' into chore/refactor-atlas-tests
MaximilianAnzinger 28b9ce4
use test repos
MaximilianAnzinger 4963195
Merge branch 'develop' into chore/refactor-atlas-tests
MaximilianAnzinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
159 changes: 159 additions & 0 deletions
159
src/test/java/de/tum/cit/aet/artemis/atlas/AbstractAtlasIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
package de.tum.cit.aet.artemis.atlas; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import de.tum.cit.aet.artemis.assessment.repository.GradingCriterionRepository; | ||
import de.tum.cit.aet.artemis.assessment.util.StudentScoreUtilService; | ||
import de.tum.cit.aet.artemis.atlas.competency.util.CompetencyProgressUtilService; | ||
import de.tum.cit.aet.artemis.atlas.competency.util.CompetencyUtilService; | ||
import de.tum.cit.aet.artemis.atlas.competency.util.PrerequisiteUtilService; | ||
import de.tum.cit.aet.artemis.atlas.competency.util.StandardizedCompetencyUtilService; | ||
import de.tum.cit.aet.artemis.atlas.learningpath.util.LearningPathUtilService; | ||
import de.tum.cit.aet.artemis.atlas.repository.CompetencyJolRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRelationRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.CourseCompetencyRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.KnowledgeAreaRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.PrerequisiteRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.ScienceSettingRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.SourceRepository; | ||
import de.tum.cit.aet.artemis.atlas.repository.StandardizedCompetencyRepository; | ||
import de.tum.cit.aet.artemis.atlas.service.competency.CompetencyProgressService; | ||
import de.tum.cit.aet.artemis.atlas.test_repository.CompetencyProgressTestRepository; | ||
import de.tum.cit.aet.artemis.atlas.test_repository.LearningPathTestRepository; | ||
import de.tum.cit.aet.artemis.atlas.test_repository.ScienceEventTestRepository; | ||
import de.tum.cit.aet.artemis.core.service.feature.FeatureToggleService; | ||
import de.tum.cit.aet.artemis.core.util.PageableSearchUtilService; | ||
import de.tum.cit.aet.artemis.exercise.participation.util.ParticipationUtilService; | ||
import de.tum.cit.aet.artemis.exercise.service.ParticipationService; | ||
import de.tum.cit.aet.artemis.exercise.team.TeamUtilService; | ||
import de.tum.cit.aet.artemis.exercise.test_repository.SubmissionTestRepository; | ||
import de.tum.cit.aet.artemis.lecture.repository.AttachmentUnitRepository; | ||
import de.tum.cit.aet.artemis.lecture.repository.ExerciseUnitRepository; | ||
import de.tum.cit.aet.artemis.lecture.repository.LectureRepository; | ||
import de.tum.cit.aet.artemis.lecture.repository.LectureUnitRepository; | ||
import de.tum.cit.aet.artemis.lecture.repository.TextUnitRepository; | ||
import de.tum.cit.aet.artemis.lecture.service.LectureUnitService; | ||
import de.tum.cit.aet.artemis.lecture.util.LectureUtilService; | ||
import de.tum.cit.aet.artemis.programming.repository.ProgrammingExerciseBuildConfigRepository; | ||
import de.tum.cit.aet.artemis.programming.test_repository.ProgrammingExerciseTestRepository; | ||
import de.tum.cit.aet.artemis.shared.base.AbstractSpringIntegrationIndependentTest; | ||
import de.tum.cit.aet.artemis.text.util.TextExerciseUtilService; | ||
|
||
public abstract class AbstractAtlasIntegrationTest extends AbstractSpringIntegrationIndependentTest { | ||
|
||
// Repositories | ||
@Autowired | ||
protected CompetencyRepository competencyRepository; | ||
|
||
@Autowired | ||
protected CourseCompetencyRepository courseCompetencyRepository; | ||
|
||
@Autowired | ||
protected CompetencyRelationRepository competencyRelationRepository; | ||
|
||
@Autowired | ||
protected CompetencyProgressTestRepository competencyProgressRepository; | ||
|
||
@Autowired | ||
protected KnowledgeAreaRepository knowledgeAreaRepository; | ||
|
||
@Autowired | ||
protected StandardizedCompetencyRepository standardizedCompetencyRepository; | ||
|
||
@Autowired | ||
protected SourceRepository sourceRepository; | ||
|
||
@Autowired | ||
protected LearningPathTestRepository learningPathRepository; | ||
|
||
@Autowired | ||
protected ScienceSettingRepository scienceSettingRepository; | ||
|
||
@Autowired | ||
protected ScienceEventTestRepository scienceEventRepository; | ||
|
||
@Autowired | ||
protected PrerequisiteRepository prerequisiteRepository; | ||
|
||
@Autowired | ||
protected CompetencyJolRepository competencyJolRepository; | ||
|
||
// External Repositories | ||
@Autowired | ||
protected LectureRepository lectureRepository; | ||
|
||
@Autowired | ||
protected LectureUnitRepository lectureUnitRepository; | ||
|
||
@Autowired | ||
protected GradingCriterionRepository gradingCriterionRepository; | ||
|
||
@Autowired | ||
protected TextUnitRepository textUnitRepository; | ||
|
||
@Autowired | ||
protected AttachmentUnitRepository attachmentUnitRepository; | ||
|
||
@Autowired | ||
protected ExerciseUnitRepository exerciseUnitRepository; | ||
|
||
@Autowired | ||
protected SubmissionTestRepository submissionRepository; | ||
|
||
@Autowired | ||
protected ProgrammingExerciseTestRepository programmingExerciseRepository; | ||
|
||
@Autowired | ||
protected ProgrammingExerciseBuildConfigRepository programmingExerciseBuildConfigRepository; | ||
|
||
// Services | ||
|
||
@Autowired | ||
protected CompetencyProgressService competencyProgressService; | ||
|
||
@Autowired | ||
protected FeatureToggleService featureToggleService; | ||
|
||
// External Services | ||
@Autowired | ||
protected LectureUnitService lectureUnitService; | ||
|
||
@Autowired | ||
protected ParticipationService participationService; | ||
|
||
// Util Services | ||
@Autowired | ||
protected CompetencyProgressUtilService competencyProgressUtilService; | ||
|
||
@Autowired | ||
protected CompetencyUtilService competencyUtilService; | ||
|
||
@Autowired | ||
protected PrerequisiteUtilService prerequisiteUtilService; | ||
|
||
@Autowired | ||
protected StandardizedCompetencyUtilService standardizedCompetencyUtilService; | ||
|
||
@Autowired | ||
protected LearningPathUtilService learningPathUtilService; | ||
|
||
// External Util Services | ||
@Autowired | ||
protected PageableSearchUtilService pageableSearchUtilService; | ||
|
||
@Autowired | ||
protected TextExerciseUtilService textExerciseUtilService; | ||
|
||
@Autowired | ||
protected LectureUtilService lectureUtilService; | ||
|
||
@Autowired | ||
protected StudentScoreUtilService studentScoreUtilService; | ||
|
||
@Autowired | ||
protected ParticipationUtilService participationUtilService; | ||
|
||
@Autowired | ||
protected TeamUtilService teamUtilService; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/de/tum/cit/aet/artemis/atlas/architecture/TestArchitectureTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.tum.cit.aet.artemis.atlas.architecture; | ||
|
||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; | ||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noMembers; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import de.tum.cit.aet.artemis.atlas.AbstractAtlasIntegrationTest; | ||
import de.tum.cit.aet.artemis.shared.architecture.AbstractArchitectureTest; | ||
|
||
class TestArchitectureTest extends AbstractArchitectureTest { | ||
|
||
@Test | ||
void integrationTestsShouldExtendAbstractAtlasIntegrationTest() { | ||
classes().that().resideInAPackage(ARTEMIS_PACKAGE + ".atlas").and().haveSimpleNameEndingWith("IntegrationTest").should().beAssignableTo(AbstractAtlasIntegrationTest.class) | ||
.because("All integration tests should extend AbstractAtlasIntegrationTest").check(testClasses); | ||
} | ||
MaximilianAnzinger marked this conversation as resolved.
Show resolved
Hide resolved
MaximilianAnzinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Test | ||
void integrationTestsShouldNotAutowireMembers() { | ||
noMembers().that().areAnnotatedWith(Autowired.class).should().beDeclaredInClassesThat().areAssignableTo(AbstractAtlasIntegrationTest.class).andShould() | ||
.notBeDeclaredIn(AbstractAtlasIntegrationTest.class) | ||
.because("Integration tests should not autowire members in any class that inherits from AbstractAtlasIntegrationTest").check(testClasses); | ||
} | ||
MaximilianAnzinger marked this conversation as resolved.
Show resolved
Hide resolved
MaximilianAnzinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
MaximilianAnzinger marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Add JavaDoc comment to the class definition
Consider adding a JavaDoc comment to the
AbstractAtlasIntegrationTest
class to describe its purpose and usage. This will enhance code readability and help other developers understand the intent of this abstract test class.