How to get the InnerException in PCT ABLUnit
 
Forums / SmartComponent Library - Developer Forum / How to get the InnerException in PCT ABLUnit

How to get the InnerException in PCT ABLUnit

12 posts, 0 answered
  1. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    07 May
    Link to this post
    We have a unit test that fails.
    The useful information why it is failing is in an innerexception.

    Is there a way/technique to get ABLUnit report the innerexception,

    ```
    Error Message
    Error while loading service: be.cce.SmartTools.OERA.CceServiceManagerImpl

    Stacktrace
    Load Consultingwerk.Framework.ServiceLoader at line 1358 (/usr2/cce/build/develop/tty/Consultingwerk/Framework/ServiceLoader.r)
    ...
    OpenEdge.ABLUnit.Runner.ABLRunner at line 146 (OpenEdge/ABLUnit/Runner/ABLRunner.r) ABLUnitCore.p at line 97 (ABLUnitCore.r) /tmp/pctinit211339376.p at line 152 (/tmp/pctinit211339376.p)

    ```

    I can get at the error by adding -clientlog and -logentrytypes to the ABLUnit task butI'm looking for a way to get the error in the results.xml

  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    07 May in reply to Carl Verbiest
    Link to this post
    ABL Unit. Bah. ;-) This may be a question better suited for Progress Communities.

    The InnerException pattern it not standard in OpenEdge - so I don't think ABL Unit is aware of that. At the end of your tests, you could CATCH the error and THROW the inner exception. 

    Or you add the messages from the outer exception and the inner exception to a Progress.Lang.AppError and throw that.

    Having that said, I don't think that SmartUnit handles inner exception messages right now. But that could be added any time by switching from ErrorHelper:FormattedErrorMessages to FormattedErrorMessagesExt in the TestRunner.
  3. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Mike Fechner
    Link to this post
    I don't think the Progress Communitie.know what innerexceptions are ;-).

    I'll try SmartUnit

     
  4. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    08 May in reply to Carl Verbiest
    Link to this post
    :-)

    If you follow that route for real, let us know. We can look into reporting the nested messages then.
  5. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Mike Fechner
    Link to this post
    I'm trying to switch to SmartUnit

    Our ABLUnit used filesets, SmartUnit doesn't support the nested "fileset" element.
    I was able to fix that with some help from codeium ;-)

            <local name="test_files" />
            <pathconvert pathsep="," property="test_files">
                <fileset dir="${testproject}/tests" includes="**/Test*.cls" />
                <fileset dir="${testproject}/tests" includes="**/Test*.p" />
            </pathconvert>
            <SmartUnit
                testSuite="CceFramework Tests"  
                tests="${test_files}"  
                outputFile="output/smartunit.xml"  
                haltOnError="false"  
                forceXmlXref="false"
                logFailedTests="true"
                graphicalMode="false"
                dlcHome="${progress.DLC}"
                cpstream="utf-8"
                cpinternal="utf-8"
                compileUnderscore="true"
                inputchars="200000"
                catchStop="0">

                <DBConnectionSet refid="${MetadataDBConnectionSetid}" />
                <propath>
                    <pathelement path="${testproject}/tests" />
                    <path refid="PCTPropath" />
                </propath>
                <option name="-h" value="20" />
            </SmartUnit>
    SmartUnit finds 11 tests, but the resulting smartunit.xml does not contain any tests.
    test_CceFramework:
         [echo] Running tests from /usr2/cce/build/develop/git/lisabuilder/../ccesmarttools/TestCceFramework using PCTDBConnectionSet
    [SmartUnit] catchStop attribute in ANT file is set to: 0
    [SmartUnit] Processing fileset: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/ControlReport/TestControlReport.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/OERA/TestCceFieldTypeDynamicBusinessEntityRepository.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/Query/TestQueryExpressionHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestDimensionProvider.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestIPropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestJsonPropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestQueryHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestStringHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestTemptablePropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/mq/TestMessagingServiceBroker.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/tools/TestDbLisaPasswordService.cls
    [SmartUnit] Number of Tests: 11
    [SmartUnit] Finished Execute() CceFramework Tests
    [SmartUnit] *********** RETURNING "0" ***********

    <?xml version="1.0" encoding="UTF-8"?>
    <testsuites>
      <testsuite name="CceFramework Tests" tests="0" failures="0" timestamp="2024-05-08T13:57:53.848+02:00">
      </testsuite>
    </testsuites>

  6. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Carl Verbiest
    Link to this post
    The only thing the should have been bold was
    SmartUnit finds 11 tests, but the resulting smartunit.xml does not contain any tests.
  7. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    08 May in reply to Carl Verbiest
    Link to this post
    Are you using the verbose option? 

    It looks like it's finding 11 class files. Do the test classes use the @Test. annotation at the class level as well? That's an extra requirement for SmartUnit.
  8. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Mike Fechner
    Link to this post
    > Do the test classes use the @Test. annotation at the class level as well? 
    Probably not, I'll try adding that, is that just before the class statement ?

    @Test.
    class be.cce.SmartTools.ControlReport.TestControlReport:
    Added that to 2 of the test classes, but I see no difference.

    I had also added -Dsmartunit.services to get extra logging, but I don't see extra logging.

    ant -f /usr2/cce/build/develop/git/lisabuilder/build.xml -Dbasedir=. -Drcodedir=/usr2/cce/build/develop/tty -Dphase=develop -Dcustomdir=xccedev -Dsmartunit.services=git/smartcomponentlibrary/Consultingwerk/SmartUnit/Logging/services_smartunit_logging.xml test_CceFramework
  9. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Carl Verbiest
    Link to this post
    I added some SCL tests (**/*Test.cls from smartcomponentlibrary),
    the count increased form 12 to 14 but no test results either

    SmartUnit] Processing fileset: /usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/SmartUnit/OERA/RetrieveDataTest.cls,/usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/Studio/LineEndVerification/LineEndVerificationTest.cls,/usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/StudioTest/ClassAnnotationParserTest.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/ControlReport/TestControlReport.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/OERA/TestCceFieldTypeDynamicBusinessEntityRepository.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/Query/TestQueryExpressionHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestDimensionProvider.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestIPropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestJsonPropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestQueryHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestStringHelper.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestTemptablePropertyCollection.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/mq/TestMessagingServiceBroker.cls,/usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/tools/TestDbLisaPasswordService.cls
    [SmartUnit] Number of Tests: 14
    [SmartUnit] Finished Execute() CceFramework Tests
    [SmartUnit] *********** RETURNING "0" ***********
  10. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Carl Verbiest
    Link to this post
    ant -v might give some clue

    I notice TestRunner searches for .cls.cls instead of .cls

    [SmartUnit] Number of Tests: 14
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/SmartUnit/OERA/RetrieveDataTest/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/Studio/LineEndVerification/LineEndVerificationTest/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/smartcomponentlibrary/Consultingwerk/StudioTest/ClassAnnotationParserTest/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/ControlReport/TestControlReport/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/OERA/TestCceFieldTypeDynamicBusinessEntityRepository/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/SmartTools/Query/TestQueryExpressionHelper/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestDimensionProvider/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestIPropertyCollection/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestJsonPropertyCollection/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestQueryHelper/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestStringHelper/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/base/TestTemptablePropertyCollection/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/mq/TestMessagingServiceBroker/cls.cls ?
    [SmartUnit] Parsing filename: /usr2/cce/build/develop/git/ccesmarttools/TestCceFramework/tests/be/cce/ccetools/tools/TestDbLisaPasswordService/cls.cls ?
    [SmartUnit] Finished Execute() CceFramework Tests
    [SmartUnit] *********** RETURNING "0" ***********
    [SmartUnit] Exit code : 0
  11. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    08 May in reply to Carl Verbiest
    Link to this post
    I guess the tests can't be run from source and need to be compiled.
    Correct ?
  12. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    08 May in reply to Carl Verbiest
    Link to this post
    Source code is required as annotations are not in the r-code. On Windows we use Proparse to scan for annotations. On Linux we compile into x-ref on the fly.
12 posts, 0 answered