SERG-Delft / andy

Andy assesses student's test code. It's used in CSE1110, TU Delft.
MIT License
78 stars 22 forks source link

When running meta tests, we should skip Jacoco #230

Closed cashbreaker closed 1 year ago

cashbreaker commented 1 year ago

Solved issue #202

I have checked the code and I think setting skipJacoco to true may be impossible (or too much hassle) since it is implemented as method that is overridden by user in config file.

This is the code that loads RunConfiguration

Class<?> runConfigurationClass = Class.forName(getConfigurationClass(ctx.getNewClassNames()), false, currentClassLoader);
RunConfiguration runConfiguration = (RunConfiguration) runConfigurationClass.getDeclaredConstructor().newInstance();

There is no easy way of overriding methods at runtime in Java. Therefore I think that second if in InstrumentCodeForCoverageStep is a simple and good solution. Which I have implemented in this branch

// Skip step if running meta test
        if (ctx.getAction().equals(Action.META_TEST)) {
            return;
        }
martinmladenov commented 1 year ago

@mauricioaniche Does this step even run when executing meta tests? From what I see, only the RunJUnitTestsStep is executed there.

image

image

mauricioaniche commented 1 year ago

Hmm, great catch, @martinmladenov. Does this mean we don't even need this PR?

cashbreaker commented 1 year ago

I have just checked the code and as Martin showed at the moment Jacoco does not run when running meta test. And since user can't specify their own Steps therefore this PR solves nonexistent issue. I think we can just close it.

mauricioaniche commented 1 year ago

Thanks for double checking, @cashbreaker. I'll close the PR and the issue!