Hi everyone, I’m currently learning kotlintest by ...
# kotlintest
i
Hi everyone, I’m currently learning kotlintest by adding it to a spring boot project (which uses spring data jpa). A quick question around working with test data, I can load data into h2 as expected by including a
data.sql
file in my test resources folder, but I’d prefer to have fixtures per test, ideally using the
@Sql
annotation. However, this annotation doesn’t seem to be usable with the kotlintest spec style and applying it to a
beforeTest
method also doesn’t seem to work. Has anyone got any experience working with this sort of thing or any tips for a better way to work with test data? Thanks!
m
Hmm.haventndug in at all, so this is strictly a best guess. I don't think kotlintest uses the junit5 extension for spri g to provide its spring support. If it does, then I'm completely off base. I suspect the junit5 spring extension is processing the @sql annotations so the Kotlintest spring integration would need to be updated to incorporate this functionality.
s
I don't know either, but what Mike says is probably accurate. @LeoColman knows a lot more about spring support than I do.
i
Cool, thanks both. I’ve ended up just loading in fixtures via a single
data.sql
file and that’s working ok as the test suite isn’t too big.
l
We had this issue in the past. We made a change on the way we integrated with Spring that we thought would fix this kind of issue, but nobody ever came to tell us things were ok
Could you create an example on how this kind of test is setup, @Ian Thomas? I use spring a lot, but I've never used the
@SQL
annotation
i
Hi there, I’ll see if I can get a something onto github for you today so you can have a look. Thanks!