在使用Cucumber运行Selenium的JUnit测试用例时,我得到了“ v2/shares
”。
我已经创建了带有功能文件,步骤定义Java文件和测试运行器Java类的Maven项目。
这是我的功能文件:
cucumber.runtime.CucumberException: java.lang.NoSuchMethodException
我的TestRunner.java:
Feature: Free CRM Login Feature
#without Examples Keyword
#Scenario: Free CRM Login Test Scenario
#
#Given user is already on Login Page
#When title of login page is Free CRM
#Then user enters "naveenk" and "test@123"
#Then user clicks on login button
#Then user is on home page
#with Examples Keyword
Scenario Outline: Free CRM Login Test Scenario
Given user is already on Login Page
When title of login page is Free CRM
Then user enters "<username>" and "<password>"
Then user clicks on login button
Then user is on home page
Then Close the browser
Examples:
| username | password |
| naveenk | test@123 |
| tom | test456 |
和我的pom.xml文件:
/**
*
*/
package com.multiply_automation_testRunner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
/**
* @author BoMaseko
*
*/
@RunWith(Cucumber.class)
@CucumberOptions(
features="C:\\Users\\bomaseko\\eclipse-workspace\\multiply-website-automation\\src\\main\\java\\com\\multiply_automation_features\\multiply-login.feature"
,glue= {"C:\\Users\\bomaseko\\eclipse-workspace\\multiply-website-automation\\src\\main\\java\\com\\multiply_automation_stepDefinitions\\LoginStepDefinition"},
plugin= {"pretty", "html:test-output"})
public class TestRunner {
}
当我尝试执行JUnit测试用例时,出现以下错误消息:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>multiply-website-automation</groupId>
<artifactId>multiply-website-automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>multiply-website-automation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>1.2.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.1.8</version>
</dependency>
</dependencies>
</project>
答案 0 :(得分:0)
尝试更改仅从src到最后一个目录结束的功能的路径:
def f_recursive2(n):
def f_helper(x):
if x <= 0:
return 0
return x + f_helper(x-2)
if n % 2 == 0:
return f_helper(n-1)
else:
return f_helper(n-2)
对于胶水,只需保留测试Java文件所在的目录:
src\\main\\java\\com\\multiply_automation_features