0% found this document useful (0 votes)
143 views9 pages

Software Testing Tool Demonstration

Catch2 is a header-only C++ testing framework that only requires including a single header file. It is simple to set up and use, requiring only the #define of CONFIG_CATCH_MAIN and #include of catch.hpp. Tests are written with TEST_CASE macros to group test cases and REQUIRE macros to check conditions. The output clearly indicates whether tests passed or failed.

Uploaded by

Vaibhav Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views9 pages

Software Testing Tool Demonstration

Catch2 is a header-only C++ testing framework that only requires including a single header file. It is simple to set up and use, requiring only the #define of CONFIG_CATCH_MAIN and #include of catch.hpp. Tests are written with TEST_CASE macros to group test cases and REQUIRE macros to check conditions. The output clearly indicates whether tests passed or failed.

Uploaded by

Vaibhav Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

SOFTWARE TESTING

TOOL
DEMONSTRATION
SOFTWARE TESTING (SE-302)
WHAT’S THE CATCH

• Catch2 is a multi-paradigm test framework for C++. which also


supports Objective-C (and maybe C). It is primarily distributed as a
single header file, although certain extensions may require
additional headers.
WHY CATCH2
• It is very simple to start with
• There are other C++ testing libraries like Google Test, CppUnit, Cute etc. But
they are huge and need a lot of dependencies to get started with.
• Catch2 is a header only framework, just download the catch2.hpp file, do an
#include and you are good to go
• This simplicity and flexibility is a huge bonus for small and medium scale
projects
• And it is open source :D
GET STARTED

• Head straight to github.com/catchorg/Catch2 and download the catch2.hpp


file from the link in the README
• All you need to do is drop the file somewhere reachable from your project, or
directly into your project.
WRITING THE TESTS

• We only need two things to the start of the test.cpp file

1. #define CONFIG_CATCH_MAIN , this tells catch to provide a main() to this file

2. #include “catch.hpp” , (pretty obvious).

• After getting that out of the way we can finally write the test conditions.
OUR TEST PROJECT
MACROS

• In catch, we introduce the test


conditions using the TEST_CASE macro.
It is just used to group the test cases
together for a particular unit of code

• The REQUIRE macro checks for the


condition provided in the parenthesis
OUTPUT
• On successful execution of test case we get an • If the test case is wrong then the output will
output like this be like this
THANK YOU
PRESENTED BY:
VAIBHAV VERMA - 2K17/SE/123
SHIVAM CHOUDHARY - 2K17/SE/108
ROHIT BHARTI

You might also like