abap unit 断言异常

1:使用sy-subrc对异常进行断言。

    CALL METHOD f_cut->if_crms4_product_api~get_gtin_by_id
      EXPORTING
        iv_product_id = lv_product_id
      IMPORTING
        et_gtin       = lt_crms4t_product_gtin
      EXCEPTIONS
        not_found     = 1
        wrong_call    = 2
        OTHERS        = 3.

    cl_abap_unit_assert=>assert_equals( act = sy-subrc
                                    exp = '1' ).

猜你喜欢

转载自www.cnblogs.com/liyafei/p/11420171.html