1

I am creating configure SSL without classpath. I have to mount certs externally. Following is my code.

'''

* def keyStoreFilePath = './certificates/clientcert.p12'

* def trustStoreFilePath = './certificates/truststore.jks'

* configure ssl = { keyStore: keyStoreFilePath, keyStorePassword: '123', keyStoreType: 'pkcs12', trustStore:trustStoreFilePath, trustStoreType:'pkcs12', trustStorePassword:'123' }
'''

But I get a file not found, as karate is looking for certs in the target folder. my certs are on the root path. Is there a way to create configure SSL without using classpath?

'''

java.lang.RuntimeException: java.io.FileNotFoundException: /Users/kiranjaghni/work/javaworkspace/poc/karateDSL/transfer-case-grid-api-auto/transfercasegrid-api-automation/target/test-classes/examples/login/trustStoreFilePath (No such file or directory)
classpath:examples/login/login.feature:14 ==> expected: <0> but was: <2>
    at examples.ExamplesTest.testParallel(ExamplesTest.java:15)

'''
Dhamo
  • 1,171
  • 3
  • 19
  • 41

1 Answers1

1

I think you should use the file: prefix that can read from the file-system. So then it is up to you, you can have the files anywhere, as long as they are accessible.

* def keyStoreFilePath = 'file:/any/absolute/path/certificates/clientcert.p12'

Please read the docs: https://github.com/intuit/karate#reading-files

Also please note that you need to use embedded-expressions: https://github.com/intuit/karate#embedded-expressions

* configure ssl = { keyStore: '#(keyStoreFilePath)' } 
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248