Uploaded image for project: 'ngrinder'
  1. ngrinder
  2. NGRINDER-626

Add @RunRate annotation to control the run frequency for each @Test method


    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2.1
    • Component/s: core
    • Labels:


      When running groovy script in groovy maven project in IDE, it's hard to control the run frequency with JUnit runner.

      If a user want to run multiple test methods which have different run rate, a user assigns each to different thread to control the frequency in jython context. However IDE's JUnit runner uses only one thread to run whole tests so that we can not distribute the run frequencies into several threads.

      Through NGRINDER-624 nGrinder start to provide the grinder.runNumber property so it might be good idea for each test methods to decide if the method should be executed in the current run number. Furthermore, if we provide a annotation scheme like below, it might be excellant.

      With this fix the script will be like following.

      class TestRunner {
      @RunRate(100) // This method will be always run.. 100% runrate.
      public void doTest1() {
      @RunRate(2) // This method will be run 2% of total run
      public void doTest2() {

      In above samle, there will be 100 runs due to @Repeat(100).. This is only applied in the JUnitRunner in IDE. Then doTest1() will run 100 times every time it executes the test. doTest1() will run 2 times at 50th run, 100th run.

      In case of there are only one test method, @RunRate should be ignored because it's meaningless.


        junoyoon JunHo Yoon added a comment -


        junoyoon JunHo Yoon added a comment - Fixed


          • Assignee:
            junoyoon JunHo Yoon
            junoyoon JunHo Yoon
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: