2015-03-03 4 views
0

Erly Я спросил this вопрос о огурцах и java. После исправления моего проекта я проверил PendingException в огуречном junit. У меня есть 2 класса: TestClass.java для работы с SoapUI, TestSteps.java для выполнения шагов огурца с моим кодом и классом JUnit Run.java. Это мой код: TestClass.java:Огурцы PendingExceprion для испытаний в Intellij IDEA

public class FirstTest { 
private static String xmlFile; 
private static String projectPath; 

public FirstTest(String file) 
{ 
    xmlFile = file; 
} 
//for Then step 
public static void run() throws XmlException, IOException, SoapUIException { 
    //add test project 
    WsdlProject project = new WsdlProject(getProjectPath()); 
    //add xml file for test into property 
    project.setPropertyValue("File", xmlFile); 
    //get TestSuite and TestCase by name 
    TestSuite testSuite = project.getTestSuiteByName("Test"); 
    TestCase testCase = testSuite.getTestCaseByName("Test"); 
    //run test 
    testCase.run(new PropertiesMap(), false); 

} 

public static String getProjectPath() 
{ 
    return projectPath = "path"; 
} 

}

И это TestSteps.java класс:

public class TestSteps { 
private FirstTest testClass; 

@Given("^I have a file \"(.*?)\"$") 
public void i_have_a_file(String file) throws Throwable { 
    testClass = new FirstTest(file); 
    throw new PendingException(); 
} 

@Then("^I want to run case$") 
public void i_want_to_run_case() throws Throwable { 
    testClass.run(); 
    throw new PendingException(); 
} 

}

Огурцы особенность:

Scenario: Test 
Given I have a file "path_to_file" 
Then I want to run case 

И JUnit Класс:

@RunWith(Cucumber.class) 
@CucumberOptions(format = {"junit:target_junit/cucumber.xml"}, 
glue = {"src/com.teststeps.TestSteps"}, 
features = {"Feature"}, 
dryRun = true, 
strict = true, 
tags = {}, 
monochrome = true) 

public class RunTest { 
} 

Если я пытаюсь запустить JUnit класс, я проверка PendingException:

cucumber.api.PendingException: TODO: implement me 
    at cucumber.runtime.junit.JUnitReporter.addFailure(JUnitReporter.java:134) 
    at cucumber.runtime.junit.JUnitReporter.addFailureOrIgnoreStep(JUnitReporter.java:122) 
    at cucumber.runtime.junit.JUnitReporter.result(JUnitReporter.java:91) 
    at cucumber.runtime.Runtime.runStep(Runtime.java:280) 
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) 
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) 
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:48) 
    at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91) 
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) 
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70) 
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93) 
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at cucumber.api.junit.Cucumber.run(Cucumber.java:98) 
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137) 
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) 
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) 
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) 

Но я просто реализовать эти шаги в моих файлов Java. В каком направлении смотреть? Почему я могу проверить это исключение? UPDATE: Попробуйте этот код в Eclipse тоже, он не работает. Кто-нибудь знает причины? UPD 2: Редактировать описание UPD 3: Восстановить помощь по проекту

ответ

5

Удалить throw new PendingException(); со своих шагов.

+0

Большое спасибо, yole – Giymose

+0

На самом деле в шаблоне по умолчанию должен быть текст, в котором говорится: «Удалите это, когда шаг будет реализован», потому что на самом деле неясно, какова точка этого броска. – romulusnr