Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Play Framework with AngularJS e2e testing or with Play testing

I'm having trouble figuring out out how to do Angular e2e testing with the Play Framework or with Play Integration testing. I feel AngularJS loses a lot of value if I can't do this. I have no idea how I would go about doing e2e with Play. And as far as Play integration testing, the webDriver can see the ng attributes but as with the case for the code I tried it doesn't emulate the proper behavior. Anyone have a similar experience or a solution to this?

Or perhaps is there a good alternative for Angular (such as an MVC framework with a good library) that integrates with Play testing better and can help me reduce my amount of lines for front end code? I'm already using coffeescript, jQuery, and Bootstrap. Thanks!

like image 911
danielbh Avatar asked Nov 11 '22 23:11

danielbh


1 Answers

Please be a little bit more precise about "proper behaviour". What is the bug ? Is the problem about integrating e2e tests with the Play workflow or just having e2e AngularJS green instead of red ?

The difficulty here is to define "End-to-end" since there is no good definition of it, in wikipedia there is no mention about it. You can have have a good idea of what it is just because it is self-speaking, and there is also a excellent thread about end-to-end here : http://www.geekinterview.com/question_details/40319

So let's say that you want to test all scenarios with Front + Back in a close-to-prod environment.

End-to-end testing AngularJS is supposed to be done with Karma, but, warning, it will be soon changed by ProtractorJS.

Doing e2e test with Karma has serious drawbacks :

  • It may fail if you test your AngularJS app with your backend, more specifically, anything a little bit too slow in the backend may result in green test that sometimes fails with no good reason.

  • The killer un-feature to do proper e2e testing with Angular is : you can't double-click, roll the mouse, etc.

Here is my advices :

  • Use Karma only for Front-End testing, and use good old stubs as back-end. Check proper css element are displayed and that correct HTTP request are made. It will give you great confidence on Front-End dev.

  • DO NOT use Karma for end-to-end test. I found Sikuli absolutely outstanding to do this job. Use it with fitnesse or testNG for better integration.

  • May be ProtractorJS will do the job in a very next future.

Sikuli: http://www.sikuli.org/

example of fitnesse + sikuli : https://github.com/xebia/FitnesseSikuli

protractor : https://github.com/angular/protractor

like image 124
bdavidxyz Avatar answered Nov 14 '22 23:11

bdavidxyz