Selenium Question 3



Q1. How to store screen shorts of errors?

Best policy is first create a new folder for screen shorts
The function name is screen short
Public static void Takescreenshort(String finename) throws IOExceptions{
File scrFile = ((TakeScreenSort)driver).getScreenshortAs(OutputType.File);
FileUtils.copyFile(scrFile, new file(system.getproperty(“User.dir”)+\\screensort+filename+”.jpg));
Before the assertion call the function
Eg.
TestUtil.takescreensort(xpathKey);
Xpath or file name

Q2. System.err.println (“”)

It shows all system error.

Q3. How to email the reports?

Create a method which Zip any folder
It will have infolder and out folder and we have method for it in java.
Create a send mail function having all the send method parameters like port number which accept username and password

Q4. Hybrid frame work Data driven frame work?

We have keywords in hybrid frame word.
In data driven frame work all data come from excel.
We have a core in it which do not have selenium code and we can implement frame work for RC as well as webdriver.
1.      Prepare test suits example :- TestSuites.xlsx
2.      Prepare test cases and test data in excel file.
3.      Introduce the run mode
4.      Make eclipse package, logs,utilpackages,base package having base class,config contain all parameter like login file etc, xls package, package for listener will be used in test NG to report errors.
5.      Put all the xls file in xls package.
6.      Create a config file and OR properties files under config package.
Rules for making hybrid frame work:-

1. First write the primary file. Having information of all test suites 
2. Name of suites xlxs should be same name as name of suit ID in suit.xlxs.
Create test cases for every test module in the separate so we have test case sheet, test step sheet, every test case have a run mode
In test case step keep the same test case ID as test case name.
Keep the test data sheet name same has test case.
Key word in test case step sheet, java code in selenium will use the keyword all keyword have different impact and they are reusable.
We have generic keyword and applicant dependent keyword.
Generic which generic to any website.
3. Make A package for config and OR file also
4. Create a new package for logs file. 
5. Implement the logic to read keywords and test cases in suites.
- Check the run mode of all the test suites if yes then execute the keyword for the test case.

Q5. How selenium RC is different from IDE and web driver

IDE :- IDe exists on Mozilla tools option and we can start recoding from there, here we can run only on mozilla . we can parameterize only using XML.
RC is available on many languages, 1.x old version, it has lot of issues like server stating, we can onlt test web applications.
Webbdriver :- We can test mobile applications also, version (2.X)

Q6. How many ways we can dun RC code?

There are 2 ways

Q7. What is Selenium test case class and setup function.

It’s a stand alone class, its has method like setup which takes up the URL and the browser on which you want to open the URL.
Setup function will initialize default class and default class implement selenium interface.
So setup function creates its object and gives reference to global field called selenium.

Q8. Configure Web driver 

Go to google enter download selenium.
Download it, we will have jar files.
Create a module in eclipses and add the external jars into the current project. 

Q9. What is java doc? 

Documentation related to selenium is known as java doc.
-         Web driver is a interface in selenium.

Q10. How to add firefox driver in web driver.

Webdriver driver = new firefoxDriver();
Driver.get(“http://gmail.com”);
Same way you can add driver of internet explorer and other browsers.

No comments:

Post a Comment