I have a number of microservices that share some common behaviors, which I've defined in some common .feature files.
Each microservice has a different root path, and 1 or more custom attributes.
I'd like to be able to test them with one karate invocation, in order to take advantage of the parallel execution that karate provides.
My first thought was to make a simple 'wrapper' feature file for each microservice, which would:
- define the root path, and any custom attributes, and
- call the common feature files.
So, the wrapper feature file for microservice1 looked like this:
Feature: microservice1 service
Background:
* def authLevelCde = "ACL_FORE_DEFAULT"
* def serviceName = "microservice1"
Scenario: Common CRU Tests
* call read('common-cru.feature')
Scenario: Common Error Tests
* call read('common-errors.feature')
I made multiple 'wrapper' feature files like the one above, each for a different microservice, each with it's own unique 'serviceName', and some with additional unique attributes which the common feature files were constructed to use when and as appropriate.
I could then invoke karate on one or more microservice wrapper feature files, like this:
java -cp ../karate-1.3.0/karate.jar:.. com.intuit.karate.Main fldfin.feature fore.feature
That works, but has 2 drawbacks:
- in each such 'wrapper' feature file, i have to explicitly call each 'common' feature file - i.e. I have to repeat what amounts to the definition of which features to use to test the microservice (though it is the same for all of my microservices);
- my common feature files have multiple Scenarios in them, but when called the way shown above in a 'wrapper' feature file, they appear as just one Scenario in the generated report.
Is there a way to do what I want without these drawbacks? Thanks!