Automation Testing Test Automation Frameworks 2 — Questions and Answers
Question 1: In BDD frameworks like Cucumber, what file format is used to write test scenarios in plain language?
- Gherkin (.feature) (Correct answer)
- YAML (.yml)
- Markdown (.md)
- XML (.xml)
Correct answer: Gherkin (.feature)
Cucumber uses Gherkin syntax stored in .feature files, allowing non-technical stakeholders to read and write tests.
Question 2: What is the purpose of a test fixture in an automation framework?
- To set up and tear down the environment needed for test execution (Correct answer)
- To generate random test data
- To visualize test results
- To manage browser downloads
Correct answer: To set up and tear down the environment needed for test execution
A test fixture establishes a known, consistent state before tests run and cleans up afterward to ensure test isolation.
Question 3: Which assertion library is commonly paired with Mocha for JavaScript automation testing?
- Chai (Correct answer)
- Jest
- Jasmine
- Sinon
Correct answer: Chai
Chai is the most popular assertion library used alongside Mocha, providing BDD/TDD-style assertions.
Question 4: What does the term 'flaky test' mean in automation?
- A test that passes and fails intermittently without code changes (Correct answer)
- A test that always fails
- A test with missing assertions
- A test that runs too slowly
Correct answer: A test that passes and fails intermittently without code changes
A flaky test produces inconsistent results — sometimes passing, sometimes failing — due to timing issues, race conditions, or environmental factors.
Question 5: In TestNG, which attribute in @Test controls the execution order of test methods?
- priority (Correct answer)
- order
- sequence
- rank
Correct answer: priority
TestNG's @Test(priority=n) attribute sets execution order; lower numbers run first.
Question 6: What is a test suite in an automation framework?
- A collection of test cases grouped for execution together (Correct answer)
- A single test method with multiple assertions
- A browser profile configuration
- A reporting dashboard
Correct answer: A collection of test cases grouped for execution together
A test suite groups related test cases so they can be executed as a single unit, often configured via XML or annotations.
In BDD frameworks like Cucumber, what file format is used to write test scenarios in plain language?