Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,742 members, 7,824,142 topics. Date: Saturday, 11 May 2024 at 12:21 AM

Unit Testing Revisited - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Unit Testing Revisited (826 Views)

Solution To Sms Sending Failed Unit (bulk Sms Website) / Microsoft Releases Windows 8 For Public Testing / Web Development Revisited (2) (3) (4)

(1) (Reply)

Unit Testing Revisited by my2cents(m): 4:58pm On Aug 22, 2007
So, in an effort to impart my knowledge to posterity tongue, I have decided to practice what I preach, so to speak, by sharing with you all what I use for unit testing at work. Basically, you develop the tests as you write your code and once you are done writing your code, you run the test(s) again. If anything changed, links aren't going to where they are supposed to go, etc, the test fails.

Say hello to Selenium. The site: http://www.openqa.org/ , the IDE: http://openqa.org/selenium-ide/

Note:
[list]
[li]This is an FF plugin. It doesn't work in IE although what you are testing, since it is front-end, will be verified for all browsers.[/li]
[li]This is for front-end testing (where elements are on a page, link verification, etc). It doesn't verify business logic. For that, you would need (if you code in java) JUnit[/li]
[/list]

You basically run the test the first time by starting from, say, your home page, and clicking to the end page. You then modify the test case file (which you have a choice of saving as java, html, perl, php, ruby, python or c#) to, say, verify or assert links, images, text, etc. Note that when you run your tests, the "verify" function will verify your test and continue on testing where the "assert" function will stop the test if a condition isn't meant. Right-clicking from within your FF browser will pull up a list of functions you can use (of course for this to show, you should have installed the Selenium IDE).

If you have any questions, let me know. It has definitely made my life a lot easier. Happy coding and testing!

(1) (Reply)

Most Hilarious Web Host! / Google Launches Rival To Wikipedia / g

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.