ABL Unit Test 11.6 - Catching customized errors using assertions - Forum - OpenEdge Development - Progress Community

ABL Unit Test 11.6 - Catching customized errors using assertions


ABL Unit Test 11.6 - Catching customized errors using assertions

  • How can we catch the customized errors returned from the called class methods in the ABLUnit Test?

    Customized errors like undo, throw new apperr " Error msg  " or langerr "  Error msg ".

  • any update guyz ?

  • Not sure what the question really is.  I don't know much about ABLUnit, but the ABLUnit methods would have to throw any error that occurred.  Then you would catch it as you normally would any other error with a CATCH block.

    So are you asking how to catch an error?  Are you asking how the ABLUnit methods can throw an error back to the caller?

  • If there is an error while executing the test the test is considered as a failure case. You may not catch the error raised.

    But you can specify the exception by passing a expected parameter to the Test case as shown below.

        METHOD PUBLIC VOID TestPass(): 
        END METHOD.

    In the above case the test is considered to be passed.

    Let us know if you are looking for something else.

    Phani S.
  • if we pass this


    what it will do ?

  • The test case is considered pass if the error specified in expected attribute is raised.

    That is a sample example. When you are testing application logic (a method for example), that might throw exceptions for certain input.

    If you want to test your method is throwing an exception for certain input then you can specify that as part of expected attribute as showing in above snippet.

  • OK Gr8.

    One of the method is throwing customized error like below . How do i catch this error in my test ? or have to use simple catch statement ?


                     UNDO, THROW NEW appError ("Error msg ").  


  • any update on this guys ?

  • Beg my pardon. But this is a community forum - not a place with a SLA.

    On your last question. You are not very clear on why you want to catch that error. But most likely you have answered your own question. Or it was already replied by Phani Sajja: CATCH or annotate.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • How can we change the  Results.xml path for the test results ?

    Currently it is generating under the tests folder as a default directory.

  • By default, it will be created in working directory.

    If you want to change, you change the working directory from 'Run Configurations' -> 'Working directory' in the ABLUnit main page.

    It always overwrite this file if you run a different test entity in the next run.

    You can use the Export feature from ABLUnit results view rather than relying on this results.xml file.



    Phani S.

  • If you are using PDS OE to run ABLUnit tests, results will be generated under working directory mentioned in PDS OE's ABLUnit run configuration. Changing working directory to other might help.

    If you are running from command-line, you can use outputdir parameter to generated results in custom location.

  • Thanks.

    Now I am designing build.xml and adding DB names like


    <dbinfo name="C:\OpenEdge\WRK114\s2000.db" host="localhost" port="4545" />

    I am putting DB name, server name and port number  but while running the build.xml using Ant Build i am getting error in console " DB xxx is not a valid DB name", not sure y. DB is on separate server.

    All the parameters are correct. Using editor if I put the same parameters in CONNECT statement, it is working for me.

    But through build.xml I am getting that error.

  • If the db specified in the given location with name attribute is not available it will raise exception.

    Make sure that the db 's2000.db' present in the specified directory 'C:\OpenEdge\WRK114', which you have given.

  • My DB server is on another machine so i am giving only db name like "Test" not the whole path and passing other parameters like

    <dbinfo name="Test.db" host="host007" port="4545" />

    still not working .