Selenium中的继承未显示正确的测试计数

时间:2016-05-14 01:00:43

标签: inheritance selenium-webdriver

我试图用Selenium测试我的继承技巧。创建名为MailAccess的包后,我在MailAccess包下有3个类 -

  1. VisitPage类(主要)
  2. VerifyTitle类(扩展VisitPage)
  3. VerifyUsername类(扩展了VerifyTitle)

    公共课VisitPage {         public static FirefoxDriver f = new FirefoxDriver();

            @Test
        public void testURL() {
            f.get("https://www.mail.com");
        }
    
    
    public class VerifyTitle extends VisitPage {
    
        @Test
        public void testTitle(){
    
            super.testURL();
            String title=f.getTitle();
            Assert.assertTrue(title.contains("email"));
            System.out.print(title);
        }
    }
    
    public class VerifyUsername extends VerifyTitle {
    
        @Test
        public void testUserName(){
    
            super.testTitle();
            f.findElement(By.id("login-button")).click();
            f.findElement(By.id("login-email")).sendKeys("jnuit11%mail.com");
    
            //code below to get sendKeys value
            WebElement w= f.findElement(By.id("login-email"));
            String emailID= w.getAttribute("value");
            System.out.println("Email id used " + emailID);
    
            if(!(emailID).contains("@")){
                System.out.println("Invalid character");
            }
        }
    }
    
  4. 问题:当我运行它时(右键单击包名称>运行为> TestNG Test),这就是我看到的内容

    Free email accounts | Register today at mail.comEmail id used jnuit11%mail.com
    Invalid character
    PASSED: testUserName
    PASSED: testURL
    PASSED: testURL
    PASSED: testURL
    
    ===============================================
        Default test
        Tests run: 4, Failures: 0, Skips: 0
    

    问题:为什么我只有3和3的4次测试与testURL同名?

0 个答案:

没有答案