serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
720 stars 518 forks source link

Datatest not show in Serentiy Report when using @CsvFileSource #3007

Open ndagnhat opened 1 year ago

ndagnhat commented 1 year ago

My code image

CSV file image

Serenity Report image

zzoubian commented 1 year ago

Hello @ndagnhat - I was able to reproduce something similar to you when I changed it to "files", have you tried changing it to "resources" instead, this populated the example table for me.

@CsvFileSource(resources = "/testlist.csv", numLinesToSkip = 1)

ndagnhat commented 1 year ago

Hello @ndagnhat - I was able to reproduce something similar to you when I changed it to "files", have you tried changing it to "resources" instead, this populated the example table for me.

@CsvFileSource(resources = "/testlist.csv", numLinesToSkip = 1)

hi @zzoubian i have tried both ("files" or "resources") but data test doesn't show in Report, and when tried changing files to resources instead, this error(https://github.com/serenity-bdd/serenity-core/issues/2956) appear in console

Thanks for reply

zzoubian commented 1 year ago

I'll give it a try on Windows, and see if I get the same error.

zzoubian commented 1 year ago

Hello @ndagnhat - I was able to reproduce something similar to you when I changed it to "files", have you tried changing it to "resources" instead, this populated the example table for me. @CsvFileSource(resources = "/testlist.csv", numLinesToSkip = 1)

hi @zzoubian i have tried both ("files" or "resources") but data test doesn't show in Report, and when tried changing files to resources instead, this error(#2956) appear in console

Thanks for reply

You are correct, I see the same exception from #2956 and there is no data in the examples table when using resources on Windows. Even though, it runs through all the tests fine.

wakaleo commented 1 year ago

Can you dig into the code and see if you can propose a PR with a fix? The JUnit 5 integration is still a bit experimental in parts.

zzoubian commented 1 year ago

@wakaleo - appears to be a simple fix, adding .getClassLoader() to lines 99 (getDataFileFor) and 109 (isAClassPathResource) in JUnit5CSVTestDataSource.java, fixes the issue for me.

wakaleo commented 1 year ago

Can you propose a PR?

zzoubian commented 1 year ago

I'll need to do a little bit more digging, after the change, it broke on macos :) if i get it working for both OS, i'll create a PR.