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

java.lang.IllegalStateException: LimitObjectGene has no value when trying to generate whitbox tests #813

Closed
victorhugofr opened this issue Sep 28, 2023 · 7 comments
Labels

Comments

@victorhugofr
Copy link

When i try to run whitebox mode, EM returns an error:
* [ERROR] EvoMaster process terminated abruptly. This is likely a bug in EvoMaster. Please copy&paste the fol lowing stacktrace, and create a new issue on https://github.com/EMResearch/EvoMaster/issues java.lang.IllegalStateException: LimitObjectGene has no value at org.evomaster.core.search.gene.LimitObjectGene.getValueAsPrintableString(LimitObjectGene.kt:32) at org.evomaster.core.search.gene.Gene.getValueAsPrintableString$default(Gene.kt:267) at org.evomaster.core.search.gene.OptionalGene.getValueAsPrintableString(OptionalGene.kt:143) at org.evomaster.core.search.gene.Gene.getValueAsPrintableString$default(Gene.kt:267) at org.evomaster.core.search.gene.ObjectGene.getValueAsPrintableString(ObjectGene.kt:108) at org.evomaster.core.search.gene.Gene.getValueAsPrintableString$default(Gene.kt:267) at org.evomaster.core.search.gene.OptionalGene.getValueAsPrintableString(OptionalGene.kt:143) at org.evomaster.core.search.gene.Gene.getValueAsPrintableString$default(Gene.kt:267) at org.evomaster.core.problem.rest.service.RestResourceFitness.doCalculateCoverage(RestResourceFitness.kt:76) at org.evomaster.core.problem.rest.service.RestResourceFitness.doCalculateCoverage(RestResourceFitness.kt:17) at org.evomaster.core.search.service.FitnessFunction.calculateIndividualWithPostHandling(FitnessFunction.kt:104) at org.evomaster.core.search.service.FitnessFunction.calculateCoverage(FitnessFunction.kt:56) at org.evomaster.core.search.service.FitnessFunction.calculateCoverage$default(FitnessFunction.kt:48) at org.evomaster.core.search.algorithms.MioAlgorithm.searchOnce(MioA lgorithm.kt:38) at org.evomaster.core.search.service.SearchAlgorithm.search(SearchAlgorithm.kt:66) at org.evomaster.core.Main$Companion.run(Main.kt:437) at org.evomaster.core.Main$Companion.initAndRun(Main.kt:150) at org.evomaster.core.Main$Companion.main(Main.kt:74) at org.evomaster.core.Main.main(Main.kt)

Version of EM: 1.5.0
Running from JAR
Command-line options: java -jar evomaster.jar --outputFolder src/test/java --generateSqlDataWithSearch false --heuristicsForSQL false

@victorhugofr
Copy link
Author

Here is my EMDriver:

`
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.evomaster.client.java.controller.AuthUtils;
import org.evomaster.client.java.controller.EmbeddedSutController;
import org.evomaster.client.java.controller.InstrumentedSutStarter;
import org.evomaster.client.java.controller.api.dto.AuthenticationDto;
import org.evomaster.client.java.controller.api.dto.SutInfoDto;
import org.evomaster.client.java.controller.internal.db.DbSpecification;
import org.evomaster.client.java.controller.problem.ProblemInfo;
import org.evomaster.client.java.controller.problem.RestProblem;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import br.Application;
import io.swagger.annotations.Api;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Api(value = "API REST")
@EnableSwagger2
@SpringBootApplication(scanBasePackages="br")
@EntityScan("br.entity")
@EnableJpaRepositories("br.repo")
public class EMDriver extends EmbeddedSutController{
protected static String[] argumentos;

 public static void main(String[] args){
	 argumentos=args;
        int port = 40100;

        EMDriver controller = new EMDriver(port);
        InstrumentedSutStarter starter = new InstrumentedSutStarter(controller);

        starter.start();
    }

 public EMDriver() {
        this(40100);
    }

    public EMDriver(int port) {
        setControllerPort(port);
    }
    protected int getSutPort() {
        return (Integer) ((Map) ctx.getEnvironment()
                .getPropertySources().get("server.ports").getSource())
                .get("local.server.port");
    }
@Override
public String startSut() {
	ctx = SpringApplication.run(Application.class, argumentos);

    return "http:https://localhost:" + getSutPort();
}


@Override
public void stopSut() {
	 ctx.stop();
}

@Override
public void resetStateOfSUT() {
	// TODO Auto-generated method stub
	
}

private ConfigurableApplicationContext ctx;


@Override
public boolean isSutRunning() {
    return ctx!=null && ctx.isRunning();
}

@Override
public String getPackagePrefixesToCover() {
    return "br.rest";
}

@Override
public List<AuthenticationDto> getInfoForAuthentication() {
	return Arrays.asList(
            AuthUtils.getForBasic("admin","ad.min","yrdy")
    );
}


@Override
 public ProblemInfo getProblemInfo() {
    return new RestProblem("http:https://localhost:8080/application/v2/api-docs", null);
}

@Override
public SutInfoDto.OutputFormat getPreferredOutputFormat() {
    return SutInfoDto.OutputFormat.JAVA_JUNIT_5;
}

@Override
public List<DbSpecification> getDbSpecifications() {
	// TODO Auto-generated method stub
	return null;
}

}
`

@arcuri82
Copy link
Collaborator

thx.

1.5.0 is an old version. can you try latest 1.6.1, to see if the problem might already been solved? (that part of the code has got lot of refactoring in the last year...)

@victorhugofr
Copy link
Author

victorhugofr commented Sep 29, 2023

thx.

1.5.0 is an old version. can you try latest 1.6.1, to see if the problem might already been solved? (that part of the code has got lot of refactoring in the last year...)

@arcuri82 Thank you again, I tried running the latest version: 1.6.1, and I succeeded :-)
However, before the final result, EvoMaster returned some WARN's (are they very concerning? Could they have significantly affected the final result?):
image

And the final result had some odd variables, like Bytecode line coverage: NaN% and a large number of potential faults.
image

I'm trying to run EM with --maxtime 120m now

@victorhugofr
Copy link
Author

thx.
1.5.0 is an old version. can you try latest 1.6.1, to see if the problem might already been solved? (that part of the code has got lot of refactoring in the last year...)

@arcuri82 Thank you again, I tried running the latest version: 1.6.1, and I succeeded :-) However, before the final result, EvoMaster returned some WARN's (are they very concerning? Could they have significantly affected the final result?): image

And the final result had some odd variables, like Bytecode line coverage: NaN% and a large number of potential faults. image

I'm trying to run EM with --maxtime 120m now

After this, EM returns a bug:
image

@arcuri82
Copy link
Collaborator

arcuri82 commented Oct 1, 2023

hi @victorhugofr

thanks. few things:

  1. you can ignore those WARN messages (those are just internal details)

  2. the 0% line coverage is weird... are you sure that the "br.rest" package name is correct? In any case, we should provide a better error/warning message in those cases

  3. the last error reminds me of a known issue, which might already had been fixed in current SNAPSHOT. We are going to have a new release soon (hopefully within 1-2 weeks, after fixing some other bugs)

arcuri82 added a commit that referenced this issue Oct 5, 2023
issue #813: better info if getPackagePrefixesToCover() is misconfigured
@arcuri82
Copy link
Collaborator

hi @victorhugofr ,

could you please check if you still get the same issue with the latest 2.0.0 release? (we have made several fixes with might be related to the issues you experienced)

@arcuri82
Copy link
Collaborator

closed as it might be fixed, and no further info has been provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants