Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing a live website with QUnit

Tags:

testing

qunit

Can I test live websites using QUnit? For example, can I write a test that says:

  • Go to google.com
  • Enter a search term
  • Click 'Google Search'
  • Check there are 10 results and 2 ads

Would QUnit be an appropriate tool for this kind of "live" testing?

like image 665
Randomblue Avatar asked Dec 16 '22 06:12

Randomblue


1 Answers

You can achieve that using qunit if qunit is the only tool/testing framework that is available for you and the page you will be testing allows GET requests.

How to do that qunit is you can make an ajax call to the page you are testing using JSONP and get the response. Then you would assert certain elements on the response exists.

For google, google itself has a very complex page structure on search results, I would not even attempt to do anything like this.

I would use qunit for testing javascript components on their own without dependencies.

If you are looking for another tool to do this task, I would recommend Selenium, which would do exactly what you want.

Good luck.

like image 145
Hakan Hastekin Avatar answered Feb 19 '23 20:02

Hakan Hastekin