Thread: [Cppcms-users] UnitTest
Brought to you by:
artyom-beilis
|
From: Sab <rim...@gm...> - 2013-04-12 09:31:51
|
Hi Artyom, I would like to create a UnitTest for my REST-WebHandler classes. Thus, I would like to separately test these classes, without a running webserver and back engine. So I would like to simulate an incoming CppCMS request(), somehow fill header and body with simulated info, pass it to my processing function and then read the content of the response() without trying to send it back to the server to check if the result is as expected. Any ideas, where I could start? Sab |
|
From: Artyom B. <art...@ya...> - 2013-04-12 12:09:05
|
Unfortunately there is no such a feature you require. On the other hand using internal HTTP web server would allow you to use any HTTP client (libcurl from C++ for example) or any other language. For example significant part CppCMS unit tests are written in Python using urllib (IIRC). Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Sab <rim...@gm...> >To: cpp...@li... >Sent: Friday, April 12, 2013 12:31 PM >Subject: [Cppcms-users] UnitTest > > >Hi Artyom, > >I would like to create a UnitTest for my REST-WebHandler classes. Thus, I >would like to separately test these classes, without a running webserver and >back engine. So I would like to simulate an incoming CppCMS request(), somehow >fill header and body with simulated info, pass it to my processing function >and then read the content of the response() without trying to send it back to >the server to check if the result is as expected. > >Any ideas, where I could start? > >Sab > > >------------------------------------------------------------------------------ >Precog is a next-generation analytics platform capable of advanced >analytics on semi-structured data. The platform includes APIs for building >apps and a phenomenal toolset for data science. Developers can use >our toolset for easy data analysis & visualization. Get a free account! >http://www2.precog.com/precogplatform/slashdotnewsletter >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Sab <rim...@gm...> - 2013-04-15 12:23:55
|
Using the internal web server sounds actually like a good idea. I'm already using libcurl in my project so this combination could be an easy solution. Until now I only used the fcgi interface and the dispathcer of CppCMS so I have no experience yet about the server. Can you discribe in some words (or point me to example/tutorial), what the simplest way would be to set up the internal webserver for my unit tests? Sab |
|
From: Sab <rim...@gm...> - 2013-05-14 12:59:50
|
Hi Artyom, do you see any serious difficulties with introducing a test mode in CppCMS that would allow users to fill an http_request object "manually" in a test framework and pass it to a cppcms application class, simulating a request from a client? The application class could then fill the http_response object and pass it back to the test framework for result check. This would be a great way to test CppCMS application classes. Do you think, such a "test pad" could be integrated in a future release? Sab |
|
From: Artyom B. <art...@ya...> - 2013-05-16 13:30:42
|
No, such a feature is not planned... If you want to implement it, you are more than welcome Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Sab <rim...@gm...> >To: cpp...@li... >Sent: Tuesday, May 14, 2013 3:59 PM >Subject: Re: [Cppcms-users] UnitTest > > >Hi Artyom, > >do you see any serious difficulties with introducing a test mode in CppCMS >that would allow users to fill an http_request object "manually" in a test >framework and pass it to a cppcms application class, simulating a request from >a client? The application class could then fill the http_response object and >pass it back to the test framework for result check. This would be a great way >to test CppCMS application classes. Do you think, such a "test pad" could be >integrated in a future release? > >Sab > > > > >------------------------------------------------------------------------------ >AlienVault Unified Security Management (USM) platform delivers complete >security visibility with the essential security capabilities. Easily and >efficiently configure, manage, and operate all of your security controls >from a single console and one unified framework. Download a free trial. >http://p.sf.net/sfu/alienvault_d2d >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Klaus W. <kjw...@ya...> - 2013-08-30 10:30:54
Attachments:
abstract_spectrometers_test.cpp
|
Hi Sab, I too found it useful to test against the application directly and took a leaf out of Artyom's tests, namely tc_test.cpp and the related dummy_api.h. I attached the cpp file. Feel free to start from there and to deliver feedback. Cheers! K On 05/14/2013 02:59 PM, Sab wrote: > Hi Artyom, > > do you see any serious difficulties with introducing a test mode in CppCMS > that would allow users to fill an http_request object "manually" in a test > framework and pass it to a cppcms application class, simulating a request from > a client? The application class could then fill the http_response object and > pass it back to the test framework for result check. This would be a great way > to test CppCMS application classes. Do you think, such a "test pad" could be > integrated in a future release? > > Sab > > > > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > |