Hi, how can I share test/src with other modules in...
# amper
s
Hi, how can I share test/src with other modules in test/src? I’m working on HTML & XML Parser KMP library https://github.com/fleeksoft/ksoup This have two variants one ksoup-korio and second ksoup-kotlinx Test functions for both are same except module and some functions how i can create common test code and then share that test code in both variants Simply adding ksoup-test module into ksoup-korio and ksoup-kotlinx don’t add source set of test/src Code is in develop branch
1
j
The code that you want to "export" from your test module should be in the main
src
folder. This is the production code of your test module. The test directory of your test module is for the code that tests the module itself (to test your test utilities), and it won't be shared.
s
@Joffrey is there any workaround for this? Otherwise i need to duplicate test code in both modules of ksoup and ksoup-korio. There are around 30 test files
j
Sorry if I was not clear, you just need to put the shared test sources to expose to other modules in the
src
(and
src@platform
) folders of your test module, instead of in
test
and
test@platform
s
ksoup-test module is only for testing so moving all test code from test to src and creating two new test modules like ksoup-kotlinx-test and ksoup-korio-test depending on ksoup-test is that going to work fine?
j
You don't need to create 2 new test modules, you can put your specific test code in
ksoup-kotlinx/test
and
ksoup-korio/test
, and add a
test-dependency
on
../ksoup-test
from those modules
s
@Joffrey That makes sense, I will try it. Thanks a lot!