Page : Abstract Page class - prototype methods, getInstance(PageClass) {return object of page class}
Environment Variables: Config.properties, URL, username, password, browserTestData.xlsx
Utilities: Screenshot, SendMail, Common util, GenericFunctions
TestReport : HTML, TestNG, XML reports, ExtentReportsTechnologies : Java, Selenium webDriver, TestNG, Maven, Apache POI API, log4j API, Jenkins, GIT, GRD, Browsers, OS , VMware
+++++++++++++++++++++++++Framework Steps ++++++++++++++++++++++++++
Eclipse Settings :Go to Preferences->Java->Code Style->Formatter >> click on edit Ctrl+ Shift + O ==> to do all the imports
1. install latest java ( java 11) and in env variable --> set JAVA_HOME (without bin) and java path ( with bin)2. open eclipse --> create new maven project catalog - apache- maven-archetype-quickstart enter groupId - DemoGroupID or com.groupid enter artifactid - DemoArtifactID
3. add dependies in pom.xml file a. <artifactId>selenium-java</artifactId> b. <artifactId>testng</artifactId> and change <scope>compile</scope> ==> why ? c. <artifactId>extentreports</artifactId> d. <artifactId>poi-ooxml</artifactId> e. <artifactId>poi-ooxml-schemas</artifactId> f. <artifactId>poi-scratchpad</artifactId> g. <artifactId>ooxml-schemas</artifactId> h. <artifactId>openxml4j</artifactId> i. <artifactId>poi</artifactId> j. k.
4. add plugins - a. maven-compiler-plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>b. maven-surefire-plugin .... pending
c. resource plugin .... pending ? not sured. assambli plugins .... pending ? not sure.
5. delete dummy packages - DemoGroupID.DemoArtifactID6. create packages com.projectname.qa.base BasePage -class ==> ? is this needed BaseTest -class com.projectname.qa.pages LoginPage -class SignUpPage-class HomePage -class com.projectname.qa.testdata com.projectname.qa.config create file -->config.properties com.projectname.qa.util
7. for each Page class --> extends BasePage class. define the LoginPage variable in the begning of the class so that this can be used throughout the program create default constructor having super() funciton. create object repository for each element available on the page using @FindBy(xpath="") WebElement myElementName initilize the elements with the help of pageFactory create Actions - i.e functions
8. BaseTest class --> WebDriver driver; @BeforeTest public void setup() { ChromeOptions chromeOptions = new ChromeOptions(); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(driver, Duration.ofSeconds(20)); driver.get("http://google.com"); }
@AfterTest public void tearDown() { driver.quit(); }
9. For each Test class--> extends BaseTest class. define the LoginPage , HomePage, its own page ( eg ContactsPage) , testUtil, variable in the begning of the class so that this can be used throughout the program create default constructor having super() funciton. @BeforeMethod public void setup() {initilization(); } create Tests - i.e functions like verifyLoginPageTitleTest()
10. Create runner file -- >> Create --> New >> Sourse folder --> Folder name = src/main/resources --> create a file here named "testng_SmokeTesting.xml"<suite name="RegressionSuit" parallel="true"> <listeners> <listener class-name="com.test.ExtentReportListener" /> </listeners> <test thread-count="5" name="test1"> <groups> <run> <include name=".*smoke.*" /> <include name="regression" /> </run> </groups> <!--<parameter name = "url" value="https://login.yahoo.com" /> <parameter name = "browser" value="chrome" /> --> <classes> <class name="com.test.TestNGFlow" /> <class name="com.test.TestNGFlow2"> <methods> <exclude name="testHomePageTitle" /> <include name="testSearch" /> </methods> </class> </classes> </test></suite>
11.
No comments:
Post a Comment