2

테스트를 실행하고 보고서를 생성하기 위해 필요한 모든 라이브러리가 포함 된 실행 가능 JAR에 수락 테스트를 패키징하고 싶습니다. 또한 모든 테스트 또는 단일 테스트를 실행하고 싶습니다.실행 가능한 JAR에서 단일 오이 시나리오 실행

지금까지 모든 테스트를 실행할 수 있었지만 serenity.properties에 지정된 위치에서 보고서가 생성되고 있지만 index.html은 생성되지 않았습니다.

일반적으로 나는 serenity-maven-plugin을 실행할 maven verify goal을 사용하여 테스트를 실행 하겠지만, JAR에서 실행 중이므로 같은 것을 얻을 수있는 방법이 확실하지 않습니다.

@RunWith(CucumberWithSerenity.class) 
@CucumberOptions(features = "classpath:com/cfhayes/test/LookupADefinition.feature") 
public class DefinitionTestSuite { 
    public static void main(String[] args) throws Exception { 
    JUnitCore.main("com.cfhayes.test.DefinitionTestSuite"); 
    } 
} 

내가 하나의 시나리오를 지정할 수 있도록 내 기능 파일을 실행 태그를 사용 :

Feature: Lookup a definition 

    @TEST-0001 
    Scenario: Looking up the definition of 'apple' 
    Given the user is on the Wikionary home page 
    When the user looks up the definition of the word 'apple' 
    Then they should see the definition 'A common, round fruit produced by the tree Malus domestica, cultivated in temperate climates.' 

    @TEST-0002 
    Scenario: Looking up the definition of 'pear' 
    Given the user is on the Wikionary home page 
    When the user looks up the definition of the word 'pear' 
    Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.' 

을 내가 거기 바라고 있어요

나는 다음과 같이 보이는 메인 클래스가 어떻게 든 오이 옵션을 설정할 수있게 해주는 실행 가능한 JAR과 함께 JVM args를 사용할 수있는 방법입니다. 나는 이런 일을 시도했다 :

java -jar my-test-jar.jar -Dcucumber.options="--tags @TEST-0001" 

...하지만 여전히 모든 테스트를 실행합니다.

모든 아이디어는 크게 감사하겠습니다.

+0

바로 지금 내가 필요한 것. 어떤 해결책을 찾았습니까? – yuva

+1

예, 제가 가진 문제는 단순히 명령 줄 인수의 순서였습니다. 다음은 사용해야하는 명령 줄입니다. java -Ducucumber.options = "- tags @ TEST-0001"-jar my-test-jar.jar 다른 변경 사항은 필요 없습니다. – cfhayes

+1

다음은 살펴볼 수있는 작동 예제입니다. https://github.com/ch88251/cucumber-serenity-example – cfhayes

답변

2

명령을 구성하는 방법이 올바르지 않을 수 있습니다. 오이 옵션은 java 옵션보다는 com.cfhayes.test.DefinitionTestSuite::main의 인수로 사용됩니다.

java -Dcucumber.options="--tags @TEST-0001" -jar my-test-jar.jar 

또는 대신 클래스의 오이 옵션을 처리 :이보십시오.

+0

안녕 Mykola, 당신의 제안은 완벽하게 작동했습니다. 도와 주셔서 정말로 고맙습니다! – cfhayes

+0

내 대답을 수락하면 질문을 닫을 수 있습니다. –

관련 문제