I have been working on ATCs during 2 months and I continue having problems with Chrome, Selenium and JBehave. The Chrome driver for selenium has some bugs. For example: Sometimes it said that the components could not be found or clickable. For this situation, I used a workaround, but it is a little hugly.
When I run the ATCs, sometimes one of then fail due to chrome selenium driver bugs!. Also, I don't like the JBehave's Reports.
Could somebody advise me another option to create ATCs?
Thanks!!!
Sarang
Consider Selenide - it's specifically create to resolve all these timing/ajax/"element not found" poblems. Selenide is extremely simple to start with (much simpler than Thucydides) and can be used with any framework: Junit, TestNG, JBehave - you name it.
I like Thucydides to write ATCs:
http://thucydides-webtests.com/2011/09/23/hello-world/
It has a nice report, with screenshots ...
You can write tests with easyb, junit or jbehave.
But it use selenium engine too.
Related
NUnit (and the like) has method attributes which allow tests to be run multiple times with different arrange values. Is something similar possible with SpecFlow?
What I am aiming for is a way to run the same scenario tests in a feature file with as many browser drivers as I can, in one test run.
You can use scenario outlines. In example of scenario outline you can mention driver name and you code logic should take action according to driver. Please see more details about scenario ouyline below
https://github.com/cucumber/cucumber/wiki/Scenario-outlines
Examples are one solution, but in your case a little cumbersome, as you have to specify them at every scenario.
In your case, please have a look at the targets feature of the SpecFlow+Runner. With that you can "multiply" your scenarios for different configurations. If you put the web driver that should be used in this configuration, you can test as many webdriver as you want.
Have a look at this example: https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest
Full Disclosure: I am one of the developers of SpecFlow & SpecFlow+
Use scenario outlines and this tool if you want to use browsers as tags:
https://github.com/unickq/Unickq.SeleniumHelper
I know you can easily do this with Selenium IDE.
But I would like to be able to export the test script programatically. That is to convert this
to this
by doing something like:
seleniumIDE_API.export(htmlFilePath, outputPath, OutputTypes.CSHARP_NUNIT_WEBDRIVER);
The reason I want this is to reduce the number of steps that has to be taken when creating tests. So all you have to do is create the test and drop the html file into some directory.
I don't think this is recommended to spend effort for. From Firefox 55 onwards, Selenium IDE will no longer work.
Try to use different recorders for this purpose. Cognizant QA solution Cognizant Intelligent Test Scripter does the same thing. It records and replays the action. I don't think a export would be possible, but surely you can by tweaking the code.
I cannot use the selenium IDE as i'm not allowed to use firefox. The website that i need to test doesnt have ID's for every tag. So i cannot even use that. My question is, how else do i use the locator object? Thats the argument in selinium.click or selinium.clickAt.
There are many other ways http://docs.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-api-commands-and-operations
Just like with the IDE; by CSS, by xPath, by name, by class ...
driver.findElements(By.xpath("//input"));
Steps:
Record 5 Test Cases.
Open Test suite.
Select the 1st case and goto Option --> Format --> JUnit4 (Converted properly)
Copy the source.
Select the 2nd Case.
It shows Junit and HTML all mixed up. If I close the selenium IDE and open it again it allows me to convert 1 case. i.e i need to restart the IDE for each case conversion. It seems to be a bug in Selenium IDE.
I need to convert hundreds of cases. Are there any alternate method to convert cases quickly?
Thanks in advance!
Selenium now shows that it does not recommend changing the format from HTML to copy paste it. It recommends instead to export them as new files, which does work fine. The problem with this, and with what you were doing, is that it is quite slow. However, somebody (not me) created an addon to help with batch exporting of IDE files into whatever format the IDE supports. I only tested it with TestNG, but it worked like a charm for me. Download link: https://addons.mozilla.org/en-US/firefox/addon/test-suite-batch-converter-sel/
How can you create multiple test cases for selenium RC using eclipse?
Evaluate a test framework, such as TestNG or JUnit. Based on these frameworks, you can build data driven tests, or a number of scripts, executed sequentially (or in parallel) using Ant.
You can try implementing a Data Provider into your tests and having the test methods be executed for the different values in it.
For example, you can have a CSV file with the different test parameters for each case and execute "each line".
I would recommend the latest Junit version and the latest Selenium 2 Version.
Those two together make it pretty easy to get going.
TestNG has better support for all test automation requirements. Try it.
Find more on how to do this here http://aboutselenium.blogspot.com/2011/10/building-automation-framework-with-ant.html