STAMP-project / evosuite-ramp

Runtime test AMPlification (RAMP) implements novel features for automatic test generation. It is built on top of EvoSuite.
https://www.stamp-project.eu
GNU Lesser General Public License v3.0
0 stars 1 forks source link

Remove seeding-generation tests with NPEs #4

Open vmassol opened 5 years ago

vmassol commented 5 years ago

I've noticed that the majority of the generated tests for xwiki-commons-xml are about setting some values that lead to an NPE and the test verifies that the NPE is thrown.

There are 2 problems with this: 1) On XWiki we don't have the practice of checking for null values for all parameters. We check for null at system boundary. 2) It generates a test that doesn't make sense for us and at best is a wrong test since throwing a NPE is never a good thing ;)

Is it possible to disable generating this type of tests?

pderakhshanfar commented 5 years ago

Hi @vmassol,

There is no precise way to avoid NPE capturing by generated tests. However, EvoSuite uses eight different criteria for test generation by default. One of them is Exception criteria, which capture all of the exceptions. You can run EvoSuite without this criterion by adding this parameter:

-Dcriterion=BRANCH:LINE:WEAKMUTATION:OUTPUT:METHOD:METHODNOEXCEPTION:CBRANCH
vmassol commented 5 years ago

Note: I think capturing exception is useful in several cases.

pderakhshanfar commented 5 years ago

Yes, but unfortunately, in EvoSuite, you can not capture only one specific type of exception.