Problem about running php test suite and test case using Selenium RC - selenium-rc

I need a php test case and how can i test a php test case using selenium RC. Already i have set up Selenium RC in my computer.Not only that, i need a test suite. What is the purpose of test suite and test case? Is the test suite and test case same thing?
It would be very helpful helpful for me if any one post a solution in the blog as early as possible.

The Recorded test scripts can be than exported to PHP language and with the help of these you can create a library which contains all the functions/tests which has to be performed on the application
Now create the suites for different libraries which will call the functions in the libraries and executes it on application.
Start the Selenium RC using the command “java –jar selenium-server. jar”
On the new command prompt enter the specific directory location of the file and enter “phpunit xyz.php”

Selenium is a tools that let you automate visits to a site and test for conditions; mostly presense of text on page or in html controls. The selenium server needs to be running which will enable you to control a browser (firefox by default) to do you automation tasks.
Starting the server could be something like
"javaw.exe" -jar selenium-server-standalone-2.0b2.jar"
where javaw.exe is part of your java runtime, most likely in C:\Program Files (x86)\Java\jre6\bin\ or C:\Program Files\Java\jre6\bin\.
You also have the possibility of installing a Selenium IDE as a plugin to firefox which lets you record, edit and playback tests.
The most likely usage would though be to implement tests in a test runner like nunit or a php program. The IDE has export functionality for this.

Related

What tools are people using to create test scripts for Laravel PHPunit/Selenium?

I want to run PHPUnit tests in Laravel that make use of Selenium. I've been watching a few videos and it all seems fairly simple.
I'd like to know whats the easiest way to write these test scripts? For example selenium IDE allows you to generate large tests in seconds by recording your actions in the web app but I can't see an option to export this into a format that Laravel can use? What are my options here?
Have you read about Codeception?
It's enviroment for testing app (not only unit test but also functionals and acceptence test) where you can assign Selenium or PhantomJS.

Want to use Script recorded for OFT(OATS) in OLT(OATS) module.Any suggestions on how?

I am currently working on Open Script(OATS) Version: 12.3.0.1 Build 376.
Scenario is that I have written/recorded multiple scripts using
Functional Testing (Browser/GUI Automation) Web Module but now I want to
run the same scripts on Load Testing (Protocol Automation) Web/HTTP
module.
To be more clear thing is like that when we record scripts using
Functional testing modules, during playback browser opens up and re-runs
your script on a machine.
But unfortunately now i want those scripts to be ran on EM Machines
where no browsers are there.More precisely scripts run in silent mode
without any browser getting launched.
Problem with Load modules scripts is that they run on HTTP protocol and
same doesn't gives you lot of customization option as functional module
scripts give you as they work on DOM structures and same is supported in
webdom module.
In open source community(Selenium) scenarios like this are handled
through HtmlUnitDriver.
I tried with the same in open script by adding external jars as an asset
in the script but that gave me the linkage error.
Any suggestions on how we can achieve the above task would be
appreciated.
Regards
Ankur shrivastava
You can use htmlunit as an asset in your loadtest script, however there are some conflicts with xml/html parsing libraries used by htmlunit with the ones openscript uses (for reporting). Two options:
Remove the xerces/xalan libs from your htmlunit.jar, thus making htmlunit depending on the openscript libs. This might cause issues with versioning or some htmlunit functions break.
Remove the xerces/xalan libs from openscript script; just remove oracle.oats.jagent.lib3rdparty from the script MANIFEST.MF. This ensures htmlunit uses its own libs. However loadtest reporting will break.

Running Selenium test suite with browser minimized

As part of our web application deployment I need to do basic smoke test after the deployment.
I am using Selenium RC to run the smoke test automatically at the end of the deployment.
now How can I run the browser minimized (not poping up) while running the test suite.
Below is the command used to run the test suite
java -jar D:\Selenium\RC\selenium-server-standalone-2.25.0.jar -htmlSuite *firefox https://abc.com C:\Users\abc\Desktop\testsuite.html results.html -firefoxProfileTemplate C:\Users\331036\AppData\Roaming\Mozilla\Firefox\profiles\imvteil2.selenium
I have an alternate solution that may meet your needs. You can set the position of the WebDriver to be outside of your view. That way, it'll be out of sight while it runs. (It may start at a visible location, but it will only be there for an instant.)
FirefoxDriver driver = new FirefoxDriver();
driver.manage().window().setPosition(new Point(-2000, 0));
I don't think that this is possible, The Browser will pop up , you will have to minimize it manually

Selenium store result of web service/AJAX call

Is it possible to store the result of a web service/AJAX call into the store element, so that its value can be used in multiple locations.
The reason for this is we would like to have an automated test suite that uses data defined in a database. This would make it much easier to change bulk data in the tests (instead of searching through all of our test cases to change the data).
I understand that we can create a test case at the beginning of our test suite that defines all of this data however, we would like to easily switch between data sets without having to re-type each value.
I'm not sure how you can do what you're asking. It would be cool to learn. But let me give you a different approach which is very easy. I can answer any questions you may have. Create 3 different commands in your Selenium IDE to start things off, where your target for the open command is the path of the page you're automating.
Command: open
Target: --path--
Value:
Command: storeExpression
Target: 123
Value: var_number
Command: type
Target: TextBox1
Value: ${var_number}
Then use the export option in Selenium IDE as Java code (or another language). You won't have the Options > Format > options unless you turn on "Enable Experimental Features" in options. Choose "JUnit 4 (Remote Control or RC)"--Selenium 1. I'm not familiar with "JUnit 4 (WebDriver)"--Selenium 2 yet, but it's a bit newer, and not as much documentation. Then download Eclipse Classic, the Java JDK, the Selenium client driver for Java (on the Selenium site)--dll #1, and download JUnit 4--dll #2. Import both of those dll files into the Library tab (in Eclipse classic) after creating a new project in the project wizard, and open your export code that was exported using the Selenium IDE format export. Eclipse should be configured to automatically compile your code by default. Then just create an loop in the Java code and repeat the commands above. Then connect to your database from Java (with some simple SQL connection code), and read your data from the result set inside of your loop. Then right click in the Eclipse file explorer and choose JUnit on your unit test to launch a Mozilla Firefox instance to have it automate your loop. Or you can launch any other browser to run your JUnit test.. just change "*chrome" (aka Mozilla not Google Chrome) to "*iexplore" (Internet Explorer) or "*googlechrome" (Google Chrome), etc... for a browser of your choice in the Java code.
Pardon my jargon on "dll files". I meant to write assemblies or libraries. In Java, the correct term would be a *.jar. I'm use to writing in .NET code. If you choose to run your unit tests in .NET, then you will need to repeat most of what I have above, but instead download NUnit and use Visual Studio rather than Eclipse. The documentation is much better for JUnit, so that's why I went that route. That statement might not be correct. That's just what I found to be true from observation when I did a proof of concept for my company.
Oh, and because you're using client drivers, you need to have the Java (JUnit Test) program connect to your Selenium Remote Control Server. So you must download the Selenium server also. Then call the Jar from the command line in Windows. It must be running before running your JUnit test. This server won't run unless the JDK is installed on your machine!
java -jar selenium-server-standalone-2.0rc3.jar
The contributed user extension: http://wiki.openqa.org/display/SEL/global makes use of the global array globalStoredVars which you should be able to use.
I started recently to test a multilanguage website using Selenium with javascript, see Testing-a multilanguage website with selenium

Problem while running the Multiple Script(IE Test Suite) in selenium 2.0 dotnet

I am using Selenium dotnet 2.0b1 dll in my project..
if we start running the multiple script(IE Test Suite)...if any object was not found for
example if i am selection india from country dropdown..if the india is not found...it stops in that script and throws the "exception" and by the time the error is not reflecting in HTML result (we have html reports integrated with
this framework) and the other scripts are not running...
But it is not generating as HTML...
our req is if any testscript failes also the next script must execute.....
Is this problem with dll i have used selenium 2.0a1 dll also.Can any body plese look in to
this....
thanks in advance
Senthil
try to replace assertXXX functions with corresponding verifyXXX functions.
the last one shall not stop the test.
well, at least it doesn't in Selenium IDE scripts.

Resources