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

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

    Details

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

      Description

      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.

      @Repeat(100)
      @RunWith(GrinderRunner)
      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.

        Activity

        Hide
        junoyoon JunHo Yoon added a comment -

        Fixed

        Show
        junoyoon JunHo Yoon added a comment - Fixed

          People

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

            Dates

            • Created:
              Updated:
              Resolved: