Open ZuikovAV opened 4 weeks ago
I've copied file to the project folder from embedded folder to provide a pure test. I've tried to set up the following ways: 1)"file:" + "fileName" 2)"file:" + absolute file path
but the result was the same.
At the same time on version of citrus 2.8.0 it works fine
testRunner.sql(action -> action.dataSource(dataSource).sqlResource("file:" + "fileName"));
@bbortt hello! Is this really a bug or maybe i've done something not so correct?
needs investigation for sure. but I'll have a look if I find some time 😉
@ZuikovAV yes, this seems to be a regression introduced in Citrus 4.x. Thanks for reporting!
As a workaround you can use:
TestAction executeSqlScript = sql()
.dataSource(dataSource())
.sqlResource(Resources.fromFileSystem("C:\\Users\\Admin\\Desktop\\sqlScripts\\sqlScript1.sql"))
.build();
Uses org.citrusframework.spi.Resources
utility class
@christophd @bbortt ths for the response!
Citrus Version
4.0.0
Expected behavior sqlResource found the file and executed sql script
Actual behavior sqlResource does'nt see the file even if to set up absolute path to file
java.lang.AssertionError: Before suite failed with errors
Caused by: org.citrusframework.exceptions.CitrusRuntimeException: org.citrusframework.exceptions.CitrusRuntimeException: Failed to load classpath resource C:\Users\Admin\Desktop\sqlScripts\sqlScript1.sql - does not exist at org.citrusframework.container.SequenceBeforeSuite.doExecute(SequenceBeforeSuite.java:54) at org.citrusframework.actions.AbstractTestAction.execute(AbstractTestAction.java:59) at org.citrusframework.Citrus.beforeSuite(Citrus.java:79) ... 44 more Caused by: org.citrusframework.exceptions.CitrusRuntimeException: Failed to load classpath resource C:\Users\Admin\Desktop\sqlScripts\sqlScript1.sql - does not exist
Test case sample @Bean public SequenceBeforeSuite sequenceBeforeSuite(){