标签: data-driven-tests

Apache POI,CREATE_NULL_AS_BLANK 导致错误

现在我正在学习用 Java 编写数据驱动测试的教程。我的 IDE 是 IntelliJ 社区版,以下是我的代码

package utility;

import config.Constants;
import executionEngine.DriverScript;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class ExcelUtils {
    private static XSSFSheet ExcelWSheet;
    private static XSSFWorkbook ExcelWBook;
    private static XSSFCell Cell;
    private static XSSFRow Row;

    //This method is to set the File path and to open the Excel File
    //Pass Excel Path and Sheet Name as Arguments to this method
    public static void setExcelFile(String Path) throws Exception { …
Run Code Online (Sandbox Code Playgroud)

java apache intellij-idea data-driven-tests apache-poi

3
推荐指数
1
解决办法
7908
查看次数

如何检查文件是否存在于 Groovy 脚本中

Workbook aWorkBook = Workbook.getWorkbook(new File("C:\\Users\\Response.xls"));     
WritableWorkbook workbook1 = Workbook.createWorkbook(new File("C:\\Users\\Responses.xls"), aWorkBook);
Run Code Online (Sandbox Code Playgroud)

我正在 SOAP UI 中使用 Groovy 脚本进行数据驱动测试。以上是创建新文件然后将 PASS 或 FAIL 结果写入该 excel 的代码部分。假设如果有 5 个测试用例,那么我只想在第一个循环(第一个测试用例)中创建一次新文件,然后在下一个循环中它应该打开现有文件。但目前它正在每个循环中创建新文件并覆盖数据和 PASS 结果仅显示最后一个测试用例。任何人都可以帮助解决这个问题吗?

groovy data-driven soapui data-driven-tests

3
推荐指数
1
解决办法
2万
查看次数

在 Cypress 中对不同数据集运行相同的测试

我想在 Cypress 中运行一个简单的测试场景,其中用户通过输入用户名和密码登录,然后单击提交按钮。我想用不同的用户名和密码组合来测试它。在cucumber-java 中这很容易。您可以编写场景大纲并添加这些不同的数据集(用户名和密码组合)。

谁能告诉我如何在 cypress 中实现这一目标?

javascript data-driven-tests cypress

2
推荐指数
1
解决办法
3639
查看次数

如何将列表列表作为参数提供给Robot Framework测试模板

我有"do any combination"测试的模板关键字,其中$ {labels}是一个列表,$ {versions}是一个列表列表:

TT Process Instance Version Search
    [Arguments]     ${labels}    ${versions}
    Login
    Process Instance Version Search     ${labels}    ${versions}
Run Code Online (Sandbox Code Playgroud)

然后我创建一个测试套件文件并放置以下内容:

*** Settings ***
Test Template   TT Process Instance Version Search


*** Variables ***
@{ProcessVersions} =   ${Process0}     ${Process1}     ${Process2}
@{SingleVersion} =  ${Process2}
@{Process0} =   1   2
@{Process1} =   3   test_version
@{Process2} =   1

@{SingleProcessLabel} =  Label1
@{ProcessLabels} =  Label1     Label2   Label3

    *** Test Cases ***                                     
Single Instance Version for a Single Process     ${SingleProcessLabel}   ${SingleVersion}
Distinct Instance Versions for Multiple Processes …
Run Code Online (Sandbox Code Playgroud)

list data-driven-tests robotframework

1
推荐指数
1
解决办法
1万
查看次数

如何使用groovy在soap ui中发送多个请求

我必须在soap ui中使用variable.as运行xml请求.我知道使用groovy脚本是可能的.我的变量($ variable)应该是这样的:

for (i = 0; i < 5; i++) {
createResult(34620000+i)
}
Run Code Online (Sandbox Code Playgroud)

请求看起来像:

SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:xmethods-delayed-quotes">
<SOAP-ENV:Body>
 <wq:test>
  <Date xsi:type="xsd:string">2015-01-26</Date>
  <Data ..."$variable"...</Data>
 </wq:test>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

有人可以帮我发送这样的请求.或者可能有另一种方式发送多个请求?

xml groovy soapui data-driven-tests

0
推荐指数
1
解决办法
6035
查看次数

我正在尝试从excel工作表中获取数据,并将这些测试数据传递到登录名和密码字段中,但出现以下错误

错误:

失败:cptoadsLogin org.testng.TestNGException:数据提供程序试图传递2个参数,但是com.toads.Script.LoginDemo#cptoadsLogin方法在org.testng.internal.Invoker.injectParameters(Invoker.java:1225)处采用0 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)上的org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1118)org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)在org.testng的org.testng.SuiteRunner.runTest(SuiteRunner.java:359)的org.testng.TestRunner.run(TestRunner.java:624)的org.testng.TestRunner.privateRun(TestRunner.java:774)处。 org.testng.SuiteRunner.privateRun(SuiteRunner。)上的SuiteRunner.runSequentially(SuiteRunner.java:354)org.testng.SuiteRunner.run(SuiteRunner.java:261)处的org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)处的org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)处的java:312) org.testng.TestNG.run(TestNG.java:1048)在org.testng.TestNG.runSuitesLocally(TestNG.java:1140)在org.testng.TestNG.run(TestNG.java:1048)在org.testng.remote org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)的org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)的.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)在org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)在org.testng.TestNG.runSuitesLocally(TestNG.java:1140)在org.testng.TestNG.run(TestNG)的SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) .java:1048),位于org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132),位于org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236),位于org.testng.remote.RemoteTestNG.main( RemoteTestNG.java:81)在org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)在org.testng.TestNG.runSuitesLocally(TestNG.java:1140)在org.testng.TestNG.run(TestNG)的SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) .java:1048),位于org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132),位于org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236),位于org.testng.remote.RemoteTestNG.main( RemoteTestNG.java:81)org.testng.remote.RemoteTestNG.main上的initAndRun(RemoteTestNG.java:236)(RemoteTestNG.java:81)org.testng.remote.RemoteTestNG.main上的initAndRun(RemoteTestNG.java:236)(RemoteTestNG.java:81)

页面对象:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;

public class ToadsLogin {

    @FindBy(how=How.XPATH,using="//input[@id='Username']")
    WebElement username;

    @FindBy(how=How.XPATH,using="//input[@id='Password']")
    WebElement password;

    @FindBy(how=How.XPATH,using="//button")
    WebElement loginbtn;

    public ToadsLogin(WebDriver driver)
    {
        PageFactory.initElements(driver, this);
    }

    public void unpwd(String un,String pwd)
    {
        username.sendKeys("un");
        password.sendKeys("pwd");
    }

    public void clikonLogin()
    {
        loginbtn.click();
    }
}
Run Code Online (Sandbox Code Playgroud)

TestNG脚本:

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.toads.PoM.ToadsLogin;
import com.toads.lib.ExcelDataConfig;

public class LoginDemo extends SuperTestNG {

    @Test(dataProvider="toadsLogin")
    public void cptoadsLogin() throws Exception
    { …
Run Code Online (Sandbox Code Playgroud)

java testng selenium data-driven-tests selenium-webdriver

0
推荐指数
1
解决办法
683
查看次数