How to test a REST service that uses JWT in SoapUI?
I've found a semi-automatic way to keep a valid JWT token across TestCases without losing too much time, using an external file containing the token.
- Have an external tool generating a valid JWT token into a file.
Open your project in SoapUI and add a
jwt
variable with the value${=new File('/path/to/token_file.txt').text}
In your requests, reference your variable as a JWT header with the value
${#Project#jwt}
When the token expire, just relaunch the generator script, and SoapUI will automatically load the new token.