JUnit 5 Dynamic file path for @CsvFileSource
07:12 13 Mar 2024

I use the below to access a csv file in my parametrized JUnit5 test but is there any way to dynamically provide this csv file or a different file path to the location of the csv file?

@CsvFileSource(resources = "/testDataFile/testData.csv" , numLinesToSkip = 1, delimiter =  ';', encoding = "UTF-8")

In other words can I dynamically update "/testDataFile/testData.csv"?

I want a way to dynamically pass in the file path for my csv file so it is not a hardcoded location or file name.

junit5 parameterized