반응형
기능을 삭제하지 않고 specflow (Gherkin)에서 기능을 비활성화하려면 어떻게합니까?
일부 SpecFlow 기능 (Gherkin 구문 사용)이 있는데 테스트가 실행되지 않도록 기능을 일시적으로 비활성화하고 싶습니다.
이를 위해 기능을 표시 할 수있는 속성이 있습니까? Cucumber와 함께 작동하는 것이 SpecFlow에서도 작동 할 것이라고 생각합니다.
@ignore 태그로 기능을 표시 할 수 있습니다.
@ignore @web
Scenario: Title should be matched
When I perform a simple search on 'Domain'
Then the book list should exactly contain book 'Domain Driven Design'
최신 버전의 Specflow에서는 이제 다음과 같이 태그에 이유도 제공해야합니다.
@ignore("reason for ignoring")
편집 : 어떤 이유로 공백으로 깨지지 만 작동합니다.
@ignore("reason")
jbandi가 제안했듯이 @ignore 태그를 사용할 수 있습니다.
태그는 다음에 적용 할 수 있습니다.
- 단일 시나리오
- 완전한 기능
NUnit을 테스트 공급자로 지정하면 생성 된 코드의 결과는
[NUnit.Framework.IgnoreAttribute ()]
메서드 또는 클래스에.
Feature: CheckSample
@ignored
Scenario Outline: check ABC #checkout.feature:2
Given I open the applciation
When I enter username as "<username>"
And I enter password as "<password>"
Then I enter title as "<title>"
Examples:
| username | password |
| dude | daad |
위의 내용을 "CheckSample.feature"기능 파일로 간주합니다.
그리고 아래는 단계 파일이며 부분 파일입니다.
public class Sampletest {
@Given("^I open the applciation$")
public void i_open_the_applciation() throws Throwable {
// Write code here that turns the phrase above into concrete actions
//throw new PendingException();
}
이제 아래는 러너 파일입니다.
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty", "html:target/reports",
"json:target/reports/cucumber-report.json"},
monochrome = true,
tags = {"~@ignored"}
)
public class junittestOne {
public static void main(String[] args) {
JUnitCore junit = new JUnitCore();
Result result = junit.run(junittestOne.class);
}
}
여기서 주목해야 할 중요한 것은 기능 파일의 "@ignored"텍스트는 "junittestone"클래스 파일과 함께 CucumberOptions (태그)에 언급되어 있습니다. 또한 프로젝트에서 사용 가능한 오이, 작은 오이, Junit 및 기타 jar에 대한 모든 관련 jar 파일이 있는지 확인하고 단계 정의 (클래스)에서 가져 왔는지 확인하십시오.
"무시 됨"으로 인해 테스트를 실행하는 동안 시나리오를 건너 뜁니다.
반응형
'Program Tip' 카테고리의 다른 글
"int * p = + s;"는 무엇입니까? (0) | 2020.11.24 |
---|---|
새로운 기능이없는 C ++ 개체 (0) | 2020.11.24 |
브라우저에서 JavaScript가 처리 할 수있는 개체 크기의 한계에 도달 했습니까? (0) | 2020.11.24 |
Android MVVM 디자인 패턴 예제 (0) | 2020.11.24 |
C ++의 man 페이지는 어디에 있습니까? (0) | 2020.11.24 |