SimpleTester 1.0 - CI-library for unit testing |
[eluser]Unknown[/eluser]
Could you post an example of how I might test a Controller method with Simpletester? Cheers, Chris
[eluser]ciscoheat[/eluser]
A controller method is not the best thing to test, since it handles redirection, user input and other high-level actions. Unit testing is much better suited for testing the integrity of libraries and plugins (models to some extent), so if you want an example of how to do that, let me know! For testing the actual web user interaction, check out Selenium, http://selenium.openqa.org/
[eluser]Unknown[/eluser]
[quote author="ciscoheat" date="1198473823"] 5. Add “simpletester” to autoloading libraries in config/autoload.php [/quote] with this i got "Unable to load the requested class: simpletester" but if i change 'simpletester' to 'SimpleTester' i got Code: A PHP Error was encountered i'm using CI 1.6.1 SimpleTest 1.0.1 beta2
[eluser]wmbetts[/eluser]
I just had the same problem, but I fixed it!. You need to goto your system/application/config directory and rename SimpleTester.php to simpletester.php all lower case. William Betts
[eluser]cfraz[/eluser]
cisco: I tried your SimpleTester and really like it. I set it up and the template tests work perfectly. One of the reasons I wanted to try the SimpleTest library is its integrated WebTester. I added Code: require_once($libraryDir . '/web_tester.php'); to libraries/simpletester.php, hoping that would give me all the WebTester functionality. The WebTester asserts seem to work, but when I try to get a page with Code: class TestOfWebPage extends WebTestCase { the server just hangs and eventually I get a Nothing Fetched message. This is on Win2003/IIS 6 (I don't have the option of running Apache here). When I set up SimpleTest in a non-CI framework, the WebTester works fine. Any ideas what's wrong?
[eluser]philmctim[/eluser]
Just wanted to add my thanks (and a 'gotcha!') to this thread. I just installed this add-on - took me about 15 mins in total to get the default tests running (and that was the first 15 mins of a Sunday morning - not often that they are productive!) The gotcha I hit was adding 'simpletest' to the autoload list - it needs to be 'simpletester'. The documentation is correct, I just didn't read it carefully enough. Thanks again.
[eluser]philmctim[/eluser]
OK, so now I have a question... What if I didn't want the unit tests to run every time I made a call to the server? Some of my unit tests are quite DB-intensive. Some of my unit test are only useful when I've just loaded-up my test suite of data that is to be processed. Just wondering if anyone thinks the same way and what they did about it. Thanks
[eluser]Unknown[/eluser]
Install was quick and simple, library works just fine, its code is clean and well documented and author responses to emails (and his answers is clear and helpful!) Thank you, Andreas! -- Alexey.
[eluser]jalalski[/eluser]
I'm getting the following error whenever a test fails: Code: Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in /home/wwwroot/xxxxx/xxxxx/ci/libraries/Exceptions.php on line 160 Successful test work out fine.
[eluser]Natebot[/eluser]
An important tip: You must set Code: $config['compress_output'] = FALSE; |
Welcome Guest, Not a member yet? Register Sign In |