Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Parameterized Test Runner | Advanced QA Automation Techniques
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for QA Engineers

bookChallenge: Parameterized Test Runner

In this challenge, you will create a parameterized test runner that streamlines the process of executing multiple test cases efficiently. By passing a list of (input, expected) value pairs along with a test function, you can automatically run all test scenarios and quickly summarize which tests passed or failed. This approach reduces repetitive code and helps you scale your test coverage with minimal effort. Parameterized test execution is a powerful technique for QA engineers, making it easier to maintain and extend test suites as requirements evolve.

Tâche

Swipe to start coding

Implement a function that executes a parameterized set of test cases using a provided test function and summarizes the results.

  • The function must take a list of (input, expected) tuples and a test function as arguments.
  • It must run the test function for each tuple, passing the input and expected values as arguments.
  • It must count how many tests pass (test function returns True) and how many fail (test function returns False).
  • It must return a dictionary with the keys 'passes' and 'fails' representing the respective counts.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Parameterized Test Runner

Glissez pour afficher le menu

In this challenge, you will create a parameterized test runner that streamlines the process of executing multiple test cases efficiently. By passing a list of (input, expected) value pairs along with a test function, you can automatically run all test scenarios and quickly summarize which tests passed or failed. This approach reduces repetitive code and helps you scale your test coverage with minimal effort. Parameterized test execution is a powerful technique for QA engineers, making it easier to maintain and extend test suites as requirements evolve.

Tâche

Swipe to start coding

Implement a function that executes a parameterized set of test cases using a provided test function and summarizes the results.

  • The function must take a list of (input, expected) tuples and a test function as arguments.
  • It must run the test function for each tuple, passing the input and expected values as arguments.
  • It must count how many tests pass (test function returns True) and how many fail (test function returns False).
  • It must return a dictionary with the keys 'passes' and 'fails' representing the respective counts.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
single

single

some-alt