Cucumber background script can be used to run common steps for each given scenario. A background script is very similar to the Before Hook in JUnit i.e. it allows a user to run code before a JUnit test runs. A very similar approach is done for the background script in Cucumber i.e. a number of defined steps which run before any other scenario runs. Also any steps identified in the background scripts are executed as part of all scenarios in that feature file.
Cucumber Background Script Video Tutorial
Follow the video tutorial above to learn more about Background Script.