0

How do I setup my test class so I can run the same set of tests for multiple scenarios using JUnit 5? For example, I need to run the same test case for different user accounts by passing the account usernames into login text field as a parameter on the test case level. I am moving away from Cucumber BDD to JUnit 5 and in my Cucumber BDD test framework this has been done using the Cucumber scenario examples. If JUnit 5 provides such a feature, a simple code example would be appreciated.

rusmusus
  • 21
  • 1
  • 5

1 Answers1

1

If I understand you correctly you want to run your tests with different sets of parameters (in your case users). Fort that you can have a look at Parametrized Junit Tests. Some examples (I don't have any affiliation with them)

lucniner
  • 102
  • 2
  • 2
  • 12
  • Hi, lucniner! Thank you for the effort. Parameterized tests work only for one test at a single test level(@Test). It loops only that particular test based on the number of parameters provided. I am looking for a solution at test case level which consists of a set of multiple tests. The whole test case should be repeated for each parameter passed. – rusmusus Jul 27 '20 at 13:30