Testing / Karate Framework Interview questions
Explain the internal working of the @lock tag for controlling parallel execution?
Some scenarios genuinely can't run safely at the same time as others, most often because they touch a shared, stateful resource like a specific database row or an external system that doesn't tolerate concurrent writes. The @lock tag provides fine-grained mutual exclusion for exactly these cases, without forcing the entire suite to give up parallelism.
A scenario tagged @lock=database only waits for, and blocks, other scenarios sharing that same lock name; scenarios with a different lock name (or no lock at all) continue running in parallel, unaffected. This is a meaningful improvement over the older, coarser @parallel=false tag, which opted a scenario out of parallel execution entirely, serializing it against every other test in the suite even when only one specific resource was actually contended.
More Related questions...