Skip to content
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

Cache CtMethod's TestFrameworkSupport #113

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static void init(Factory factory) {
_instance = new TestFramework(factory);
}

private HashMap<CtMethod<?>, TestFrameworkSupport> cachedTestFrameworks;

private List<TestFrameworkSupport> testFrameworkSupportList;

public static TestFramework get() {
Expand All @@ -49,6 +51,7 @@ public static TestFramework get() {

private TestFramework(Factory factory) {
this.factory = factory;
this.cachedTestFrameworks = new HashMap<>();
this.testFrameworkSupportList = new ArrayList<>();
this.testFrameworkSupportList.add(new JUnit3Support());
this.testFrameworkSupportList.add(new JUnit4Support());
Expand Down Expand Up @@ -163,8 +166,10 @@ private TestFrameworkSupport getTestFramework(CtMethod<?> testMethod) {
DSpotCache.getTestFrameworkCache().put(TypeUtils.getQualifiedName(originalMethod), tfs);
}
return tfs;*/
// TODO Enable the cache in test-runner
return getTestFrameworkImpl(testMethod);
if (!cachedTestFrameworks.containsKey(testMethod)) {
cachedTestFrameworks.put(testMethod, getTestFrameworkImpl(testMethod));
}
return cachedTestFrameworks.get(testMethod);
}


Expand Down