2017-11-14 7 views
-2

``자바 스크립트 셋업 - 테스트 러너에서 스텝 정의가 실행되고 있지 않습니다. 주자 클래스, 기능 파일 및 단계 정의의 장소들의 첨부 된 스크린 샷을 찾아주세요 단지 Stepdefinitions테스트 러너에서 스텝 정의가 인식되지 않습니다.

package com; 

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver; 

import cucumber.api.PendingException; 
import cucumber.api.java.After; 
import cucumber.api.java.Before; 
import cucumber.api.java.en.Given; 

public class StepDefinition { 
    WebDriver driver; 
    @Before 

    public void setUp(){ 
     driver=new FirefoxDriver(); 

    } 

    @After 
    public void tearDown(){ 
     driver.quit(); 
    } 

    @Given("^Launch the application$") 
    public void loadUrl() throws Throwable { 
     driver.get("https://www.google.com"); 

     throw new PendingException(); 
    } 




} 
+0

질문 영역 내의 단계 정의를 추가 분석을 위해 텍스트로 붙여 넣는 것을 고려하십시오. – DebanjanB

+0

방금 ​​URL을 시작합니다 : – Bitz

+0

@Bitz 글루 옵션 값은 자바 패키지 측면에서 경로를 제공해야합니다. – Grasshopper

답변

0

가 하나 개의 패키지에있는 모든 테스트 러너 클래스를 분리한다 응용 프로그램 (com.tests) 모든 단계를 실행하고 다른 패키지 (com.stepDefs)의 정의 클래스를 참조하십시오. 그런 다음 stepDefs 패키지를 각 테스트 러너에 붙입니다. Cucumber.Options @ 구문은 @CucumberOptions 나를 위해 것을 나는 오이의 JUnit 1.2.4를 사용하고

.

템플릿 구문 :

@CucumberOptions(features = "src/test/resources/features/", 
      tags = {"@soWeb"}, 
      plugin = {"pretty","html:target/cucumber-html-report", 
        "json:target/cucumber-json-report.json" 
         }, 
      glue = "com.ba.StepDefs") 

public class AltoroMutual_TestRunner { 


} 
0

접착제 경로 인수는 패키지 명 또는 클래스 패스 (안 파일 시스템 경로) 일 수있다. 예를 들어,

glue = {"com"} 

또는

glue = {"classpath:com"} 

당신은 자바 파일을 가리키는된다. 적절하게 변경하십시오.