1 Jan 2011 01:50
curl unit testing
Amr Shahin <amrnablus <at> gmail.com>
2011-01-01 00:50:54 GMT
2011-01-01 00:50:54 GMT
Hello folks,
i'm attaching a sample very small unit tests using both check unit testing library and the current curl testing framework integrated with curl, i was hoping we could asses both and see which is more suitable to write unit tests.
the code uses check is in the file llist_test.c. It's a classic unit testing code, with all basic functions there setup, teardown and macros for defining your tests, the output is well organized, you can see sample output for both all success, and one failed test in the attached files.
The only downside for using check is that we're adding an extra dependency to curl, my suggesstion is to add the .so version and check.h to the code base.
the other option is to use the testing setup already in libtest directory, it's pretty easy to add more tests, but it's not as well-organized as using check, all the tests use a function "int test(char *URL)" which may not be suitable for unit tests.
personally, i'm into using check. I'd love to hear what you guys think?
Amr
i'm attaching a sample very small unit tests using both check unit testing library and the current curl testing framework integrated with curl, i was hoping we could asses both and see which is more suitable to write unit tests.
the code uses check is in the file llist_test.c. It's a classic unit testing code, with all basic functions there setup, teardown and macros for defining your tests, the output is well organized, you can see sample output for both all success, and one failed test in the attached files.
The only downside for using check is that we're adding an extra dependency to curl, my suggesstion is to add the .so version and check.h to the code base.
the other option is to use the testing setup already in libtest directory, it's pretty easy to add more tests, but it's not as well-organized as using check, all the tests use a function "int test(char *URL)" which may not be suitable for unit tests.
personally, i'm into using check. I'd love to hear what you guys think?
Amr
Running suite(s): Curl_llust 0%: Checks: 1, Failures: 1, Errors: 0 llist_test.c:28:F:Core:test_llist_initiate:0: list initial size should be zero
Running suite(s): Curl_llust 100%: Checks: 1, Failures: 0, Errors: 0
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RSS Feed