Groovy 在Katalon Studio中执行Junit测试时获取内部错误
我必须将小黄瓜与Katalon Studio集成,因此我在Groovy中创建了一个带有基本场景的测试项目,并在Katalon Studio中导入了该项目。当我在Katalon Studio中执行Junit测试时,它抛出了一个错误:在:启动TestGroovy期间发生了一个内部错误。 java.lang.NullPointerException。我已经添加了必要的库 注意:测试在Eclipse中成功通过 在Katalon上运行Junit测试还需要什么 TestGroovy.groovyGroovy 在Katalon Studio中执行Junit测试时获取内部错误,groovy,junit4,cucumber-junit,katalon-studio,Groovy,Junit4,Cucumber Junit,Katalon Studio,我必须将小黄瓜与Katalon Studio集成,因此我在Groovy中创建了一个带有基本场景的测试项目,并在Katalon Studio中导入了该项目。当我在Katalon Studio中执行Junit测试时,它抛出了一个错误:在:启动TestGroovy期间发生了一个内部错误。 java.lang.NullPointerException。我已经添加了必要的库 注意:测试在Eclipse中成功通过 在Katalon上运行Junit测试还需要什么 TestGroovy.groovy packa
package groovyKat
import org.junit.runner.RunWith
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "Features"
,glue= ["groovyKat"]
)
class TestGroovy {
}
TestGroovyStepDef.groovy
package groovyKat
import java.util.concurrent.TimeUnit
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver
import cucumber.api.java.en.Given
import cucumber.api.java.en.Then
import cucumber.api.java.en.When
class TestGroovyStepDef {
static WebDriver driver;
@Given('^A User is on Demoqa\\.com$')
void a_User_is_on_Demoqa_com() throws Throwable {
System.setProperty('webdriver.gecko.driver','D:/geckodriver/geckodriver.exe');
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get('http://www.store.demoqa.com');
}
@When('^User clicks on MyAccount link$')
void user_Clicks_on_MyAccount_link() throws Throwable {
driver.findElement(By.xpath('.//*[@id="account"]/a')).click();
}
@When('^User enters username "(.*)" and password "(.*)"$')
void user_enters_username_and_password(String username,String password) throws Throwable {
driver.findElement(By.id('log')).sendKeys(username);
driver.findElement(By.id('pwd')).sendKeys(password);
driver.findElement(By.id('login')).click();
}
@Then('^Message displayed Login Successfully$')
void message_displayed_Login_Successfully() throws Throwable {
System.out.println('Login Successfully');
}
}
testSample.feature
Feature: Login feature
Scenario: Successful Login with Valid Credentials
Given A User is on Demoqa.com
When User clicks on MyAccount link
And User enters username "xxxxxx" and password "xxxxxxx"
Then Message displayed Login Successfully
在当前版本的Katalon 5.4.1中,无法运行此脚本,该脚本作为JUnitCucumber测试实现 你必须为Katalon Studio重写你的测试
请参阅请共享您的脚本代码和相关错误日志,并提供问题详细信息记录器仅集成selenium。如何将Cucumber集成到katalon脚本中?