You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use EvoSuite to generate unit test for classes some of which have 10,000 methods. I know this is not realistic, but this is a test set to show some extremities. Luckily EvoSuite has target_method option which can help in such cases.
Steps to Reproduce
I see one example that talks about this option, but I couldn't find enough resources that can direct me to the proper use.
For example I use the following class
import java.util.*;
class EvoDriver{
public static int start(int num) {
boolean h = num > 0;
if (deep1(h))
return 1;
return 0;
}
public static boolean deep1(boolean x) {
return deep2(x);
}
public static boolean deep2(boolean x) {
return deep3(x);
}
public static boolean deep3(boolean x) {
return deep4(x);
}
public static boolean deep4(boolean x) {
return deep5(x);
}
public static boolean deep5(boolean x) {
return x;
}
public static void main (String [] args)
{
Scanner inp = new Scanner(System.in);
System.out.println(start(inp.nextInt()));
}
}
EvoSuite Arguments
Inferring from this example, when I compile and run this for the start function, it works and generates a test set:
also works when I use target_method
But I don't know how to make this work for other types of input parameters (or set of input parameters).
Current Result
For example, once it failed for deep1 function and in the report it used deep1(z)z. But when I try this (or deep1(b)b), it fails.
* EvoSuite 1.2.0
* Going to generate test cases for class: EvoDriver
* Starting Client-0
* Connecting to master process on port 14647
* Analyzing classpath:
- ./
* Finished analyzing classpath
* Generating tests for class EvoDriver
* Test criteria:
- Line Coverage
- Branch Coverage
- Exception
- Mutation testing (weak)
- Method-Output Coverage
- Top-Level Method Coverage
- No-Exception Top-Level Method Coverage
- Context Branch Coverage
* Total number of test goals for DYNAMOSA: 22
* Using seed 124
* Starting evolution
[Progress:> 0%] [Cov:> 0%]* Computation finished
[MASTER] 15:45:35.276 [logback-2] ERROR ClientNodeImpl - Error when generating tests for: EvoDriver with seed 124. Configuration id : null
java.lang.NullPointerException: null
at org.evosuite.ga.metaheuristics.mosa.structural.MultiCriteriaManager.addDependencies4WeakMutation(MultiCriteriaManager.java:298)
at org.evosuite.ga.metaheuristics.mosa.structural.MultiCriteriaManager.<init>(MultiCriteriaManager.java:121)
at org.evosuite.ga.metaheuristics.mosa.DynaMOSA.generateSolution(DynaMOSA.java:146)
at org.evosuite.ga.metaheuristics.TestSuiteAdapter.generateSolution(TestSuiteAdapter.java:136)
at org.evosuite.strategy.MOSuiteStrategy.generateTests(MOSuiteStrategy.java:122)
at org.evosuite.TestSuiteGenerator.generateTests(TestSuiteGenerator.java:630)
Expected result
Can you please provide more information on the use of this option?
The text was updated successfully, but these errors were encountered:
imesecan
changed the title
Using EvoSuite target\_method
Using EvoSuite target_method
Nov 18, 2022
Context
I want to use EvoSuite to generate unit test for classes some of which have 10,000 methods. I know this is not realistic, but this is a test set to show some extremities. Luckily EvoSuite has target_method option which can help in such cases.
Steps to Reproduce
I see one example that talks about this option, but I couldn't find enough resources that can direct me to the proper use.
For example I use the following class
EvoSuite Arguments
Inferring from this example, when I compile and run this for the start function, it works and generates a test set:
also works when I use target_method
But I don't know how to make this work for other types of input parameters (or set of input parameters).
Current Result
For example, once it failed for deep1 function and in the report it used deep1(z)z. But when I try this (or deep1(b)b), it fails.
Expected result
Can you please provide more information on the use of this option?
The text was updated successfully, but these errors were encountered: