Changing the sequence of test cases in Selenium IDE - selenium

For example,
I have several test cases here when recording. And now I want to take test case "exp11141" to the first one, but I can't drag and drop the test case in Selenium IDE.
Is there a way to change the sequence of test cases in Selenium IDE?
I mean just in the IDE, not to modify any code. Thanks for help!

Yes you can! (control the order of the tests in the User Interface)
I don't recall when this was introduced but I'm currently running v3.17.0.
In Selenium IDE by default you're looking at Tests which shows the tests, I believe, in the chronological order you recorded them.
If you click the word "Tests", and choose instead "Test Suites" you should see the default test suite. In that view you can add a new suite or use the Default Suite.
Taking the Default Suite as our example, to the right of the name of the suite you'll see an icon (for me in Windows it's triple dots stacked vertically)
Clicking that icon gives a menu that allows you to choose:
Add tests
Rename
Delete
Settings
Export
By clicking "Add tests" you get a select tests dialogue with the names of all your saved tests, each with a checkbox beside it. Check any unchecked checkboxes first. All of them!
Now press enter to save or, if they were all already checked, escape to exit.
Now, viewing your suite you CAN click and drag to re-order the tests! So for the OP's question, in the suite click and drag that one to the top and off you go!
When you run a suite (icon with right-pointing triangle and three horizontal lines) or using shortcut (Ctrl-Shift-R) the tests will run in that order.
By creating different suites, I have created alternate combinations of tests from my total list to run different scenarios.

You should be able to drag and drop, that is part of the IDE functionality. If that isn't working then something may be wrong with your IDE install. Other than that there is no other way within the IDE to reorder the tests, you'd need to build the suite again by adding in the test cases from the file menu.
I'm not sure why you're against editing it outside of the IDE, but it is incredibly simple, as it would just be 1 cut and paste. If you open the suite file in a text editor you'll see something like this within it.
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td>TestCase1</td></tr>
<tr><td>TestCase2</td></tr>
<tr><td>TestCase3</td></tr>
</tbody></table>
</body>
All you'd need to do is cut the row of the test case you want to move and paste it in at the top

Related

How to view code coverage details in Intellij

When I run Code Coverage -either as part of invoking a unit test or from Analyze | Generate Coverage Report the result is only a one-line summary as shown:
Instead what we want is to see coverage by class - to hone in on the undertested areas. Even better would be detailing per-class areas (to the lines?) Does IJ have any of those capabilities?
Aha! It show up in the Explorer. Now there really should also be a text report .. so if anyone knows where that is or how to generate it another answer would be appreciated.
NOte: I can not show the full path names for confidentiality reasons
From the Intellij documentation. To generate a code coverage report
Do one of the following:
On the main menu, choose Analyze | Generate Coverage Report.
In the toolbar of the Coverage tool window, click exportToTextFile.
In the Generate Coverage Report dialog box that opens, specify the target directory where the generated report will be stored, and optionally select the check box Open generated HTML in browser.
Click Save. IntelliJ IDEA will store the generated report to the specified location, and also open it in the default browser, if the corresponding check box has been selected.

How can I focus the cursor into the test results output area using the keyboard in Jetbrains IDEs?

I have just run some Rspec tests in Rubymine and I want to use the keyboard to focus on the test results so that I can then jump to the test source code.
Here's the bottom of the IDE window. I want to first focus into the left hand pane so I can choose the correct test, then jump to the right hand pane so I can choose the line to go to. I've tried to use Command-4 to focus on the pane, but it just focuses the tab and not into the actual pane.
What is the correct key combination to do this (or what are the actions called on the keymap so I can assign keys)?
Although it's not what you asked (and I'd like to know an answer), I did just discover the "Select Failed Test When Finished" option in the Run pane settings (the blue gear in the upper right of the left-hand sub-pane). It selects the first failed test (which puts the output of that test in the right-hand sub-pane) and puts focus in the right-hand sub-pane. So if you always want to do that when a test fails, it might make you happy a lot of the time.
Try to use "Tab" button. After that, you could move logs with Up/Down arrows or PageUp/PageDown buttons.
It works on my IntelliJ IDEA 2017.1.5.
View -> Tool Windows -> Run
For me, the shortcut would be [Alt+4], and it is displayed in the menu, you will see it. If there's none, go to Keymap settings and configure it.
And yes, this question is old but it's a useful shortcut

Convert JUnit test case to Selenium IDE html file?

I have learnt how to export Selenium IDE html file to JUnit.
But if I make a change to the JUnit test - is there a way I can convert the Junit test to Selenium IDE html file so that even if I run the test from IDE the new change is recorded?
What is the best practice for such scenarios?
Note: (2nd user#Manii88), I am also facing the same issue...THough it might be an old question, it is still not solved yet...I find this question compelling because, say for example, I am in middle of some test, which i have exported from selenium ide and modified in Selenium Webdriver, eclipse, to check the viability of test cases and handling of popups...then, i want to continue my test case in ide...till the step completed, i want to proceed quickly and then, the next step, i will continue recording...
Hope this makes the scenario clear...Any answers???
Thanks!
Though it's not always possible, you may try the below steps to achieve it to some extent:
Install the latest Selenium IDE (or at least >= 1.6)
Open Selenium IDE
Options Menu > Format > JUnit 4 (Webdriver backed) [or use the same option here which was used while exporting html to JUnit]
Dismiss the warning dialog
Go to the Source tab, and paste your JUnit code
Change the format again back to HTML by selecting Options > Format > HTML
Dismiss the warning dialog
Switch (back) to Table tab to see your latest changes

Better Control over test suites in SenTesting Kit/OCUnit

It seems that adding a class to my Xcode 4 Testing project that begins with test... automatically adds it to the testing run, but is there a way for me to have the test suites I want to run defined in a class so I can easily toggle them on and off? I would like to be able to manually register a suite then comment it out if it is not required. I don't want to have to add and remove classes from the Testing target.
In Xcode4 Edit Scheme, select "Test", click the disclosure triangle and click "Test". You will be able to select classes or individual tests.

How do I use Selenium IDE on Firefox to test JavaScript generated codes?

I am trying to test a website which contains alot of javascript.
Javascript does alot of opening new dialog to let user choose "yes" or "no".
It also has a function to upon right clicking, it opens up a right click menu which contains many functions such as zip, delete etc.
In Selenium, I can use the Selenium IDE to login, click, and others, but I don't know how to test those functions.
I've read there are codes I can write such as in Java to run the test, but I'm hoping to make it work by using the simple Selenium IDE if possible. If not, then can someone post a simple testing code which works to run java scripts? Such as click button -> javascript menu pops up -> click ok on the pop up.
Thank you very much.
Right context menus can be a little tricky. I'd suggest making custom commands for the right click context menu. Add the code from this article to your custom user-extensions.js file.
http://old.nabble.com/How-to-recognise-right-click-of-the-mouse-in-IDE-td14913052.html
The parameters for these functions in these commands become the expected arguments of your Selenium IDE commands. If you really want to make it simple, you can just call your javascript functions in these custom user-extension commands. :-) That might be a bit lazy and isn't truely testing what your right click is doing, but it would work.
Option #1 - if using IDE:
Specify the user-extensions.js file under Selenium IDE > Options (menu) > Options (menu option) > General Tab, then browse to your file under "Selenium Core Extensions".
Option #2 - if using Selenium RC Server:
If you're not using the IDE and using Selenium RC server with a client driver (like JUnit for example), you must specify the path of the *.js file with the -userExtensions parameter when you start the Selenium RC Server on the command line. But you said you just wanted to use the IDE, so I'd ignore this. It takes quite a bit of other setup to use the Selenium RC server.
java -jar selenium-server.jar -userExtensions user-extensions.js
=======================
I've never done this before, so I made the following custom command (JavaScript function) in my custom user-extensions.js file, and it worked well for me. I had to exit and restart the IDE before it found it. For some reason, you type everything after the "do" in the "Command" field in the IDE. It looks like it also added a "customAlertAndWait" to the IDE as well.
Code in user-extensions.js file:
Selenium.prototype.doCustomAlert = function(sTarget, sValue) {
alert('Target: ' + sTarget + ' ... Value: ' + sValue);
};
Selenium IDE command details:
Command: customAlert
Target: custom alert target
Value: custom alert value
The selenium IDE has a lot of tools to verify that specific elements are present and that the value is correct.
To set something up, you would create a test case, and start to record it. When you get to a page where you have to verify that something exists, right click on that element, and you will see a lot of Selenium commands tagged at the bottom of the click menu, such as "VerifyTextPresent" or "verifyValue" or "verifyElementPresent" When you select those commands, they will appear in your test case, and will fail if the verification fails.