Using google test is much easier. I started off by reading the documentation available on gtest. The documentation is very helpful. It tells you everything you need to do get googletest working in your project. Since I started reading google documentation a little late after we decided to go with gtest, caitlin and rick already had the C++ bindings and the test fixture ready for us to use them in writing the actual unit tests. Writing unit tests in googletest is fairly easy and straightforward. And I also like the fact that you can disable a test by just adding DISABLED_ keyword before the test name. You can even run the disabled tests by invoking the test program with –gtest_also_run_disabled_tests flag. There is an advanced guide available on gtest to learn a whole lot of things about gtest framework.
I planned to start by writing some unit tests for timestamps in cues. I created a new directory called cue-timings in directory ‘unit’ to hold the webvtt test files that will be used in unit tests to test the timestamps. I added two files to start with.
11:12:13.123 –> 14:15:16.456
10:00:11.123 –> 11:00:13.456
And then I wrote a test case file to hold the actual unit tests. A test case file can hold one or many unit tests. gtest guide suggests us to group our tests into test case that reflect the structure of the tested code. The makefile.am was also needed to be modified to include the newly created unit tests. I added these lines where appropriate in the makefile.
- CUETIMING_TESTS = \
and got an error below.
So, I went onto irc for some help. Presumably, my test case file was not being run. Rick told me to add the line below in makefile which, I guess, will tell the gtest that cscuetimings_unittest tests are located in file cscuetimings_unittest.cpp. And it worked beautifully then.
The pull request I sent has been reviewed by a couple of people and I am going to fix whatever needs to be fixed in that and also write the unit tests for test files that was decided in class today. Right now, I am not clear only about the BOM the character test files that i am going to test those. But I will try to finish the rest first and then ask someone else to help me on those ones.