Before running selenium script suite from command prompt, you must be aware about How to create and run test in selenium IDE. You can read more articles about selenium IDE different commands with examples from my past posts.
Selenium has its own TestRunner and we need to use it for running selenium IDE software test case from command line. Let me describe all process step by step.
Step 1: Open selenium IDE software testing tool from your Firefox toolbar. (Click here to see how to download and install selenium IDE).
Step 2: Download latest selenium server standalone jar file from (http://docs.seleniumhq.org/download/) and save it at folder path "D:\SeleniumTest". We are using "selenium-server-standalone-2.33.0.jar" in this example. You can use latest version but do not forget to update the same in batch file.
Step 2: Create bellow given software test case in your selenium IDE.
|type||id=gbqfq||List of Selenium Commands With Examples part - 1|
Step 3: Save above software test case at folder path "D:\SeleniumTest" with name "SeleniumTestcase.html".
Step 4: Save above software test Suite at folder path "D:\SeleniumTest" with name "SeleniumSuite.html".
Step 5: Create batch(.bat) file with exactly same as bellow given command line syntax and save it at folder path "D:\SeleniumTest" with name "Seleniumtext.bat".-----------------------------------------------------
java -jar D:\SeleniumTest\selenium-server-standalone-2.33.0.jar -htmlSuite "*firefox" "http://www.google.com" "D:\SeleniumTest\SeleniumSuite.HTML" "D:\SeleniumTest\seleniumtestresult.html"
(Note1 : Here, we are using version 2.33.0 of selenium server standalone jar file for our example. If you are using any other version (example : selenium-server-standalone-2.34.0.jar) then you have to update above command line syntax accordingly(Example : D:\SeleniumTest\selenium-server-standalone-2.34.0.jar). Use files and folders names exactly as described above otherwise your script will not run. ).
(Note2 : Use selenium server standalone jar file version according to your browser version. For latest version of browser, you need to use latest selenium server standalone jar file in your test.)
(Note3 : You can replace "*googlechrome" at place of "*firefox" to run your test suite in Google chrome. You can replace "*iexplore" at place of "*firefox" to run your test suite in Internet explorer.)
Now your folder "SeleniumTest" located in "D:" drive should have files as per bellow given screen shot.
Now you are ready to run your software test suite using batch file(You can run above given syntax from command prompt (manually) too to run your test.).
Double click on "Seleniumtext.bat" file.
It will open command prompt as above screenshot > Start selenium server > Load Selenium Test Runner > Load your browser > Execute test suite(SeleniumSuite.HTML) > save test report(seleniumtestresult.html) at specified location(D:\SeleniumTest) and finally it will open test report file (seleniumtestresult.html) automatically.