Environment Required
TOOLS: JDK,ANT,Eclipse
- 1. Install ANT
Download: http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.2-bin.zip a. First decompression the apache-ant-1.9.2-bin.zip into your hard disk , I put it in ” D:\apache-ant-1.9.2” b. Make a new environment variable, name “ANT_HOME”. Value “D:\apache-ant-1.9.2” (see picture new_variable.jpg) c. Put %ANT_HOME%/bin; into the beginning of your system variable ; (see system_variable.jpg) d. To verify whether it is successfully installed, open your DOC window, and put ant - version to verify if you have installed successfully or not
- 2. Coding
webDriver + testNG run in different browser: public void Test_InternetExplorer(String webSite) throws Exception { System.setProperty("webdriver.ie.driver", ".\\lib\\IEDriverServer.exe"); DesiredCapabilities capabilities = DesiredCapabilities .internetExplorer(); capabilities .setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); driver = new InternetExplorerDriver(capabilities); baseUrl = webSite; testElementsExists(driver); } @Test @Parameters({ "firefox_dir", "webSite" }) public void Test_Firefox(String firefox_dir, String webSite) throws Exception { System.setProperty("webdriver.firefox.bin", firefox_dir); driver = new FirefoxDriver(); baseUrl = webSite; testElementsExists(driver); } @Test @Parameters({ "webSite" }) public void Test_Chrome(String webSite) throws Exception { System.setProperty("webdriver.chrome.driver", "./lib/chromedriver.exe"); driver = new ChromeDriver(); baseUrl = webSite; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); testElementsExists(driver); }
- 3. testng.xml setting
a. every test case should be added into testng.xml, so that when you right click on ant.xml to run the cases. b. every test case is included like this: <test name="Test basic elements " preserve-order="true"> <classes> <class name="script.TestBasicElements"/> </classes> </test> the 'name' is the one that will appear in left of test results page. classes means all the classes that you write should be run. <class name="path"> this paths is important, only you write correctly, can it be found.
- 4. Run Script Method
a. through the eclipse : Importing the project in eclipse, run ant build script. The XML b. throught the DOC window: - cd e:\workspace\MMR -ant
- 5. see the results
to see the results here: /test-output/Report.html if the test Cases are all passed, the it should be Green ,or there will be error info in the red test cases, then you can click the cases, and check the error.
相关推荐
One expert’s solution to software test automation is to develop testing tools instead of purchasing commercial tools developed with the current inadequate infrastructure. This book is written for ...
Introduction About the Second Edition Who Should Use This Book? What This Book Will Do for You Software Necessary to Use This Book How This Book Is Organized Conventions Used in This Book...
Chapter 1 An introduction to microservices Chapter 2 Application under test Chapter 3 Unit-testing microservices Chapter 4 Component-testing microservices Chapter 5 Integration-testing microservices ...
This guide provides an extensive introduction to Python scripting specifically tailored for Maya users, aiming to equip beginners with the foundational knowledge required to leverage Python ...
This book is an incremental guide that will help you learn and use the advanced features of the Selenium toolset including the WebDriver API in various situations to build a reliable test automation....
Covers important topics such as black, white, and gray box testing, test management, automation, levels of testing, quality models, system and acceptance testing and more Covers video game testing and...
Introduction to SOA Testing Chapter 2. Functional Testing in Detail Chapter 3. Performance Testing of SOA Applications in Detail Chapter 4. Security Testing in Detail Chapter 5. Test Automation in ...
The book starts off with an introduction to the distributed architecture that has been tested and installed in large scale deployments. Implementing and configuring distributed architecture with ...
Part I: Introduction to ActiveX Chapter 1 - What is ActiveX? Chapter 2 - What Can ActiveX Do for You? Part II: ActiveX Automation Servers Chapter 3 - Creating ActiveX Automation Servers Using MFC ...
EBC stands out from other automation tools by offering an object-oriented approach to automation. While many Record & Replay (R&P) tools focus on process-oriented automation, EBC takes a more ...
Chapter 1 Introduction to Google Software Testing 1 Quality≠Test 5 Roles 6 Organizational Structure 8 Crawl, Walk, Run 10 Types of Tests 12 Chapter 2 The Software Engineer in Test 15 The Life of an ...
Manage the introduction of Continuous Delivery into your enterprise Architect software to facilitate Continuous Delivery of new capabilities Table of Contents Part I: Foundations Chapter 1: Continuous...
With this practical guide, network engineers will learn how to program Juniper network devices to perform day-to-day tasks, using the automation features of the Junos OS. Junos supports several ...