2014-11-08 2 views
0

오이를 처음 접하고 특정 오이 시나리오를 실행하는 동안 이상한 문제에 직면했습니다. 다음은 필자의 기능 파일에서 정의한 두 가지 시나리오입니다. 첫 번째 시나리오는 문제없이 작동하지만 오이는 테스트 사례를 실행하는 동안 두 번째 테스트를 고려하지 않습니다. 다음은 오이 시나리오 실행 중 마주 보는 문제

Scenario Outline: 
1.Validate create functionality 

Given user is on "Home" screen 
When click on Create 
Then create screen should render 


Scenario Outline: 
2.Validate create Name,Description,Start Date 


    Given user is on create screen 
    When user enters following values: 

      | Name     | dummyName  | 
      | Desc     | [email protected]#  | 
      | Date     | ghgh   | 

    Then there should be error message on the screen. 

는 자바의 기능 구현 방법입니다

시나리오 1.

@Given("^user is on \"([^\"]*)\" screen$") 
    public void homeScreen(String home) throws Throwable { 
     //someCode 
    } 

@When("^click on Create$") 
    public clickCreate() throws Throwable { 
     //someCode 
    } 

@Then ("^create screen should render$") 
    public void createRender() throws Throwable { 
     //someCode 
    } 

시나리오 시나리오가 오이에 의해 호출되지 않는 이유 2.

@Given("^user is on create screen$") 
    public void crateScreen() throws Throwable { 
     //someCode 
    } 


@When("^user enters following values :$") 
public void EnterValues(Map<String,String> map) throws Throwable { 
     //someCode 
    } 

@Then("^there should be error message on the screen.$") 
public void errorMessage() throws Throwable { 
     //someCode 
    } 

?

환경 - 오이, 셀레늄, JAVA

+1

무엇이 오류입니까? – bcar

+0

답장을 보내 주셔서 감사 합니다만 오류는 표시되지 않지만 시나리오 2는 실행되지 않습니다. – Gautam

+0

러너는 어디 있습니까? –

답변

1

당신은 내가이 당신의 code.Try에 어쨌든 작은 오이 문법 문제를 많이 참조 예 table.In 사실에 사용되는 변수 이름 주변에 어떤 자리를 사용하지 않기 때문에 :

Scenario Outline: Validate Input Fields 
Given user is on create screen 
When user enters following values <createName>,<Description>,<StartDate> 
Then should receive this <ErrorMessage> 

Examples: 
    | createName| Description| StartDate| ErrorMessage| 
    | DummyName| [email protected]#| ghgh| Invalid Date Entered | 
+0

답장을 보내 주셔서 고맙습니다.하지만 "시나리오 개요"를 "시나리오"로 변경하면 제 코드가 작동합니다. 작은 오이 구문 문제를 강조해 주셔서 감사합니다. – Gautam

+1

시나리오 개요를 사용하는 경우 예제가 필요합니다. if 이것은 그렇지 않습니다. 오이는 예상대로 작동하지 않습니다. yor 기능을 올바르게 이해하면 개요 변형이 아닌 일반 시나리오를 사용해야합니다. – Dude

관련 문제