Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google test framework - Dependency between test cases

I am new to using Google test framework and still going through lot of materials to utilize it to full extent.

Is there any way I can dictate/specify a relation between test cases so that it can be executed conditionally? Like lets say I have two tests; Can I run the second test only if the first succeeds? I am not really sure if it falls under the original rule of testing 'units' but was just wondering if its possible.

like image 407
vpram86 Avatar asked Oct 05 '12 07:10

vpram86


People also ask

What is test case dependency?

What is Dependency Testing? Dependency Testing, a testing technique in which an application's requirements are pre-examined for an existing software, initial states in order to test the proper functionality. The impacted areas of the application are also tested when testing the new features or existing features.

What testing framework does Google use?

GoogleTest is Google's C++ testing and mocking framework.

Is Google Test a framework?

What is Googletest? It is a test framework i.e., a software tool for writing and running unit tests. It is a library for writing C++ tests. It is based on xUnit architecture which is a set of “Frameworks” for programming and automated execution of test cases.

Does Google Test run tests in parallel?

gtest-parallel is a script that executes Google Test binaries in parallel, providing good speedup for single-threaded tests (on multi-core machines) and tests that do not run at 100% CPU (on single- or multi-core machines).


1 Answers

There no way to do it in source. Possible solution use shell scripts and run tests using filter.

Python example:

from subprocess import call

def runTest(pattern):
    return call(['test', '--gtest_filter=%s' % pattern])

if runTest('FirstPriorityTestPattern') == 0:
   return runTest('SecondPriorityTestPattern')
return 1
like image 121
Torsten Avatar answered Oct 02 '22 23:10

Torsten