March 31, 2013

Selenium RC Quiz Part 3


Selenium is a popular open source test automation tool for web applications that is used for functional and cross-browser compatibility testing. You may have already attempted the Selenium Quiz Part 1 and 2. If not, try those first. Now, attempt the part 3 of this quiz to check your familiarity with Selenium RC (also known as Selenium 1). Selenium RC is the original Selenium tool. RC has the Selenium Server that controls the browsers and Client Libraries for the supported programming languages (Java, Ruby, Python, Perl, PHP or .Net). Each question in this quiz has four options with one best answer. The score appears at the bottom left. A score of 5 or less indicates low knowledge; 6 to 7 means a fair level of knowledge and 8 and above shows a good knowledge of Selenium RC.
Instead of this quiz, you may want to see my video on Selenium Questions and Answers where I have compiled all these questions.

1. What are the different modes that Selenium uses?
*iehta
*firefox and *iexplore
*chrome
All of the above

2. How do you start the browser?
selenium.Start()
get start()
selenium.server start()
None of the above

3. Do you need to have Selenium .jar files as a dependency of your tests?
Yes
No
Yes, but as a good practice only
No Selenium jar file is provided with Selenium RC.

4. How many parameters does the Selenium object take when using DefaultSelenium?
2
3
4
6

5. How do you start selenium rc server with user extensions?
java -jar selenium-server.jar
java -jar selenium-server.jar -userExtensions user-extensions.js
java -jar selenium-server.jar user-extensions.js
java -jar selenium-server.jar user-extensions.js -h

6. Which Selenium command do you use to run commands in slow motion in Selenium RC?
selenium.setSpeed()
selenium.speed()
selenium.serverSpeed()
None of the above

7. Which command is used to get the alert box?
assertequals(selenium.getAlert())
selenium.getAlert()
selenium.alertBox()
selenium.click()

8. Which command is used for verifying if a web element exists?
selenium.isElementPresent(String locator)
assertTrue(Selenium.isElementPresent())
selenium.ElementPresent()
None of the above

9. Which command is used for typing in a textbox?
selenium.input()
selenium.type(String locator, String value)
assertequals(selenium.getValues())
selenium.textInput()

10. What is the command to load a page?
selenium.waitForPageToLoad(String timeoutInMilliseconds)
selenium.waitForPageToLoadInt timeoutInMilliseconds
selenium.waitForPageToLoad(timeoutInMilliseconds)
selenium.waitForPageToLoad()
Score is 0/ 10.

I have written the JavaScript source code that runs the quiz. The questions and answers of this quiz have been contributed by Varsha Tomar.

Please remember to mention your scores in the comments below. Now answer the quiz on Selenium WebDriver (also known as Selenium 2).

March 16, 2013

Apache JMeter: How to build and run a web test?

JMeter is a popular open source load testing tool that is written in the Java programming language. Besides other things, JMeter can be used to load test web applications. It is very simple to deploy JMeter on a Windows computer. JMeter is full of features to build, configure and run a realistic web test. It can also be used to perform functional testing on a web application. With this introduction, let us see how we can quickly build and execute a web test in Apache JMeter.

If you are new to performance testing or JMeter, please see my video, JMeter Load Testing Beginner tutorial. I have explained performance testing in the first 40 minutes. In the next 40 minutes, I have demonstrated the important basic JMeter features.

Also, you can see a complete JMeter load test explained in my video, Learn JMeter Load Testing in 18 minutes.

The latest release of JMeter can be downloaded here. At this time, the latest version is 2.9. JMeter requires Java 6 or later (meaning that the client computer needs to have Java version 1.6.x or later). You can check the java version on your computer by running the command, java -version in the command prompt window. If it tells you the correct Java version, you can proceed to set the JAVA_HOME environment variable under Control Panel> System > Advanced System Settings > Environment Variables > User variables. The JMeter binary comes as a zip file that you need to extract in a folder in your computer. Under this folder, there will be a folder called bin. You can launch JMeter by executing jmeter.bat file in the bin folder.


Building the web test plan
We will now build a simple web test. This test will involve navigating to the Software Testing Space blog and then my profile page. Add a Thread Group by right-clicking on the Test Plan node and then clicking Add > Threads(Users) > Thread Group. Leave every value as default.
Now, add a HTTP Request by right-clicking Thread Group and clicking Add > Sampler >  HTTP Request. Change the Name value to HomePage. Put the Server Name or IP value to inderpsingh.blogspot.com/ Then scroll to the bottom and check Retrieve All Embedded Resources from HTML files. Add another HTTP Request. Change the Name value to ProfilePage. Put the Server Name or IP value to blogger.com. Put the Path value as profile/05923580987480854491.


Running the web test plan
Before running the web test, you need to arrange to get the results. For this, add a listener. A simple listener is View Results in Table. Add it by right-clicking on Thread Group and then clicking Add > Listener > View Results in Table. Now click the green Start button or in the menu, click Run > Start. If you have not saved your web test plan, you can do so now. You should see the results. Results containing green icons indicate success, those containing orange/ red icons indicate warnings or errors. If your results contain green icons, it means that you successfully ran the web test plan with 1 thread (meaning an independent virtual user) running each HTTP Request once.
Now, run the same web test plan with 2 users running 3 iterations of 2 HTTP requests. Important: Please note that this blog is not a web site to be stressed. This is only an example. Therefore, please be reasonable and use very small numbers. Change the Thread Group values. Put Number of Threads (Users) as 2. Put Loop Count as 3.
Click on View Results in Table. Then click the Clear button in the toolbar to clear the previous results. Run the web test plan by clicking the Start button. When the test plan is running, you should see 2/2 in the upper right corner. This means that 2 threads/ users out of a total of 2 are active. Once the requests are sent and responses received, you should get the new results.

As you can see, it is quite easy to build and run simple web tests in JMeter. I hope that this post was able to raise your interest in using JMeter. You can see a more complex and complete JMeter load test plan in my video, JMeter Load Testing.

March 06, 2013

Selenium IDE Quiz Part 2


As you know, Selenium is a popular open source test automation tool for web applications that is used for functional and cross-browser compatibility testing. You may have already attempted the Selenium IDE Quiz Part 1. If not, try that first. Now, attempt the part 2 of this quiz to check your familiarity with Selenium IDE. Some of the answer choices are quite similar so please read each answer carefully before selecting the best one. The score appears at the bottom. A score of 5 or less indicates low knowledge, 6 to 7 means a fair level of knowledge and 8 and above shows a good knowledge of the Selenium IDE.
Instead of this quiz, you may want to see my video on Selenium Questions and Answers where I have compiled all these questions.

March 01, 2013

Selenium IDE Quiz Part 1


Selenium is a popular open source test automation tool for web applications. It is used for functional and cross-browser compatibility testing. In addition, several other open source functional testing tools are based on Selenium. This quiz on Selenium IDE is the first part of my series on testing using Selenium. Attempt this quiz to check your familiarity with Selenium IDE. Each question has one best answer. The score appears at the bottom. A score of 5 or less indicates low knowledge, 6 to 7 means a fair level of knowledge and 8 and above shows a good knowledge of the Selenium IDE. Instead of this quiz, you may want to see my video on Selenium Questions and Answers where I have compiled all these questions. 
 
Note: You can learn Selenium WebDriver from my complete set of Selenium Python tutorials for Beginners.