Yesterday I was pretty hopeless setting up Selenium reports in Jenkins. Today I made it. It's not perfect, still missing some crucial parts but you know, if it fits it sits.
I applied my very ancient technique to lookup information which I have no idea what is. And it worked again, see how ridiculous it is:
- Come up with a problem which you don't even know what is
- Google it and change to image search
- Click on an image that looks similar what you have in mind
- Look for keywords on the page -> your problem :)
- Then you know what you're looking for so you can use Google again
I guess it's search 2.0 or something. Nowadays I really don't have to know anything but searching. If I' were Google I would organize out-of-profession challenges. You know, medical challenge for basketball players or email marketing competition for gardeners. Anyways - that's a whole different story. Back to Selenium.
I had to search for jenkins+selenium+chart, when I've spotted the magic word: tap - Test Anything Protocol. It's a very simple Yaml like format to present analytics results. Not really a Selenium specialty, you can use it anywhere. The good thing - phpunit offers tap formatted result output. Brilliant. The runner will look like this then:
$ phpunit --log-tap output.tap $PATH_TO_TESTS
In Jenkins you have a nice addition, the Tap Plugin. You can install in quickly on the plugin admin page and use it in the Post-build Actions phase.
Since I was wandering around the disk I had to tell phpunit explicitly where to generate the file:
$ phpunit --log-tap "$WORKSPACE/output.tap" $PATH_TO_TESTS
This makes sure that if you add 'output.tap' for the tap plugin argument it will find it.
Nice and dandy, all is that. I've generated couple of builds and Jenkins showed me a list of results. At this point I'm not sure if I missed - but I added the graph plugin - and now I could see the diagram as well.
I added some failed tests to see the color red (OCD, again) and the compiler died. It occurred that there is an autoloading problem when you're using PHPUnit and Yaml extensions - Symfony and other components tend to collide. To workaround this I added a quick hack, but I'm not sure I'll keep it this way:
stream_resolve_include_path('Symfony/Component/Yaml/Dumper.php');
stream_resolve_include_path('Symfony/Component/Yaml/Inline.php');
stream_resolve_include_path('Symfony/Component/Yaml/Escaper.php');
require_once 'Symfony/Component/Yaml/Dumper.php';
require_once 'Symfony/Component/Yaml/Inline.php';
require_once 'Symfony/Component/Yaml/Escaper.php';
This makes sure that only one will be used and it's clear which one.
Just for the long and nightmare free sleeping I added green balls and Chuck Norris.
At this moment I'm half-ish satisfied. I'm still missing the HTML reports. *sigh* Maybe tomorrow.
---
Peter
No comments:
Post a Comment
Note: only a member of this blog may post a comment.