Stacked Q&A

Run acceptance tests multiple times to find success ratio (java)
  • 1 voting
  • 2022-05-24 00:00

    I have a package of JUnit classes that represent my acceptance tests. I am coding a simulation with some randomness and I discovered that for a few of these tests there is a small probability of failure.

    What I'd like to do is to run all the tests in the package multiple times and store their success ratio in a csv file.
    Each line would be the name of the test and the success ratio.

    Is there an automated way to do this with JUnit or Gradle (which I am using for this project)?

  • 4 211 0 0
첨부 파일
답변
총 4개의 답변이있습니다.
  • 답변일: 2022-05-24 00:00

    I think you would have to code this yourself in your buildfile. Something like creating N tasks with names test1, test2, test3, ... with identical configuration. This would probably look something like:

    (1..10).each {
        task "test$it"(type: Test) {
            // configuration of the test task
        }
    }
    

    And then you have to try either using TestReport which can create a test report over multiple test tasks results, though I didn't use it yet, so I don't know how it will look like and if it gives the result you intend,
    or alternatively you use afterTest when configuring your test tasks and collect your statistics there. You can then additionally declare a task that depends on all your test tasks and output your statstics in its execution phase.

  • 0 0 채택된 답변 퍼블 채택!
Tages
    활동순위
    유저
      파트너사