How to filter ?
To run specific tests instead of the entire test suite, you can utilize the filtering feature in Test Maker. This allows you to select tests based on various criteria. You have the flexibility to filter using CLI commands or by configuring the source in a configuration file.
Using CLI
You can run specific tests using the CLI with the --source
option:
npm run test:ci -- --source "['./folder/**-spec.ts']"
Using Configuration File
You can configure the source in a configuration file. Here's an example of configuring the source to run specific tests:
import { Configuration, mergeAndConcat } from "test-maker";
import { common } from "./test-maker.common";
export const local: Configuration = {
source: [`./src/specs/**/**-spec.ts`],
};
export default mergeAndConcat(common, local);
With this configuration, only the files matching the specified globs or paths will be executed.
Advanced Filtering
In addition to specifying the source, you can apply more granular filtering based on different criteria:
filtering:{
//By Tags
featuresTags:[
"feature-tag-1",
"feature-tag-2"
],
scenariosTags:[
"scenario-tag-1",
"scenario-tag-2"
],
stepsTags:[
"step-tag-1",
"step-tag-2",
],
//by-name
features:[
"features-1",
"features-2",
],
scenarios:[
"scenario-1",
"scenario-2"
],
steps:[
"step-1",
"step-2"
],
//by a function
function:()=>{
return ["feature-tag-1","feature-1"]
},
//by glob
glob:[
"feature-*"
]
}
You can also decide to use the CLI directly to filter. For example:
npx ketm run -c test-maker.local.ts --filter-feature "Feature 1" --filter-scenario "Scenario Login" --filter-step "Assert Dashboard"
Note that the main percentage take into account skipped features on top of passed and failed features. However we have introduced a bar representing the percentage of passed feature vs failed feature which here displays 91% of passed feature among those executed.