views:

274

answers:

1

Hi

I want to write some tests for my website using Selenium but before I begin I have a couple questions.

Note I have not looked at Selenium yet these are just pre questions

  1. How can I write my Selenium tests in nunit that would first say load up firefox do the set up of tests. Then next load up IE and do the tests again just in IE this time?

of course I won't want to run all the tests for all supported browsers everytime. I might run firefox ones alot more then other ones.

So I am not quite sure how to write one set of code yet change which browser to load up.

2.Since it is actually testing my site how can I write some code in the end to delete the user from the database? Like I don't know if I can hook up nunit to my database. I was never able to get nunit code to actually hit the database.

3.How can I disable Javascript on all browsers so I can test both server side validation and client side validation?

Thats all for now.

Thanks.

+1  A: 

To create a new selenium session, you need to do something a little like

private ISelenium selenium;
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.stackoverflow.com");

The 3rd parameter, "*chrome", is the one which tells it which browser to use. There is a useful list at http://stackoverflow.com/questions/1317055/how-to-run-google-chrome-with-selenium-rc which indicates what the other valid values are, i.e. *opera, *googlechrome, *iexplore etc.

So, you could write a randomizer or something which creates the selenium object based on a set of different browsers so that not all tests are tested on the same browser at all times?

Jane