Closed solvingj closed 7 years ago
Well, I didn't think this was possible, but it works. I've added this to my base test class and it apparently resolves to the package name of the derived class. Not nearly as messy as I thought. If someone wants to add similar logic as a native "tape filing strategy", feel free, but this workaround is pretty elegant and works fine for me.
@Shared
File tapesBaseDir = new File('src/integTest/resources/betamax/tapes')
@Shared
Configuration configuration = Configuration.builder()
.defaultMode(READ_WRITE)
.tapeRoot(new File(tapesBaseDir, getClass().package.name.replace('.','/')))
.sslEnabled(true)
.build()
@Rule
RecorderRule recorder = new RecorderRule(configuration)
Moving this to Trello: https://trello.com/c/ZMJ5U6Xd
In my opinion, a single shared taperoot for all tests seems to pose a few problems. If possible / feasible, I suggest adding an annotation element for tape path that is relative to the taperoot, with an override option. In my use case, I want the tapes organized into a subfolder structure that mimics my package/source structure. If that seems a common enough use case, perhaps that could simply be a global strategy option.
Could anyone comment on how difficult this would be to achieve?