Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unit test ExtJS or similar JavaScript based interfaces?

I am using PHPUnit to test my PHP source code, but I need a way to test client-side code, too. I use ExtJS to build rather complex interfaces that call the server for data. I am wondering here is how does one test the UI?

like image 662
Tower Avatar asked Sep 18 '10 08:09

Tower


2 Answers

There's a new tool that just came out recently called Siesta. It's geared toward Ext JS specifically (though can also test any JS code) and it's a great fit for testing Ext JS UI code as it has built-in Ext JS event simulation and recording.

I also personally use Jasmine for my unit testing, as does the Ext JS team internally, though it's not particularly well suited to UI testing (it's great for testing code though).

like image 130
Brian Moeskau Avatar answered Sep 30 '22 20:09

Brian Moeskau


There are many different ways.

If you want to test it functionally (like a user) then use something like Selenium or Watir. This will work through your site as a user would and exercise the JavaScript and the Backend code.

If you want to just test your JavaScript by itself then i would use JSTestDriver. It allows you to unit test your JavaScript. It doesnt support async calls but can do the test.

like image 28
AutomatedTester Avatar answered Sep 30 '22 18:09

AutomatedTester