Исключение времени огурца - PullRequest
0 голосов
/ 29 апреля 2018

этот вопрос дубликат поста. причина, по которой я спрашиваю, состоит в том, что я не могу получить от них действительный ответ (или, по крайней мере, ответ, который я могу понять) следовательно, я спрашиваю снова.

ниже приведен код. Это исполняемый файл RunnerTest и базовый класс

  @RunWith(Cucumber.class)
        @CucumberOptions(plugin = {"html:target/whisper-html-report", "json:target/whisper_report.json", "com.cucumber.listener.ExtentCucumberFormatter:output/report.html"},tags = {"@Tag"})
        public class RunnerTest {
        }

public class BaseClass {
@Before
    public void startUp() {
        try {
            driver = webModel.getUtils().browser();
            driver.get(webModel.getUtils().getProperty("url"));
            driver.manage().window().maximize();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

@After
    public void tearDown(Scenario scenario) throws IOException {
        if (scenario.isFailed()) {
            TakesScreenshot camera = (TakesScreenshot) driver;
            byte[] screenshot = camera.getScreenshotAs(BYTES);
            scenario.embed(screenshot, "image/png");
            System.out.println("screenShot taken");
       }
        driver.close();
        driver.quit();
    }
}


      Feature file
        @Tag
        Feature: will this run
          Scenario: try to execute feature
          Given I feel like running the code
          Then I run the code

        Step definition-

        import cucumber.api.java.en.Given;
        import cucumber.api.java.en.Then;

        public class run_this_MyStepdefs {
            @Given("^I feel like running the code$")
            public void iFeelLikeRunningTheCode()  {
                System.out.println("yes i feel like running the code");
            }

            @Then("^I run the code$")
            public void iRunTheCode()
            {
                System.out.println("hence i am running the code");

            }
        }

ниже нас код ошибки

cucumber.runtime.CucumberException: Failed to instantiate classBaseClass

1 Ответ

0 голосов
/ 08 июня 2018

Я пытался создать экземпляр базового класса, и это было причиной исключений из огурцов.

В тот момент, когда я удалил объект базового класса, все, казалось, работало нормально.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...