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

Randoop: add runner parameter for filtering out tests that do not call SUT #9

Open
micskeiz opened this issue Apr 7, 2016 · 0 comments

Comments

@micskeiz
Copy link
Member

micskeiz commented Apr 7, 2016

Randoop generated tests for snippets in L2 where the test code just creates complex strings, but does not call the snippet method.

For example, this is the code for one of the tests:

    byte[] byte_array0 = new byte[] {  };
    // The following exception was thrown during execution in test generation
    try {
      java.lang.String str4 = new java.lang.String(byte_array0, 100, 100, "");
      org.junit.Assert.fail("Expected exception of type java.lang.StringIndexOutOfBoundsException");
    } catch (java.lang.StringIndexOutOfBoundsException e) {
      // Expected exception.
      if (! e.getClass().getCanonicalName().equals("java.lang.StringIndexOutOfBoundsException")) {
        org.junit.Assert.fail("Expected exception of type java.lang.StringIndexOutOfBoundsException, got " + e.getClass().getCanonicalName());
      }
    }       
    // Regression assertion (captures the current behavior of the code)
    org.junit.Assert.assertNotNull(byte_array0);

Randoop has a parameter to handle this:

--include-if-classname-appears=regex. Classes, one of which every test must use. Randoop will only output tests that have at least one use of a member of a class whose name matches the regular expression.

Add this parameter to Randoop runner to filter out these tests.

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