TestNG reporting - selenium

I want to Email my TestNG report to other users as well but when they are clicking on the screenshot link. They are not able to see the screenshot as it is stored in my local machine.
String SaveandReturn = ScreenShot.takeScreenShot("SaveAndReturnverification");
Reporter.log("<a href=\"" + SaveandReturn + "\"><p align=\"left\"> Add Sub Service in LFA Services screenshot at " + new Date()+ "</p>");
}
How can I attach the screenshot so that other people can also view the report.

If you are able to implement the following it would be quite useful if you have a lot of people who need to see the results of the tests at a given time, its what I have implemented in my enviornment.
I have created a web server using XAMPP. I then created a web page which has links to all the TestNG reports.
Might not suit your environment but its a good solution if it does.

I would suggest you to go for Extentreports which has good UI when compared to TestNG. it is an extended version of testNG reporting framework.
It also suits your requirement of sending the screenshots by keeping at local if you have hosted in your local machine using MongoDB.

Related

How to write gherkin scenario directly on Xray test case creation page

How do I get the below options like test details (to add BDD scenario) when creating test cases?
enter image description here
On my one it just looks like this. I have imported the 6 test type from Xray into my JIRA project. Is there more configuration that needs to be done? Once created, I can click on the test case and insert the scenario there, but surely I should be able to do this whilst creating in the first place. I can't find anything on this new layout online.
enter image description here
If you are using Xray on Jira server/Data Center, then you can fill out the Cucumber Scenario details right away as mentioned here.
If you're using Jira Cloud then you can't do this due to current limitations on Jira/Atlassian side; in this case, you have to create the Test first and then edit the scenario/scenario outline from the Test issue screen.

Using Selenium IDE for a test-case which includes backend call?

I add a new category in the admin panel and want to ensure that the category is available in the dropdown on the user's part of the website. Recorded test in the Selenium IDE works fine. But the thing is, the task that I execute is of course not a pure frontend thing - the category is saved in the database and is loaded from it to show it to the user. So if something goes wrong on the database-side, the test will fail.
My question is: is it bad practice to do such tests that depend on backend-behavior ? Should I go for Selenium Webdriver ?
If you use Selenium Webdriver, your test will not change in a main thing. It still will check database side. Selenium Webdriver is just anouther tool for testing that is more flexible and allows to make more complex test then in Selenium IDE.
I don't think that it is bad practice, because it is just one of the tests that chould be executed to enshure you that this part of your project works correctly. In this case I would check back-end part(get all categories from DB or admin's panel and check that there is no extra or missing ones) and than check user's panel(all categories are the same as set in DB and admin's panel).

how to take a screenshot of the entire webpage?

I am very new to all the technologies so can any one suggest what tool can I use to take screenshot of entire web page along with the URL.
These screenshots would be taken every quarterly, and after a quarter it will be compared with the last quarter's screenshot. It will be compared on the basis of major changes made on web page
I have to do this for 100's of domains.
Please suggest
1.Tool to take screen shot
2.How to compare.
Any suggestion appreciated.
Selenium & imacro can help u taking the browser screenshot
There is no such tool in existence which can perform above specified tasks.
You can easily find tools for capturing screenshots, but you will be not able to view changes done after a specified time. You need to develop a crawler to perform this task. You can pick PHP or .net as technology to handle this task.
In case, you have any query, you can let us know anytime.
Thank You
You can use below selenium code
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
Where driver is Webdriver object (e.g. WebDriver driver=new FirefoxDriver();)
Here is an example of iMacros solution.
http://wiki.imacros.net/SCREENSHOT
URL GOTO=http://www.iopus.com/imacros/home/v9/home.asp
SCREENSHOT TYPE=Page FOLDER=* FILE=*
SCREENSHOT TYPE=Browser FOLDER=* FILE=*
You can take screenshot using selenium web driver code , See below :
http://www.ontestautomation.com/how-to-create-screenshots-in-your-selenium-webdriver-tests/

Test case management and selenium?

Just wondering how other people manage their test cases that are written for selenium test automation? I've been investigating maybe integrating with testlink to show the results and all, but I already have Jenkins set up for my environment and running my tests. What I'm really looking for is some way to nicely document my tests, like what steps each test performs for non-programmers.
I'm using Selenium with python, and Jenkins to run the tests.
I've tried two ways:
1) You can use Cucumber to write test steps like this:
#sanity #home_page #test_628
Scenario: Launch Support FAQs & Guides from Home cog
Given I navigate to Home page
When I click "Support" user logo link
Then I should see Support FAQs & Guides app launched
Each step written on Gherkin language (Given, When, Then) you can implement then using Selenium (I have to write on Ruby now, so I use Watir instead of Selenium).
see https://github.com/cucumber/cucumber/wiki/Python
2) But before that I used Robot Framework + Python + Selenium + Jenkins.
You can write test like this:
Go To Google Page [Documentation] Go to google page and search something
Open Browser to Google Page
Input Search selenium
Submit Search
This is done using human readable keywords. It prints very nice reports and can be easily integrated with Jenkins.
see http://www.wallix.org/2011/07/26/how-to-use-robotframework-with-the-selenium-library/
To document a test case and that too for non-programmers, Behaviour-Driven Development (BDD) is the best way. Some of the BDD tools are Cucumber, JBehave etc.
For example, lets assume the we have an website to manage some employees and we have a test case in which admin wants to add a new employee.
So the above test case can be documented using Cucumber as shown below:
Feature: Admin : Employees : Add Employees : Add Employee Details
Scenario: Verify that admin user is able to add new employee
Given Joe is an admin user
Given Joe is logged into the admin account
When Joe clicks "Add Emplyee" button
And Joe enters "Test Employee" in "Employee Name" text box
And Joe enters "12/05/1988" in "Birth Date" text box
And Joe selects "Male" from "Gender" radio button
And Joe clicks on "Submit" button
Then Joe gets message that says "Employee is added successfully."
The above test case can be easily understood by a non-programmer and he can perform each steps as performed by the test.
Hierarchy of folders for this test case will be feature/Admin/Employees/Add Employees/Add Employee Details
Hope this helps :)
I don't use TestLink. I think it is much easier to use a Jenkins job server to schedule my tests and it can do nearly the same job as testlink can and, im my opinion, is easier for other people to understand. I check my test code into Subversion and Jenkins checks out the latest code before it runs my tests. Jenkins has plugins to handle JUnit and TestNG report formats and has email capability, etc.
NOTE: The only Gotcha is that if you use RemoteWebDriver and a grid, the tests need to be ran by a Jenkins slave server that is running in a foreground process ( not in the background as a service). This is the case at least on Windows and might not be a problem on Linux.
We use Cucumber to create readable tests and have the results pulled back to Enterprise Tester, our Test Management platform. We can also pull Selenium tests and jUnit tests from Jenkins into Enterprise Tester, also for visibility across both manual and automated tests and traceability back to stories / requirements.

Excluding Selenium-server URL in JMeter Proxy Server

I'm currently trying to get JMeter to record the steps my selenium tests so I can perform load testing with the same tests. The steps are recorded fine but my problem is that its also recording the steps performed in the "selenium-server" window (i.e. the extra windows that pop up when selenium runs).
I believe if I add something like *selenium-server* to the "URL Patterns to Exclude" List then it will ignore all these steps but they keep recording for every pattern I've tried.
Can someone please tell me the pattern which will lead to these steps getting ignore?
An example url is: /selenium-server/driver/?retry=true.
Thanks.
Try adding the following to 'URL Patterns to Exclude'
^/selenium-server/.*
If you're trying to use your Selenium tests to generate load, you might also want to look at BrowserMob. It's a company I started that runs actual Selenium browsers en masse in the cloud.
You could try to add the following to 'URL Patterns to Exclude'
.*/selenium-server/.*