Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Anne Quinkenstein
Anne Quinkenstein

Posted on • Edited on

     

Building a Selenium Framework

Create a Maven Project

1. Create new Maven Project

-> Maven - new Project - maven-quickstart - GroupID + ArtifactID

2. Add all Dependencies in pom.xml

Add from Maven Repro: Selenium & TestNG

3. Create Base and utility functions

Create base Class in main/java & add Browser Invocation

  • create a resources Package in main/java
  • create a file "data.properties" to store data in a central place store things likebrowser = chrome
  • envoce it in the base.file
Propertiesprop=Properties();FileInputStreamfis=newFileInputStream("//home//helloworld//Documents//Code//Ecplise//SampleProject//E2EProject//src//main//java//SampleProject//data.properties");prop.load(fis);Stringbrowsername=prop.getProperty("browser");
Enter fullscreen modeExit fullscreen mode

Find absolute path of data.properties in rightclick Properties
put it in the FileInputStream

if(browserName=="chrome"){System.setProperty("webdriver.chrome.driver","C://home//helloworld//chromedriver");driver=newChromeDriver();}elseif........// instead of former implicitly Wait:newWebDriverWait(driver,Duration.ofSeconds(10));returndriver;
Enter fullscreen modeExit fullscreen mode

4. Organizing Page objects

  • Adding Tests
  • Datadriving/ Prameterizing Tests
  • Converting into TestNG Framework
  • TestNG Listeners
  • Screenshot on Test Failures
  • Creating Excellent HTML reports for Test Results
  • Jenkins Continuous Integration

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Software Engineer (Java)
  • Location
    Berlin, Germany
  • Work
    Testautomation Engineer at Telecolumbus
  • Joined

More fromAnne Quinkenstein

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp