How to set up Selenium automated tests for Magento projects

After reading this article you will find out:

  • Why to choose Selenium?
  • When is it especially worth using it?
  • How is Selenium structured and what is it made up of?
  • How to download it?
  • What are its functions? How to use it?
  • At the end of the article I will show you the process through a simple example.

Come on, join me!

magento selenium tester bea

 

An ecommerce entrepreneur must follow the changes of the market in today’s competitive retail industry and he or she has to make regular modifications to the website. These smaller changes make it possible for the online store owner to react on the latest trends and keep up with competitors. These modifications may be new products, offers, discounts, shipping methods, payment methods and many other things. The companies must ensure “flawless” user experience even during the regular modifications, otherwise these may lead to negative and undesirable results. For this purpose the testers must continuously check the website and remove the errors. Web developer companies work according to an agile methodology where the “sprints” are quite short and it is necessary to run comprehensive regression tests after each modification. Unfortunately, when changes are made too often, manual testing may become monotone and may take a lot of time. Sooner or later you will have to apply some sort of “facilitation”. This is where Selenium comes into the picture. Let’s see why.

 

1) Why Selenium?

 

SELENIUM:

Selenium is a Firefox extension that makes Black Box type user interface testing possible, which means that you test the application as a whole without knowing its internal operation. You can record test cases with the Selenium IDE Firefox plugin that automatically records the operations done in the browser.

 

This may very much facilitate the life of testers because the tests are developed quickly, but still in an optimal way, and this can be quite cost effective. In addition, Selenium IDE is a remarkably helpful tool since it makes the steps after which the application becomes testable effectively, quickly and in a robotic way, thus putting the software in a condition that would be boring and tiring to reach or test manually. If you automate the path, and following it to reach this point, you will no longer be exhausted and stressed out and you will still be able to provide the best of your testing knowledge.

 

Introduction of automated tests has countless advantages. Let us check out some:

  • It is possible to repeatedly replay the test cases
  • You may perform test cases simultaneously
  • You can run tests without supervision
  • It increases accuracy and greatly reduces errors generated by people
  • You can save time and money

This is where some important questions arise:

  • What is the best tool to automate my test cases?
  • What costs are implied?
  • How easy is it to apply?

In case of web applications, as I’ve already mentioned, Selenium is a very good solution to all issues mentioned above. Why?

  • It is easy to use
  • It is free (open source)
  • It has a great user database and an assisting community
  • It supports several programming languages

 

2) When is it especially worth using Selenium?

Selenium IDE is an easy-to-use tool for simple test cases but in case of the more complex ones (where, for example, there are several branches/forks), it is less easy to apply. It is really worth making Selenium tests when there are no major further modifications to the interface, but development of the backend logic, services or background systems is ongoing. When doing Selenium user interface testing, the tests can be replayed any time, so you can continuously be informed about the results of your tests!

 

3) How is Selenium structured and what is it made up of?

Selenium is not just a separate tool that can only be used by itself, but it is rather a package made up of different testing tools. This package consists of the following components:

  • Selenium Integrated Development Environment (IDE) Selenium ide icon
  • Selenium Remote Control (RC) Selenium RC icon
  • Selenium WebDriver
  • Selenium Grid  Selenium Grid icon

The users may choose from these tools according to their specific needs.

Selenium Package

 

Selenium IDE

Selenium IDE is the simplest tool of the Selenium Package. Its Record and Replay functions make learning it exceptionally easy, as it requires none or just a very little programming competence.  

Selenium RC (Selenium Remote Control)

Selenium RC (Selenium 1) is a tool written in Java that allows creation of test scripts to web applications in the desired programming language and it also ensures their running. This tool is not really used by itself any more.

Selenium Grid

Selenium Grid makes a new function available, namely that the tests written in Selenium RC can be run in several browsers and on several platforms simultaneously.  

WebDriver

WebDriver is a separate tool, but it has a lot of advantages especially when it is combined with Selenium RC. The fusion of the two is often called Selenium 2. WebDriver directly reaches the browsers that support automation.  

Supported browsers:

Selenium - Supported browsers

Supported programming languages:

Selenium - supported programming language

Supported operating systems:

Selenium - supported operating systems

 

4) How to download Selenium?

Step 1: Open the browser (Firefox) and enter the seleniumhq.org URL. This is the official site of Selenium. Click on the “Download” tab where you will find all existing versions of Selenium.

 

Selenium download

 

Step 2: Under the Selenium IDE entry you will find a link that will take you to the extensions page of Firefox, from where you can immediately download and install Selenium IDE.

 

Selenium IDE download install

 

Step 3: Click on the “Add to Firefox” button.

 

Selenium IDE Firefox

 

Step 4: Click on the “Install” button.

 

Selenium installation

 

Now the icon of Selenium IDE appears in the upper right-hand corner of your browser. Later you can start the programme from here. If you click on it, the Selenium window will immediately pop up.

 

Selenium install

 

5) Functions and use of Selenium

Let us look at its menus and functions in detail!

 

1) Menu bar

The menu bar is placed in the upper part of the Selenium window and it consists of five parts:

  • File
  • Edit
  • Actions
  • Options
  • Help

1.1. File menu The File menu is very similar to that of any other application. It allows the user to:

  • Create new test cases, open existing ones or save the actual one.
  • Export a given test case or a test suite in the desired programming language with the ”Export Test Case As” and the “Export Test Suite As” options. The first one exports the currently active test cases while the second one exports all that are open.
  • Close the test case.

Selenium menu file

Selenium IDE test cases can be saved in the following format:

  • HTML format

Selenium IDE test cases can be exported in the following formats/programming languages:

  • java (exported in Java)
  • rb (exported in Ruby)
  • py (exported in Python)
  • cs (exported in C#)

1.2. Edit menu

Selenium edit menu

 

The Edit menu allows options like Undo, Redo, Cut, Copy, Paste, Delete and Select all, which are usually present in all Edit menus. In addition to these, the following ones are available:

  • Insert New Command – this allows the user to insert a new command within the test case
  • Insert New Comment – this allows the user to insert a comment within the test case that explains subsequent commands

Insert New Command The new command goes above the selected command/step.

 

Selenium new command

 

The user can now insert the new command by filling in the Target and the Value fields.

 

Selenium new command target value

 

Insert New Comment The new comment is inserted the same way as the new command is.

 

Selenium new comment

 

The colour purple indicates that this is a comment/explanation.

 

1.3 Actions Menu

 

Selenium actions menu

 

You can choose from the following options under Actions menu:  

  • Record – When you click on this button, Selenium IDE starts recording the steps made in the Firefox browser.
  • Play entire test suite – This option runs all test cases belonging to the current test suite.
  • Play current test case – This option runs the currently active selected test case.
  • Pause/Resume – Running of test cases can be paused and resumed.
  • Toggle Breakpoint – The user can insert one or even several breakpoints in the test, thus forcing the test to stop at any step.
  • Set/Clear Start Point – Here you can add a starting point to any step, which the test will start from thereafter.
  • It is also here where you can set the running speed of the test with the “Faster, “Fastest”, “Slower” and “Slowest” buttons.

 

1.4 Options menu

 

Selenium options menu

 

The Options menu allows the user the practise the handling of settings supported by Selenium IDE. The user can “play” with the general settings (General), with the available formats (Formats), the available extensions (Plugins) and with the available locators and their order (Locator Builders).

 

Selenium options menu general

 

1.5 Help menu If you are stuck, this is where you can check out the documentation, this is where you can report eventual detected errors and this is from where you can go to the official website or blog page of Selenium.

 

2) The URL bar

The URL bar looks the same and operates roughly the same way as that in a browser. It stores the addresses of previously visited sites, so later you will only have to select one, which makes your life much easier, especially if you cannot remember and keep in mind all the addresses of the websites you work on.

 

Selenium url bar

 

3) Toolbar

 

Selenium toolbar

 

You can find the toolbar directly under the URL bar and it includes the following options:

  • Playback Speed – This is where the running speed of the test can be set. Selenium toolbar playback speed
  • Play test suite – With this button you can run all test cases that are currently open. Selenium toolbar play test suite
  • Play test case – You can run the currently active test case with this button. Selenium toolbar play test case
  • Pause – You can pause the running of the test. Selenium toolbar pause
  • Step – The user can step over a given command implementing one command at a time. This is generally used at error correction. Selenium toolbar step
  • Rollup – You can unite two or more steps. Selenium toolbar rollup
  • Record – You can start and stop the recording with this button. Selenium toolbar record

 

4) Editor

The editor is the window where the steps of the test case are visible. This is where the newly recorded commands appear, too. The editor has two views:

 

1) Table view

 

Selenium table

 

2) Source view The test case appears in HTML format here.

 

Selenium source view

 

The user has the opportunity to enter the commands in the Editor, Selenium offers the possible options right after entering the first character. You can select the given item directly from the browser if you click on the Select button. The Find button points to the item associated to it based on the given value.

 

Selenium find

 

5) Test Case window

 

Selenium test case window

 

This is where the latest test case will appear, but since it is possible in Selenium to open several test cases at the same time, all of them will be listed here. This way you can easily choose which one you would like to work on for the moment. When clicking on a test, its steps appear in the Editor window. Test results also appear here, which Selenium indicates in two colours: red and green.

  • Colour Red indicates errors and the failure of the test
  • Colour Green can be associated with a successful test case

 

6) Log window

 

Selenium log window

 

On the Log tab you can see information, in the form of messages on each step separately, at the moment when they are run. It also appears here, indicated in colour red, if there are errors in the test or if it failed. This way you can easily make corrections to your test later on. You can also find the Reference tab here where you get detailed description of a given command, and also the Expert tab that is added to Selenium by an extension. Hints and correction tips appear here that can be immediately performed by clicking on the Inspect and then the Fix buttons. With this, we have more or less arrived at the end of the introduction and the theoretical part. I would like to finish my article with a short example so that you can see all that has been mentioned above in practice, too. This is really a simple test case, much more complex ones could be made up, but I did not want to overcomplicate things since that is not the point of my article.

 

6) ‒ Example

Making a test “script” consists of 3 major steps:

  1. Record – Selenium IDE records all clicks and operations done in the browser.
  2. Replay – The already made up test case has to be replayed several times in order to make sure it works well, whether it needs eventual correction or fine-tuning.
  3. Save – In case the test is reliably stable, it is recommended to save it, so that it can be used again any time in the future.

 

Record

Step 1 Launch Firefox browser and also Selenium at the same time by clicking on the icon in the toolbar.   Step 2 Enter the address of the website to be tested (accounts.google.com) in the URL bar.

 

Selenium URL testing

 

Step 3 The Record button is enabled by default, in case it is not, do not forget to enable it, otherwise it will not record the steps.   Step 4 Open the given website (accounts.google.com) in Firefox.

 

Selenium google sign-in example

Step 5 Enter an existing and real e-mail address.   Step 6 Enter the password that belongs to the e-mail address.   Step 7 Click on the “Sign In” button to complete signing in.   Step 8 At the end, you can stop the recording with the red button and can replay your test case.   WARNING. In case you have not recorded the Sign out step in the test case, you need to make this step by all means before replay, otherwise Selenium will not find the necessary fields or buttons.

 

Replay

Now that your test is done, you need to replay it in order to see whether it is stable enough. Click on the “Play current test case” button.

 

Selenium replay

Save

In case everything is fine, you can save the script by clicking on the File -> Save as option.

 

SUMMARY

It is an obvious objective to improve the quality of your website and to offer a positive user experience. Still, the people working to reach this aim, must love and enjoy their work in the meantime in order to give their best. All in all, Selenium is a very useful tool with which you can facilitate your testers’ job and provide better quality. As explained above, it is relatively easy to use, but requires a lot of practice, since there is a great number of possibilities and options if more complex tasks are to be performed.

 

 

55 replies
  1. Drug Rehab Facilities says:

    Substance Abuse Powerpoint http://aaa-rehab.com Drug Rehab http://aaa-rehab.com Substance Abuse In Children
    http://aaa-rehab.com

  2. Drug And Alcohol Rehab says:

    Drug And Alcohol Rehab http://aaa-rehab.com Drug Rehab http://aaa-rehab.com Kaiser Substance Abuse
    http://aaa-rehab.com

  3. what is value investing says:

    obviously like your web site however you have to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling problems and I find it very troublesome to tell the truth on the other hand I will definitely come back again.

  4. What is quantitative easing says:

    Hello there I am so glad I found your webpage, I really found you by error, while I was looking on Google for something else, Anyways I am here now and would just like to say kudos for a incredible post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the moment but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb job.

  5. Dow Jones Today says:

    I do agree with all of the ideas you have presented in your post. They’re really convincing and will definitely work. Still, the posts are very short for starters. Could you please extend them a bit from next time? Thanks for the post.

  6. comando filmes says:

    I’m curious to find out what blog system you are utilizing? I’m experiencing some small security problems with my latest site and I would like to find something more secure. Do you have any recommendations?

  7. erjilo pterin says:

    After examine a number of of the weblog posts in your website now, and I actually like your method of blogging. I bookmarked it to my bookmark website listing and can be checking again soon. Pls check out my web site as properly and let me know what you think.

  8. armas says:

    Whoa! This blog looks exactly like my old one! It’s on a entirely different subject but it has pretty much the same page layout and design. Outstanding choice of colors!

  9. hospedagem de site says:

    Good day! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

  10. สล็อตออนไลน์ says:

    Hi there are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any html coding knowledge to make your own blog? Any help would be really appreciated!

  11. Services List says:

    This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.

  12. TikTok Followers says:

    I have to voice my love for your kindness in support of people who need help on this area of interest. Your very own commitment to passing the solution throughout was extremely practical and have in most cases made people much like me to arrive at their ambitions. Your own insightful publication implies a whole lot a person like me and still more to my fellow workers. Thanks a ton; from everyone of us.

  13. iptv lista says:

    Hello there! This is kind of off topic but I need some help from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about setting up my own but I’m not sure where to start. Do you have any ideas or suggestions? Appreciate it

  14. turkish kilim pillows says:

    I’m curious to find out what blog system you are working with? I’m having some minor security issues with my latest website and I would like to find something more risk-free. Do you have any suggestions?

  15. comprar seguidores instagram says:

    Hi! Someone in my Myspace group shared this site with us so I came to take a look. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Great blog and wonderful design.

  16. www.marketing1on1.com says:

    I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has inspired me to get my own blog now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.

  17. spor says:

    What i do not realize is actually how you’re not really much more well-liked than you might be now. You are very intelligent. You realize therefore significantly relating to this subject, made me personally consider it from a lot of varied angles. Its like women and men aren’t fascinated unless it is one thing to accomplish with Lady gaga! Your own stuffs excellent. Always maintain it up!

  18. promocoes de internet ceara says:

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove people from that service? Bless you!

  19. Jefferson L Cox says:

    Good ?V I should certainly pronounce, impressed with your site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or anything, site theme . a tones way for your customer to communicate. Nice task..

  20. french bulldogs for sale near me says:

    Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is wonderful blog. A fantastic read. I’ll certainly be back.

  21. Download Slot Online says:

    Great – I should definitely pronounce, impressed with your website. I had no trouble navigating through all tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your client to communicate. Excellent task..

  22. VivoSlot Online says:

    In this awesome scheme of things you actually get an A just for effort. Where you lost me personally ended up being in all the specifics. You know, they say, the devil is in the details… And it could not be much more true at this point. Having said that, permit me inform you just what exactly did deliver the results. The article (parts of it) is certainly incredibly powerful and this is probably the reason why I am taking an effort in order to opine. I do not really make it a regular habit of doing that. Second, despite the fact that I can notice a jumps in reason you make, I am not really sure of just how you seem to unite the details which in turn help to make the final result. For the moment I will subscribe to your position however wish in the foreseeable future you link the facts much better.

  23. Joker123 Gamming says:

    Some genuinely superb info , Gladiola I found this. “If a child can’t learn the way we teach, maybe we should teach the way they learn.” by Ignacio Estrada.

  24. Joker123 Online says:

    Merely wanna remark on few general things, The website pattern is perfect, the written content is really excellent. “To imagine is everything, to know is nothing at all.” by Anatole France.

  25. Deuses says:

    I believe this site has got some rattling good info for everyone. “Je veux que les paysans mettent la poule au pot tous les dimanches.” by King Henry IV of France.

  26. click says:

    Hi, Neat post. There is a problem with your site in internet explorer, would check this… IE still is the market leader and a large portion of people will miss your wonderful writing due to this problem.

  27. click here says:

    Magnificent beat ! I would like to apprentice while you amend your web site, how can i subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear idea

  28. kevin david entrepreneur says:

    An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers

  29. libid gel funciona says:

    I do accept as true with all of the ideas you have presented on your post. They are really convincing and will definitely work. Still, the posts are too short for newbies. May just you please extend them a little from next time? Thank you for the post.

  30. FafaSlot Gamming says:

    Great awesome issues here. I?¦m very glad to look your article. Thanks so much and i’m taking a look ahead to contact you. Will you kindly drop me a e-mail?

  31. Fay Yorn says:

    I just want to tell you that I am just very new to blogs and actually liked you’re web site. Almost certainly I’m going to bookmark your blog post . You actually have exceptional posts. Thanks for sharing your web site.

  32. Joker388 Online says:

    With havin so much content do you ever run into any problems of plagorism or copyright infringement? My website has a lot of completely unique content I’ve either authored myself or outsourced but it appears a lot of it is popping it up all over the web without my authorization. Do you know any techniques to help stop content from being ripped off? I’d certainly appreciate it.

  33. Portugal says:

    I’ve been absent for some time, but now I remember why I used to love this website. Thank you, I¦ll try and check back more frequently. How frequently you update your web site?

  34. สล็อต says:

    I just couldn’t leave your website prior to suggesting that I actually enjoyed the usual info a person supply on your guests? Is going to be again continuously in order to investigate cross-check new posts.

  35. https://vnz.bz/ says:

    I carry on listening to the reports talk about receiving boundless online grant applications so I have been looking around for the top site to get one. Could you tell me please, where could i acquire some?

  36. Mai Mcanally says:

    I just want to mention I am beginner to blogging and really liked your website. Very likely I’m going to bookmark your blog post . You amazingly have beneficial well written articles. Thanks for revealing your webpage.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.