Skip to content

Unit tests should test interface and only interface #35

Open

Description

@meg23

From cyounk...@gmail.com on July 31, 2009 15:46:21

The unit tests packaged with ESAPI should only test the interface and not
contain code that is specific to the default implementations. This means
two things in particular:

  1. All types should be from the API interfaces
  2. Methods called on instances being tested should only reflect those in
    the API

Specific tests that call methods not in the API:

  • AuthenticatorTest.testSaveUsers

... more to come.

Original issue: http://code.google.com/p/owasp-esapi-java/issues/detail?id=25

Activity

  1. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From eofte...@gmail.com on September 09, 2009 23:54:21

    Maybe split the tests in two. One folder for interface and one for default
    implementations. That way you can still test the default implementations on a finer
    granularity.

  2. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From manico.james@gmail.com on October 31, 2010 22:57:37

    Status: Accepted
    Owner: jeff.wil...@owasp.org
    Labels: Milestone-Release2.1

  3. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From chrisisbeef on November 20, 2010 13:14:10

    Blockedon: 168

  4. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From chrisisbeef on November 20, 2010 13:14:34

    Blockedon: -168 186

  5. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From chrisisbeef on November 20, 2010 13:14:55

    Owner: chrisisbeef

  6. meg23 commented on Nov 13, 2014

    @meg23
    Author

    From chrisisbeef on November 20, 2010 13:15:28

    Labels: Component-Other Build-Maven

  7. kwwall commented on Feb 1, 2016

    @kwwall
    Contributor

    Previous comment had blocked on Google Code issue 186. That is now issue #196.

  8. added this to the 3.0 milestone on Jul 5, 2019
  9. kwwall commented on Jul 5, 2019

    @kwwall
    Contributor

    The original Google Code issue seems to imply that the reference implementation classes should not be tested at all, which is of course absurd. One cannot write meaningful unit tests in the absence of any implementation at all.

    That said, if the objection is against testing implementation specific methods in a JUnit test meant to test interfaces, that I can agree with. As noted, the AuthenticatorTest class, which presumably is meant for testing the implementation of only the methods defined in the Authenticator interface, also includes a 'testSaveUsers()' test case that tests the implementation of FileBasedAuthenticator.saveUsers() method, a method which is not defined in the Authenticator interface. Clearly that 'testSaveUsers()' method should be moved to a implementation specific class, such as FileBasedAuthenticatorTests (which does not currently exist).

    At this point, I do not think it is prudent to make these changes before the anticipated ESAPI 3.0 release, and for that reason, I have changed this to the 3.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions