Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium TestNG在Eclipse中不执行其他函数_Selenium_Maven_Testng - Fatal编程技术网

Selenium TestNG在Eclipse中不执行其他函数

Selenium TestNG在Eclipse中不执行其他函数,selenium,maven,testng,Selenium,Maven,Testng,说明 大家好,我是Selenium的新手,正在构建第一个项目,所以如果在问这个问题时遗漏了任何关键信息,我表示歉意。我正在尝试从电子表格中读取数据并登录到facebook 当我运行LoginTest时,TestNG不会执行我的类executeKeywords中的一个,看起来它跳过了这个类并运行了所有其他的东西,甚至成功地生成了报告。我在控制台中没有看到具体的错误。代码见附件 错误日志: 1.无效的输入url:platform:/plugin/org.eclipse.team.cvs.ui/ico

说明

大家好,我是Selenium的新手,正在构建第一个项目,所以如果在问这个问题时遗漏了任何关键信息,我表示歉意。我正在尝试从电子表格中读取数据并登录到facebook

当我运行LoginTest时,TestNG不会执行我的类executeKeywords中的一个,看起来它跳过了这个类并运行了所有其他的东西,甚至成功地生成了报告。我在控制台中没有看到具体的错误。代码见附件

错误日志:

1.无效的输入url:platform:/plugin/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gif 2.无法解析插件“org.eclipse.team.cvs.ui”。 3.无效的输入url:platform:/plugin/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gif

依赖项工具:

马文

操作系统 窗户

这是我的登录测试代码

Package com.qtpselenium;
           


import java.util.Hashtable;

import org.testng.SkipException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.qtpselenium.driver.DriverScript;
import com.qtpselenium.reports.ExtentManager;

public class LoginTest {
    String testcase = "Login";
    String path = System.getProperty("user.dir")+"\\src\\test\\resources\\Test Cases.xlsx";
    Xls_Reader xls = new Xls_Reader(path);
    ExtentReports rpt;
    ExtentTest test;
    
@BeforeMethod
    
    public void init() {
        String reportPath = System.getProperty("user.dir")+"\\reports\\";
        rpt = ExtentManager.getInstance(reportPath);
        test = rpt.createTest(testcase);        
    }
    
@AfterMethod
    
    public void quit() {
        rpt.flush();        
    }
    
@Test(dataProvider = "getData")
    public void doLogin(Hashtable <String,String> data) {
     
           if (DataUtil.isSkippable(xls,testcase )||data.get("Runmode").equals("N")) {
                test.log(Status.SKIP,"Skipping the test case as Runmode is N");
                throw new SkipException  ("Skipping the test case as Runmode is N");            
           }
        
        test.log(Status.INFO, "Starting Test");
        DriverScript Ds = new DriverScript(test); 
        Ds.executeKeywords(testcase, xls, data);
        test.log(Status.PASS, "Login Success");
        }           
    
@DataProvider
    public Object[] [] getData() {
    return DataUtil.getTestData(xls, testcase);
}
}
package com.qtpselenium.driver;

import java.util.Hashtable;

import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.qtpselenium.Xls_Reader;
import com.qtpselenium.keywords.AppKeywords;


    public class DriverScript {
        
    ExtentTest test;
        
    public DriverScript(ExtentTest test) {
        
    this.test=test;     
    }

                
    public void executeKeywords(String testcase, Xls_Reader xls, 
    Hashtable<String, String> testData) {
        
    System.out.println(System.getProperty("user.dir"));
    AppKeywords app = new AppKeywords(test);
        
    int rows = xls.getRowCount("Keywords");
    System.out.println(rows);
    
    for(int rnum=2;rnum<=rows;rnum++) {
                    
        String TCID = xls.getCellData("Keywords","Tcid",rnum);
        if (TCID.equals(testcase)){
            String Keyword = xls.getCellData("Keywords","Keyword",rnum);
            String ObjectKey = xls.getCellData("Keywords","Object",rnum);
            String Key = xls.getCellData("Keywords","Data",rnum); 
            String data = testData.get(Key); //Hashtable testData
            
            if (Keyword.equals("Open Browser"))
                app.Openbrowser(data);
            else if (Keyword.equals("Navigate"))
                app.Navigate(ObjectKey);
            else if (Keyword.equals("Type Username"))
                app.TypeUsername(ObjectKey, data );
            else if (Keyword.equals("Type Password"))
                app.TypePassword(ObjectKey, data);
            else if (Keyword.equals("Click"))
                app.Click(ObjectKey);
            else if (Keyword.equals("Validate Login"))
                app.ValidateLogin(ObjectKey);
            
            
        }
        }
    
        }
    
        }
Package com.qtpselenium;
导入java.util.Hashtable;
导入org.testng.SkipException;
导入org.testng.annotations.AfterMethod;
导入org.testng.annotations.BeforeMethod;
导入org.testng.annotations.DataProvider;
导入org.testng.annotations.Test;
导入com.aventstack.extentreports.extentreports;
导入com.aventstack.extentreports.extendettest;
导入com.aventstack.extentreports.Status;
导入com.qtpselenium.driver.DriverScript;
导入com.qtpselenium.reports.ExtentManager;
公共类登录测试{
字符串testcase=“Login”;
字符串路径=System.getProperty(“user.dir”)+“\\src\\test\\resources\\testcases.xlsx”;
Xls\U读卡器Xls=新的Xls\U读卡器(路径);
扩展端口rpt;
延伸试验;
@预处理法
公共void init(){
字符串reportPath=System.getProperty(“user.dir”)+“\\reports\\”;
rpt=ExtentManager.getInstance(reportPath);
test=rpt.createTest(testcase);
}
@后置法
公开作废退出(){
rpt.flush();
}
@测试(dataProvider=“getData”)
公共void doLogin(哈希表数据){
if(DataUtil.isSkippable(xls,testcase)| | data.get(“运行模式”).equals(“N”)){
log(Status.SKIP,“在运行模式为N时跳过测试用例”);
抛出新的SkipException(“当运行模式为N时跳过测试用例”);
}
test.log(Status.INFO,“开始测试”);
DriverScript Ds=新的DriverScript(测试);
执行关键字(testcase、xls、data);
test.log(Status.PASS,“登录成功”);
}           
@数据提供者
公共对象[][]获取数据(){
返回DataUtil.getTestData(xls,testcase);
}
}
这是我的DriversScript代码

Package com.qtpselenium;
           


import java.util.Hashtable;

import org.testng.SkipException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.qtpselenium.driver.DriverScript;
import com.qtpselenium.reports.ExtentManager;

public class LoginTest {
    String testcase = "Login";
    String path = System.getProperty("user.dir")+"\\src\\test\\resources\\Test Cases.xlsx";
    Xls_Reader xls = new Xls_Reader(path);
    ExtentReports rpt;
    ExtentTest test;
    
@BeforeMethod
    
    public void init() {
        String reportPath = System.getProperty("user.dir")+"\\reports\\";
        rpt = ExtentManager.getInstance(reportPath);
        test = rpt.createTest(testcase);        
    }
    
@AfterMethod
    
    public void quit() {
        rpt.flush();        
    }
    
@Test(dataProvider = "getData")
    public void doLogin(Hashtable <String,String> data) {
     
           if (DataUtil.isSkippable(xls,testcase )||data.get("Runmode").equals("N")) {
                test.log(Status.SKIP,"Skipping the test case as Runmode is N");
                throw new SkipException  ("Skipping the test case as Runmode is N");            
           }
        
        test.log(Status.INFO, "Starting Test");
        DriverScript Ds = new DriverScript(test); 
        Ds.executeKeywords(testcase, xls, data);
        test.log(Status.PASS, "Login Success");
        }           
    
@DataProvider
    public Object[] [] getData() {
    return DataUtil.getTestData(xls, testcase);
}
}
package com.qtpselenium.driver;

import java.util.Hashtable;

import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.qtpselenium.Xls_Reader;
import com.qtpselenium.keywords.AppKeywords;


    public class DriverScript {
        
    ExtentTest test;
        
    public DriverScript(ExtentTest test) {
        
    this.test=test;     
    }

                
    public void executeKeywords(String testcase, Xls_Reader xls, 
    Hashtable<String, String> testData) {
        
    System.out.println(System.getProperty("user.dir"));
    AppKeywords app = new AppKeywords(test);
        
    int rows = xls.getRowCount("Keywords");
    System.out.println(rows);
    
    for(int rnum=2;rnum<=rows;rnum++) {
                    
        String TCID = xls.getCellData("Keywords","Tcid",rnum);
        if (TCID.equals(testcase)){
            String Keyword = xls.getCellData("Keywords","Keyword",rnum);
            String ObjectKey = xls.getCellData("Keywords","Object",rnum);
            String Key = xls.getCellData("Keywords","Data",rnum); 
            String data = testData.get(Key); //Hashtable testData
            
            if (Keyword.equals("Open Browser"))
                app.Openbrowser(data);
            else if (Keyword.equals("Navigate"))
                app.Navigate(ObjectKey);
            else if (Keyword.equals("Type Username"))
                app.TypeUsername(ObjectKey, data );
            else if (Keyword.equals("Type Password"))
                app.TypePassword(ObjectKey, data);
            else if (Keyword.equals("Click"))
                app.Click(ObjectKey);
            else if (Keyword.equals("Validate Login"))
                app.ValidateLogin(ObjectKey);
            
            
        }
        }
    
        }
    
        }
package com.qtpselenium.driver;
导入java.util.Hashtable;
导入com.aventstack.extentreports.extendettest;
导入com.aventstack.extentreports.Status;
导入com.qtpselenium.Xls_阅读器;
导入com.qtpselenium.keywords.AppKeywords;
公共类驱动程序脚本{
延伸试验;
公共驱动器脚本(扩展测试){
这个。测试=测试;
}
public void executeKeywords(字符串测试用例、Xls\u读取器Xls、,
哈希表(testData){
System.out.println(System.getProperty(“user.dir”);
AppKeywords app=新的AppKeywords(测试);
int rows=xls.getRowCount(“关键字”);
系统输出打印项次(行);
对于(int rnum=2;rnum