The way to set automation testing

  • 173 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
173
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
2
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. The way to set automation testing in Septeni Technology Presenter: Nguyễn Thị Hiền – SQA at Septeni Technology Hanoi, 2014/04/28
  • 2. Introduction of us • Septeni Technology CO., LTD is the strategic company in Hanoi of Septeni group so that we develop web services of our own in high level and speed. • PYXIS is the software solution for managing Facebook Ad Campaigns and achieving the highest performance from your ads that is developed based on Web application platform.
  • 3. Topic introduction • At present, we are operating automation test for our PYXIS that are developed on Web application platform. • We are using Selenium Webdriver (used language: Java) integrating with testNG to write automation test cases. • Besides, we also use CI environment – Jenkins that is set up and configured by our developers to run test cases automatically everyday.
  • 4. Outline 1. Summarizing about automation test at Septeni Technology. 2. Create test cases by Selenium Webdriver integrating with testNG. 3. Run test cases automatically by using CI environment (Jenkins). 4. Send email notification to inform test results.
  • 5. 1. Automation test in Septeni Technology SQA computer + Create test scripts based on manual testcases + Using Selenium Webdriver integrating with testNG. + create and compile java file by using Eclipse and JAVA 1.7 Septeni technology server Get test scripts files to run test automatically Jenkins Test results(Jenkins reports) Email notification
  • 6. 2. Create test cases by Selenium Webdriver integrating with testNG Why Selenium Webdriver? Selenium Webdriver Selenium RC 1. Interact with browser directly undirectly 2. Interact with page’s elements in a more realistic way not a realistic way 3. API simple complicated 4. Can support the headless HtmlUnit browser? yes no 5. Can connect to DB to execute test? yes yes
  • 7. 2. Create test cases by Selenium Webdriver integrating with testNG Why TestNG? 1. TestNG can generate reports based on our Selenium test results. - WebDriver has no native mechanism for generating reports. - TestNG can generate the report in a readable format like the one shown below. 2. Annotations are easier to understand 3. Test cases can be grouped more easily 4. Parallel testing is possible
  • 8. 2. Create test cases by Selenium Webdriver integrating with testNG 1. Choose testcases from the manual testcases to implement automating with Webdriver: 2. By extracting from this test case, we can design our test scenario automatically by Webdriver.
  • 9. 2. Create test cases by Selenium Webdriver integrating with testNG Test scenario:  Get Cost report value at Dashboard screen – screen cost Query from DB to get expected cost report value - DB cost screen cost = DB cost test passed screen cost != DB cost test failed
  • 10. 2. Create test cases by Selenium Webdriver integrating with testNG 1. Create test case @BeforeTest: create a function to open brower and go to PYXIS-Dashboard screen @BeforeTest public static void openWeb(){ goToDashBoard(); } @Test: create a function to implement test case  Get Cost report value at Dashboard screen – screen cost  Get Cost report value from DB – DB cost  Compare screen cost and DB cost
  • 11. @Test public static void CheckCost() throws InstantiationException,IllegalAccessException, ClassNotFoundException, SQLException { // query to get cost value from db String query = "SELECT IFNULL(SUM(adrep.spent),0) AS cost " + "FROM ad_reports_" + profileId + " adrep " + "INNER JOIN ads ON adrep.ad_id = ads.ad_id " + "WHERE ads.type IN (1,2,4,12)" + " and report_date BETWEEN " + getDate() + ";"; ResultSet result = (ResultSet) getResultFromDB(query); // Get cost value from db String costDB = "", realCost = ""; costDB = getValueFromDb(result, "cost"); realCost = driver.findElement(By.id("real_costs")).getText(); realCost = realCost.replaceAll("[^0-9]", ""); //Check cost at DB comparing with real cost Assert.assertEquals(costDB, realCost); }// end of checkCost
  • 12. 2. Create test cases by Selenium Webdriver integrating with testNG @AfterTest: create a function to close browser after testing. @AfterTest public static void closeBrowser(){ driver.quit(); } 2. Convert to testNG <suite name="Suite" parallel="none"> <test name="Test"> <classes> <class name="checkDB.checkDB"/> </classes> </test> <!-- Test --> </suite> <!-- Suite -->
  • 13. 2. Create test cases by Selenium Webdriver integrating with testNG Result after running test:
  • 14. 3. Run test cases automatically by using CI environment (Jenkins) Why Jenkins? 1. Make is simpler and more convenient to run test case at server everyday automatically. 2. Can view result console easier and more convenient. 3. Provide a better view for manager and reporter to control the status of testing. 4. Sending email notification to concerned people.
  • 15. 3. Run test cases automatically by using CI environment (Jenkins)  Create new job at Jenkins to run test cases automatically Jenkins model: Jenkins Job Build Post build Email notification Export testNG result Export html report
  • 16. 3. Run test cases automatically by using CI environment (Jenkins) Report result after running test by Jenkins: 1. Html report:
  • 17. 4. Send email notification to inform test results • Define Recipient List • Content type: HTML because if using html we can show our test results clearly.
  • 18. Thanks for your listening!
  • 19. Summary 1. Automation test at Septeni Technogy by using Webdriver integrating with testNG 2. Running test cases everyday automatically by using CI environment – Jenkins. 3. Export test result. 4. Send email notification via email.