EvoSuite / evosuite

EvoSuite - automated generation of JUnit test suites for Java classes
http://www.evosuite.org
GNU Lesser General Public License v3.0
832 stars 341 forks source link

Which parts of the EVOSUITE internal insert JUnit Assertion? #373

Closed jiseongg closed 3 years ago

jiseongg commented 3 years ago

I've read the EVOSUITE tutorial, and found that inserting JUnit Assertion is done by the post-processing part. This is one I want to disable for research purpose, and need some advice where to start hack. Also, if it's simple, I want to disable the EVOSUITE's expectation about some error, which seems to wrap code with try-catch block.

Thanks in advance for any help you are able to provide.

gofraser commented 3 years ago

For assertion generation check the abstract class org.evosuite.assertion.AssertionGenerator in the client module; the default version used is the SimpleMutationAssertionGenerator. If you want to disable assertion generation the commandline option is -Dassertions=false.

However, note that assertion generation is not what adds try/catch blocks: EvoSuite does not know the intended behaviour of the class under test, so it captures exactly what it is doing right now, and that includes exceptions.

You can configure EvoSuite not to add catch blocks for undeclared exceptions using -Dcatch_undeclared_exceptions=false, maybe that is what you need?

jiseongg commented 3 years ago

Thank you for detailed answer. I think it will be of great help :)