Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-184

Allow TestNG test classes to import BMUnit behaviour using @Listener annotation

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 2.0.0
    • 1.6.0
    • Contrib
    • None

    Description

      Currently a TestNG test class needs to inherit the Before and After methods which load and unload Byteman rules by subclassing class BMNGRunner i.e. the model for how you configure a Byteman-enabled test class is

      @BMScript(...)
      public MyTestClass extends BMNGRunner {
      @BMRule(...)
      @Test public void MyMethod()

      { ...}
      . . .


      Although this conforms to the expected model for implementing TestNG test classes it can be awkward in situations where it is desirable for the test class to inherit from some other library class. It would be helpful if the Before and After loading behaviour could be attached to the test class using an annotation instead of inheritance and, indeed, the @Listeners annotation provided by TestNG already makes this possible. So, the preferred alternative model for the test class configuration would be

      @BMScript(...)
      @Listeners({BMNGListener.class})
      public MyTestClass {
      @BMRule(...)
      @Test public void MyMethod() { ...}

      . . .

      n.b. the brackets around the class list are optional

      Attachments

        Activity

          People

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-adinn Andrew Dinn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: