|
From: Gabor S. <sz...@gm...> - 2009-03-15 15:10:41
|
Thanks for the answers so far. I published another article, now starting some WebTesting. The newsletter is here: http://mail.szabgab.com/mailman/listinfo/test-automation-tips The blog entry is here: http://szabgab.com/blog/2009/03/1237128967.html Your comments are welcome! Gabor -- Gabor Szabo http://szabgab.com/blog.html Test Automation Tips http://szabgab.com/test_automation_tips.html |
|
From: Marcus B. <ma...@wo...> - 2009-03-15 16:37:56
|
Hi... Gabor Szabo wrote: > http://szabgab.com/blog/2009/03/1237128967.html > > Your comments are welcome! I'd normally write... class TestOfCalculator extends WebTestCase { function testBasicCalc() { $url = 'http://localhost:8081/php/calc/basic_calc.php'; $this->assertTrue($this->get($url)); $this->assertText('Basic Calculator'); $this->assertTitle('Scientific Calculator'); $this->assertField('a', ''); $this->assertField('b', ''); $this->assertNoText('Result:'); $this->clickSubmit('Add'); $this->assertTrue($this->clickSubmit('Add')); $this->assertText('Result:'); } } ...as... class TestOfCalculator extends WebTestCase { function testCalculatorCanAddTwoNumbers() { $this->get($this->home() . 'calc/basic_calc.php')); $this->setField('a', 5); $this->setField('b', 9); $this->click('Add'); $this->assertText('Result: 5+9=14'); } function home() { return 'http://localhost:8081/php/'; // Usually smarter. } } Web tests are often used as acceptance tests. Having them "tell the story" is really nice. So... 1) I moved the main domain out of the test. It also allows it to be overridden on different machines using configuration or a script name look-up. 2) The titles and stuff are really up to the graphic designer and content author. You wouldn't want them to break your tests on every writing whim. I tend to use assertTitle() to make sure things like redirects are working, but not much else. 3) I've renamed the test into something that would appear on a requirement. Anything not part of the requirement I've purged. 4) assertText() normalises whitespace into just a single space for everything. 5) I tend to use click() for everything as it's the shortest. As an aside there are some other more practical features that have a "Wow!" factor for beginners, and everyone else trying to debug things... * Any method that fetches a page - get(), post(), click*(), etc - returns the raw HTML. Just put a "print" in front of the get() and you'll see what I mean. * showSource() shows the current content, and will escape it if you are in the HtmlReporter. * showRequest() and showHeaders() shows the outgoing and incoming headers respectively. You probably know this already, but I find that these get a great response when I've been doing 1 on 1 demos. > > Gabor Anyway, thanks for the article :). yours, Marcus p.s. there is clickById() if you have labeled the buttons, and there might be assertFieldById() to. |
|
From: Gabor S. <sz...@gm...> - 2009-03-15 17:02:17
|
On Sun, Mar 15, 2009 at 6:38 PM, Marcus Baker <ma...@wo...> wrote: > Hi... > > Gabor Szabo wrote: >> http://szabgab.com/blog/2009/03/1237128967.html >> >> Your comments are welcome! > > I'd normally write... Great advice, many new things to incorporate in the next article or just in the course material. Thanks! BTW as I am not familiar with the PHP world, how do you think I could promote these articles and the Test Automation newsletter a bit? regards Gabor |
|
From: Marcus B. <ma...@wo...> - 2009-03-16 09:55:03
|
Hi... Gabor Szabo wrote: > BTW as I am not familiar with the PHP world, how do you > think I could promote these articles and the > Test Automation newsletter a bit? Sitepoint would help, as would: http://forums.devnetwork.net/viewforum.php?f=39 > regards > Gabor yours, Marcus |
|
From: Noel D. <ma...@mc...> - 2009-03-16 13:27:08
|
> BTW as I am not familiar with the PHP world, how do you > think I could promote these articles and the > Test Automation newsletter a bit? The php blog round-up http://www.planet-php.net/ will be read by many php-ers. You should be able to have yours added to the list. It would be nice to see some more publicity for SimpleTest. I don't quite feel comfortable with PhpUnit apparently being the "de facto standard". I don't want to start some kind of petty war but learning is important and I think, uniquely, SimpleTest has a real test-infected culture surrounding it. There's a critical mass of knowledge which I'm not sure exists anywhere else in the world of php (perhaps I just missed it). This is very important for budding php programmers who want to learn about TDD. Noel |
|
From: Perrick P. <pe...@no...> - 2009-03-17 13:44:11
|
Your entries actually made it to the planet-php.fr (the french version). I don't really know how they got there but hey... the news is out. http://www.planete-php.fr/ Thanks, Perrick Noel Darlow wrote: >> BTW as I am not familiar with the PHP world, how do you >> think I could promote these articles and the >> Test Automation newsletter a bit? > > The php blog round-up http://www.planet-php.net/ will be read by many > php-ers. You should be able to have yours added to the list. > > It would be nice to see some more publicity for SimpleTest. I don't > quite feel comfortable with PhpUnit apparently being the "de facto > standard". I don't want to start some kind of petty war but learning is > important and I think, uniquely, SimpleTest has a real test-infected > culture surrounding it. There's a critical mass of knowledge which I'm > not sure exists anywhere else in the world of php (perhaps I just > missed it). This is very important for budding php programmers who want > to learn about TDD. > > Noel > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Simpletest-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpletest-support > > |