Camel
  1. Camel
  2. CAMEL-5983

Avoid the negative-tests to behave as false-positive

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.10.3
    • Fix Version/s: 2.10.4, 2.11.0
    • Component/s: tests
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      We've got bunch of (negative) tests on the current codebase expecting a thrown XYZException however they don't realize if the expected exception is not thrown, the typical pattern for this is:

      try {
       doSomething_With_Expectation_Of_A_Thrown_XYZException();
      } catch (XYZException e) {
       // expected
      }
      

      Which correctly should be:

      try {
       doSomething_With_Expectation_Of_A_Thrown_XYZException();
       fail("Should have thrown an exception");
      } catch (XYZException e) {
       // expected
      }
      

        Activity

        Hide
        Babak Vahdat added a comment -

        Fixed the tests not being false-postive on the trunk as well as the 2.10.x brunch:

        http://svn.apache.org/viewvc?view=revision&revision=1435812
        http://svn.apache.org/viewvc?view=revision&revision=1435814

        Show
        Babak Vahdat added a comment - Fixed the tests not being false-postive on the trunk as well as the 2.10.x brunch: http://svn.apache.org/viewvc?view=revision&revision=1435812 http://svn.apache.org/viewvc?view=revision&revision=1435814
        Hide
        Babak Vahdat added a comment -

        Indeed there are 4 false-positive tests on the trunk codebase which I'm attaching to this ticket as partial fix.

        Show
        Babak Vahdat added a comment - Indeed there are 4 false-positive tests on the trunk codebase which I'm attaching to this ticket as partial fix.
        Hide
        Babak Vahdat added a comment -

        The previous two commits include two camel-mongodb tests being fixed as well however I could not verify if they are really false-positive or not as a real run of them would require a MongoDb installation.
        Any committer having such a installation is welcome to verify these tests truly.

        Show
        Babak Vahdat added a comment - The previous two commits include two camel-mongodb tests being fixed as well however I could not verify if they are really false-positive or not as a real run of them would require a MongoDb installation. Any committer having such a installation is welcome to verify these tests truly .
        Hide
        Babak Vahdat added a comment -

        Actually there were even much more tests being affected than I initially thought:

        http://svn.apache.org/viewvc?view=revision&revision=1435861
        http://svn.apache.org/viewvc?view=revision&revision=1435863

        Show
        Babak Vahdat added a comment - Actually there were even much more tests being affected than I initially thought: http://svn.apache.org/viewvc?view=revision&revision=1435861 http://svn.apache.org/viewvc?view=revision&revision=1435863
        Hide
        Babak Vahdat added a comment - - edited

        Updated the attached partial patch as well which now includes more negative tests being effectively false-positive.

        Show
        Babak Vahdat added a comment - - edited Updated the attached partial patch as well which now includes more negative tests being effectively false-positive.
        Hide
        Babak Vahdat added a comment -

        O.K. already fixed bunch of the tests being attached to this ticket (see CAMEL-5983-partial.patch). Following the list of the ones which still need to be fixed:

        CxfEndpointUtilsTest
        JettyHttpProducerSimulate404ErrorTest
        MixedPropagationTransactedTest
        TransactionalClientDataSourceMixedTransactedTest
        ObjectPoolTest
        

        Hope to find a free time slot by the next days to fix them as well.

        Show
        Babak Vahdat added a comment - O.K. already fixed bunch of the tests being attached to this ticket (see CAMEL-5983 -partial.patch ). Following the list of the ones which still need to be fixed: CxfEndpointUtilsTest JettyHttpProducerSimulate404ErrorTest MixedPropagationTransactedTest TransactionalClientDataSourceMixedTransactedTest ObjectPoolTest Hope to find a free time slot by the next days to fix them as well.
        Hide
        Babak Vahdat added a comment -

        All the remaining tests being mentioned by the previous post have been now fixed as well.

        Show
        Babak Vahdat added a comment - All the remaining tests being mentioned by the previous post have been now fixed as well.

          People

          • Assignee:
            Babak Vahdat
            Reporter:
            Babak Vahdat
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development