views:

34

answers:

4

Is there any option available to run c#/.NET tests directly using selenium server like following option for html based tests?

( java -jar selenium-server.jar C# based tests/suites)

-htmlSuite : Run a single HTML Selenese (Selenium Core) suite and then exit immediately, using the specified browser (e.g. "*firefox") on the specified URL (e.g. "http://www.google.com"). You need to specify the absolute path to the HTML test suite as well as the path to the HTML results file we'll generate.

Thanks!

A: 

Well, the C# tests aren't java, so I'd say no. Guess you'd have to create a c# class, or something to run the c# API for selenium, or use nUnit. Maybe I'm misunderstanding the question though?

ascarb
+1  A: 

To run your C# tests you will need to have the Selenium server running with

java -jar selenium-server.jar

and then you will need to compile the tests and use a .NET testing framework like NUnit, MBUnit or MSTest.

AutomatedTester
A: 

Selenium-RC acts as a web server. It accepts commands (in "selenese") in two fashions - via a HTML file, or via HTTP requests. (It can also accept them on the command line if you start it with the -interactive flag).

The various client languages are APIs that wrap the HTTP protocol. If you are using C#, then you need to write a C# program (possibly using NUnit, or some other .NET-baesd unit testing tool).

If you want a single-command option that will launch the Selenium-RC server and run your tests, you'll need to get your testing tool to execute the java -jar selenium-server.jar command on startup, and then send a shutdown command to it at the end.

Robert Watkins
A: 

Thanks All! I was looking for any interops which java provides through its jar files to load the C#/.NET assemblies and run them like it runs html commnands. Now I wrote the console app harness in C# where I invoke the process to start the java jar and execute the cases as methods. This way I don't have dependency on Nunit or any other frameworks. I have also written email based reporting so I get the results automatically as soon as tests get done.

Is there any good pattern to clean the state in each case's finally block ?

try { selenium commands

} catch { failures } finally { report results & clean the state so that next test starts from clean state }

Sanjay