Veröffentlicht am

6 steps to create and export Selenium IDE tests




  • da Agency – Webdesign & SEO, Köln meldet:

    The aim of this blog is to show you in 6 steps how to install the Selenium IDE Add-on, create basic Selenium IDE automation tests by recording, execute them and export them into a programming language (e.g. C#, Java, Python).

    What is Selenium IDE?

    Selenium IDE is a Firefox/Chrome Add-on that helps create Selenium test cases and test suites against web applications. It is a useful tool to create the bulk of your Selenium scripts, but it does also have its limitations.

    For this blog, we will concentrate on just Firefox, although Chrome is pretty much the same.

    1.    Install the Selenium IDE Add-on

    The first step is to download the Selenium IDE which – at the time of writing – is via the following URL:

    https://selenium.dev/downloads/

    Just click on the browser you are interested in (for these notes we are going to use Firefox, although Chrome is really not that different).

    Selecting the Firefox IDE from the webpage

    This should take you to the actual Add-on page.

    Selecting the Firefox IDE from the webpage

    Clicking the Add to Firefox button will start installation.

    6 steps to create and export Selenium IDE tests

    After accepting all the defaults, it will appear on your browser toolbar.

    6 steps to create and export Selenium IDE tests

    2.    Record a script to create tests using the Selenium IDE

    To record a test case:

    Ensure you have browsed to the Application under Test (AUT) that you wish to record against.

    For these notes we have our own website.

    From the Firefox Tool bar, select the Selenium IDE icon.

    6 steps to create and export Selenium IDE tests

    The Selenium IDE Application will start by displaying a menu:

    6 steps to create and export Selenium IDE tests

    As we have never used it before, the above screen is selecting the first option.

    When creating a new project, it will ask for the name. For these notes we have used the imaginative name of demo.

    6 steps to create and export Selenium IDE tests

    It will then want to run a test, and will prompt you for the project’s base URL. You can get this by copying the main URL from the original browser window and pasting it across.

    6 steps to create and export Selenium IDE tests

    Selenium will then open a new browser window which you use to record your steps for your test.

    6 steps to create and export Selenium IDE tests

    From this point forward the IDE monitors all mouse interactions and keyboard inputs and records them in the Selenium IDE interface. Until you stop the recorder.

    Selenium IDE does have a habit of placing the web page in a window in front of the Selenium IDE and will record the action of moving it in your script.

    6 steps to create and export Selenium IDE tests

    The Selenium IDE table tab will then display all actions captured by the recorder. It is possible to view, modify or delete commands from this view. To delete a command, right click on the command and select delete from the menu.

    When all recorded steps are complete, stop the recorder by clicking on the red circle.

    6 steps to create and export Selenium IDE tests

    To save your test, you will need to save the entire project, click on the Save project button in the top right-hand corner of the IDE screen.

    6 steps to create and export Selenium IDE tests

    3.    Replay the script in the Selenium IDE

    Once all the required test steps have been captured, you can now replay the test by clicking on the Run current test icon.

    6 steps to create and export Selenium IDE tests

    If you have closed the window Selenium used to record the test, the IDE will now open it again.

    On successful execution of the test the captured tests steps will turn green:

    6 steps to create and export Selenium IDE tests

    Should the test fail, the failed line (usually highlighted in red) and the failure count on the left-hand side will increment by one.

    6 steps to create and export Selenium IDE tests

    Any errors also appear in the log tab at the bottom of the Selenium IDE interface.

    Inserting Commands

    When using Selenium IDE as an automated test tool it is inevitable that you are going to need to modify the recorded steps to include an additional step e.g. an extra click, some synchronisation or an Assertion (A method of passing or failing a test).

    To insert a new command:

    Select the point in the script where you wish to place the new command.

    Right click the Selenium IDE interface and select Insert New Command

    6 steps to create and export Selenium IDE tests

    Initially the new command will appear in the script as a blank line.

    Structure of a line in the test case

    Each command requires up to three inputs:

    • Command
    • Target
    • Value
    6 steps to create and export Selenium IDE tests

    Command

    Command is the action the Selenium Script is to perform. Commands range in functionality from Navigation e.g. Click a Button, Synchronisation e.g. Wait for text to appear on the screen and Assertions e.g. ensure the correct text has appeared on the screen.

    To select a command, click on the black arrow to expand the drop-down list of available commands.

    Target

    Target refers to the Object or “WebElement” that you wish to record the action.

    For example, if the Selenium IDE script was required to click on a link a “description” of the object would be included in the target field.

    Value

    The value is an optional field used when the command needs some additional information. For example, if you want to type in a text box, then this field would contain the text you wished to type.

    4.    Replay all tests in the Selenium IDE

    If the Selenium IDE project has more than one test, we can run them all sequentially.

    In the screenshot below, we have a couple of tests sitting in the IDE…

    6 steps to create and export Selenium IDE tests
    A Selenium test suite wA Selenium IDE test suite with more than one test case.

    To execute all tests in the test suite, select the Run all tests button:

    6 steps to create and export Selenium IDE tests

    The test cases show up as green when the tests have executed successfully:

    6 steps to create and export Selenium IDE tests
    6 steps to create and export Selenium IDE tests

    5.    Export the tests from Selenium IDE

    The Selenium IDE enables recorded test cases to be exported to a range of programming languages and their respective testing frameworks.

    To do this:

    Either right-click on the test name or hover the mouse near the end of the test name field until three dots appear.

    6 steps to create and export Selenium IDE tests

    Click on this and select export.

    6 steps to create and export Selenium IDE tests

    Selenium will then prompt you to select the language (in this example we have selected C# NUnit).

    6 steps to create and export Selenium IDE tests

    Give a filename and save it in the desired location.

    6 steps to create and export Selenium IDE tests

    The choice of programming language and test framework would be either be a personal preference or an organisational norm and would depend on tools and skills of the tester or developers available.

    6.    Running Selenium IDE test cases from the command line

    Once you add the test cases into a Selenium IDE test suite, it is possible to execute them from the command line.

    Open a new instance of File Manager (“Win + E”).

    Navigate to the folder where you saved your project (the file with the extension “side”).

    6 steps to create and export Selenium IDE tests

    Hold down Control & Shift and then Right click the mouse and select Open PowerShell window Here:

    6 steps to create and export Selenium IDE tests

    Run the tests from the command line

    In the terminal window, type in the following:

    selenium-side-runner *.side

    This will run selenium from the command line.

    6 steps to create and export Selenium IDE tests

    To exit out of the terminal window, type in exit.

    Want to find out more?

    Want find out more about setting up the Selenium IDE, exporting test cases to other languages and running them as actual code?

    Well, at the Expleo Academy we deliver a few courses on Selenium and many other subjects. Feel free to visit the Academy website.

    More information on the Selenium IDE can be found at the following location:

    https://selenium.dev/selenium-ide/docs/en/introduction/getting-started

    John Kurowski has been delivering training for over 10 years specialising in Automation, Agile and ISTQB. John also develops the courseware and creates virtual machines in AWS for automation courses.
    John has been working in IT for over 30 years and has also been a tester, test manager, developer, development manager, project manager, support consultant (the list goes on…)

    Read more about the Indicators on the original post at: https://expleoacademy.com/int/6-steps-to-create-and-export-selenium-ide-tests/

    All training courses at Expleo Academy

    bcs intermediate certificate in software testing
    change management fundamentals
    isqi certified agile business analysis caba revision session and exam 1500
    flow ambassador excelling at business agility masterclass
    estimating for testers
    dasa certified devops fundamentals
    sql fundamentals
    istqb certified tester advanced level security tester
    istqb certified tester advanced level technical test analyst
    istqb certified tester advanced level test manager
    project management professional pmp preparation course
    agile certified practitioner pmi acp preparation course
    using selenium in csharp with workshop
    apmg certified change management in an agile environment foundation and practitioner
    risk management professional pmi rmp certification preparation course
    project management fundamentals
    program management professional pgmp preparation course
    istqb certified tester foundation level extension agile tester
    bcs certificate in modelling business processes
    isaqb certified professional for software architecture foundation level cpsa f
    bcs foundation certificate in business analysis
    icagile certified product ownership
    writing user stories workshop
    bcs certificate in requirements engineering
    bcs international diploma in business analysis exam preparation workshop
    bcs certificate in business analysis practice
    agile requirements engineering
    certified disciplined agile scrum master dasm
    icagile certified agile fundamentals
    istqb certified tester advanced level test analyst
    certified disciplined agile senior scrum master dassm
    requirements verification
    isqi certified agile business analysis caba
    certified associate in project management capm preparation course
    linux essentials
    java fundamentals
    performance testing fundamentals
    agile process tools a look into scrum kanban and safe
    scrum master bootcamp
    product ownership bootcamp
    a4q certified selenium tester foundation
    psychology of communication intelligence
    test automation fundamentals
    using cucumber with selenium
    using selenium with workshop
    asqf certified professional for project management
    istqb certified tester foundation level
    agile bootcamp

    About Expleo Academy

    The Expleo Academy enables you to acquire and develop the right skills by delivering a suite of accredited training courses. With a global presence and reach, we deliver hundreds of training events to thousands of participants each year. We bring the knowledge and real experience of working with global companies and the flexibility of delivering public workshops, custom in-house solutions and blended learning approaches incorporating digital learning capabilities.

    The Expleo Academy offers training courses  in Management Consultancy, Business Agility, Continuous Quality, Software Engineering or even Private Events with detailed Learning pathways in Business Analysis, Change Management, Project / Program Management, Software Quality Analysis, Software Quality Management and Software Engineering. Many training courses like test automation engineer, certified tester, automotive spice, usability testing, scrum product owner or isaqb training include certification based on istqb, leading safe, asqf, intacs or isaqb. The Expleo Academy also offers training for wellknown Tools like Microsoft ProjectTools & Automation trainings like Selenium, Jira Essentials, Jira XrayJira Server, Confluence trainingKanbanTricentis and many more.

    Academy is part of the Expleo Group , that offers Engineering, Consultancy- and IT-Services to the industry. At https://products.expleogroup.com/ one could find a bunch of products which Expleo developed over the years, among them Testona (Features, Klassifikationsbaum-Methode, Training & Tutorial, References, Download & Price), Modica (MBT Process, Modelling, Object Definition, Generation, Automation, Training & Tutorial), Messina, (Camera-Hil-System, Ancona-Hil-System, Messina RS-UI Test Automation, Modular-Hil-System), Trentino, Persim, Savona, Bergamo, Meran, Powerdiff, and also Powerdiffmerge, and of course the Aerospace Products like Crew Rest Unit, Crew Rest Couch and ALM (3D Printed) parts. On their Tools Website one could find the Test-Suite Expleo-Test/Professional (formerly known as SQS-Test/Professional) at https://tools.expleogroup.com/

    Contact the Expleo Academy

    Expleo Technology Ireland Ltd
    30 North Wall Quay,
    Dublin D01 R8H7

    Tel +353 87 2355902
    Web: https://expleoacademy.com/int/

    Google Ads & SEO – da Agency

     

    Der Beitrag 6 steps to create and export Selenium IDE tests erschien zuerst auf da Agency – Webdesign & SEO, Köln.