https://issues.apache.org/bugzilla/show_bug.cgi?id=47803

           Summary: Support for JUnit 4.x tests defined by annotations
           Product: JMeter
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: brian.swee...@sas.com


--- Comment #0 from Brian <brian.swee...@sas.com> 2009-09-08 10:39:13 PDT ---
Created an attachment (id=24229)
Support for junit annotated test cases

The current version of jmeter doesn't recognize test cases specified by the
@Test annotation for junit 4.x+.  Support should be easy to support since junit
3 is already supported.  Basically, an annotated test case sampler should look
for the @Test annotation instead of classes that extend TestCase.

That's what I've done in the attached patch.  The annotated sampler is an
extension of the 3.x sampler.  I've overridden the sample method and a couple
of support methods to work with the new style tests.  That causes a difference
in behavior between instances of the 3.x and annotated samplers.  I initially
wanted to share the UI code and have it intelligently switch between 3.x and
annotated instances, but the methods available didn't easily permit that.  The
choice was between adding a very limited new UI type or hiding the actual junit
sampler instance behind a facade.  It seemed more in keeping with other
patterns to just make another UI class.  That seems like a reasonable choice
given that I expect users will know what they're trying to test (and which
version of junit they depend on) before they start writing test plans.

There are 2 remaining details where I could use some help.  First, I've added a
resource key (junit_4_request=JUnit Annotated Request) that needs to be
translated. I'm not sure what the process for that is.  Second, in the saved
test plan files, saves of my added class use the fully qualified name.  Other
classes seem to use short names.  Everything seems to work okay for me, but
there's probably a reason it looks different. I imagine that should be fixed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to