I am running Selenium tests and reports using Grasshopper extent cucumber 7 adaptor. Screen shot implementation is successful in After web hook for failed scenarios.
<dependency>
<groupId>tech.grasshopper</groupId>
<artifactId>extentreports-cucumber7-adapter</artifactId>
<version>1.3.0</version>
</dependency>
I have not used TestNg listeners.
Now, trying to highlight specific web element in the screenshot in case of test failure.
The challenge is , how to get the web element from step definition which caused failure and pass that to web hook, so that using the javascript, element will be highlighted in the screenshot.
Please share your views if anyone has implemented highlight elements functionality using grasshopper cucumber extent report functionality.
Related
I am newbie from Selenium to Protractor. I am extensively using well customized reports such as Extent and ATU reports.
But in protractor i don't find anything apart from basic XML and jasmine2HTML. Is there anyone aware of any third party such as Extent/ATU in selenium for protractor?
If you are using Jasmine as your Protractor driver then you can create a custom reporter that does whatever you want.
https://jasmine.github.io/2.1/custom_reporter.html
I am using "selenium-server-server-standalone-2.44.0.jar" jar file to run my test suite in selenium test runner. It runs well in firefox & chrome, but it gives this info text in the test run report
"info: Selenium 1.0 (Core, RC, etc) is no longer under active development. Please update to WebDriver ASAP"
How do i update to webdriver manually? or How can i get rid of this info text?
The info message you are seeing is essentially warning you that if you continue to use the Selenium RC API, your tests can stop working with more recent releases of browsers. In the upcoming Selenium 3, the RC API will be dropped outright.
There is no way to just get rid of the text, it is a warning message, and it is a valuable warning message.
In order to move on to WebDriver you will need to rewrite all your tests. A suggestion is to start with failing ones first. Start by reading through the official documentation. There is also a link from there pointing you towards more specifics. While you are at it, you might also want to consider refactoring your code to use PageObjects, which was not available in Selenium 1.
Note that while you are migrating your tests, it is quite possible to run a mix of WebDriver and RC tests in the same project.
Point is WebDriver is half finished kind of thing and people not that deeply testing websites, it was useful to have IDE and automate quickly, so this selenium 1.0 works much better and should not be disabled at any point.
I have created a few HTML test suites with Selenium IDE. They are automatically tested and by Jenkins daily. Now, I'm wondering if it is possible to create a screenshot whenever a test fails.
Is it possbile to catch the exeption when the IDE test fails and capture the screen? Or is it only possible with TestNG? If it's only possible with TestNG, how does selenium HTML tests work combined with TestNG?
Kind regards,
Selenium IDE doesn't directly support saving screen shots like this. Check out this other (duplicate) question: Screenshots using Selenium IDE Firefox plugin
selenium ide does not have built in screenshot capabilities, but you can inject raw javascript: "javascript{alert();}" will display an alert. If you can find a way to do it in javascript, you could add the js to selenium ide.
Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC
Hi,
I want to JS code coverage done by my Selenium Test Suite
Is there any code coverage tool which can be integrated with my existing selenium rc framework??
In theory, you can use any coverage tool that instruments JavaScript code to collect coverage data.
For example, you can use JSCoverage either in proxy mode (for real-time instrumentation) or for static instrumentation to run your Selenium tests off the instrumented code.
One technical hurdle could be to devise a way to accumulate coverage data across multiple pages. The coverage tool of your choice could already have support for accumulation of data from multiple page runs. If not, you might have to handle that bit yourself, but this is probably not something trivial.
I have found the solution for my need, there are multiple tools available but I want a tool which can be integrated with my existing automation easily
Tool is JSCover
http://tntim96.github.io/JSCover/
Just run the Server
Run Server
java -cp JSCover-all.jar jscover.server.SimpleWebServer . 8080
Run Proxy Server
java -jar target/dist/JSCover-all.jar -ws --proxy --port=3128 --report-dir=target
Add Proxy in your Webdriver for port specified, 3128 in my case
After execution of test Generate Reports using
((JavascriptExecutor) driver).executeScript("jscoverage_report();");
You can add this line where you exit WebDriver or Test Case
Not aware of a tool for Selenium, but JsTestDriver has a design very similar to Selenium RC (can launch tests from the command line and they are run on a server that drives browsers headlessly) and provides code coverage information.
IntelliJ integrates with JsTestDriver and provides a visual display of coverage information.
Take a look at https://github.com/yui/yuitest/wiki/Code-Coverage
I've integrated this tool in my Selenium tests a time ago. You need a bit of work to gather coverage info before page changes (in any case js trigger a page reload, link etc...)
Once you set up everything, it will fully coverage any js executed while Selenium load and test your website pages.
PS : Even if it was specially adapted for YUI test, you can use it with selenium.
I don't know what you are trying to achieve, but:
Selenium is testing the final output, as seen on the page itself.
So it really does not matter if its PHP, HTML, JSP, ASP or .NET - the Selenium is designed to mimick the end user and click the final application - the final HTML code generated by whatever is under the hood.
Selenium is also not that good for code coverage tests - one piece code can be on many pages - so better approach with selenium is to do the "user" coverage - try to cover all the possible actions which living human could possibly do with your page
There is no particular tool that can integrate with Selenium to do JS coverage. However there are lots of tools which test JS on every page which can tell if the JS that executing on your web page had any errors. This may not ideal solution but on each page you will have the measure of uptil which point JS executed properly on your webpage under test. There are two solutions for that:
1.) JSErrorCollector API: It will integrate directly with Selenium and let you know if there were any error on the page. Can be found at: http://mguillem.wordpress.com/2011/10/11/webdriver-capture-js-errors-while-running-tests/
2.) Full fledged JS coverage tools: There is an excellent list of tools here which will essentially help you in covering JS on on your web pages. Can be found at: JavaScript unit test tools for TDD
Is there a good tutorial or does anyone have experience with setting this up ?
I have a Testsuite.html which launches my tests in one browser atm. This is done in the integration-test lifecycle by the maven selenium plugin. I want to run my tests on multiple browsers. I couldn't find any documentation about selenium grid + maven. I hope somebody can help me.
Thanks in advance, kukudas
Selenium Grid and maven are really not much different than Selenium and maven.
Grid is basically a drop-in replacement for selenium-rc. In our current setup we let the automated build system use Grid. It does this by simply changing the selenium-rc url (which is normally localhost:4444) to the grid's url.
Additionally we specify the browser string (*firefox, *iexplore, *opera or whatever) as a system property on the mvn command line, which we pick up when we initialize the selenium client libraries in our code.
So the way we've done it we basically set up 4 different build projects with different browser strings.