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

feature-request in Evosuite #443

Open
Vishalsng112 opened this issue Dec 14, 2022 · 1 comment
Open

feature-request in Evosuite #443

Vishalsng112 opened this issue Dec 14, 2022 · 1 comment

Comments

@Vishalsng112
Copy link

Context

Please provide below a detailed introduction to the issue itself, and describe what you were doing when the issue happened. Or, what do you want to achieve?

I want to generate a testsuite with some constrained, like some specific lines that must not be executed in the generated test suite. For example, for the given program below, I want Evosuite to generate the testsuite such that it will not execute the function public T pop(). Is there any parameter already in the tool where I can specify line numbers to execute or not execute? If not, can you please tell me where I need to make changes in the source code so I can get this feature in the tool? It will be beneficial for my work.

public class Stack<T> {
    private int capacity = 10;
    private int pointer  = 0;
    private T[] objects = (T[]) new Object[capacity];
    
    public void push(T o) {
	if(pointer >= capacity)
	    throw new RuntimeException("Stack exceeded capacity!");
	objects[pointer++] = o;
    }
    public T pop() {
	if(pointer <= 0)
	    throw new EmptyStackException();
	return objects[--pointer];
    }
    public boolean isEmpty() {
	return pointer <= 0;
    } 
}

@firhard
Copy link

firhard commented Sep 13, 2023

You can use one of these parameters to set which methods you'd like to generate tests for:

https://github.com/EvoSuite/evosuite/blob/HEAD/client/src/main/java/org/evosuite/Properties.java#L1594-L1610

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

No branches or pull requests

2 participants