1 Star 1 Fork 1

wubin28 / hotel-world-clocks-cucumber-java8

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

The sample project of cucumber-java8

Use Cucumber Java 8 to implement the Hotel World Clocks kata and refactor it to Observer design pattern. In this kata, a hotel has 5 clocks showing the time of Beijing (UTC+8), London (UTC+0), Moscow (UTC+4), Sydney (UTC+10), and New York (UTC-5). You have to consider daylight saving time (DST) for cities like London and New York. When the time of each one of these clocks is set due to incorrect time or start/end of daylight saving period, the time of all other clocks will be set automatically. The hotel would add more clocks for different cities in the future.

Feature: Kata Hotel World Clocks

In order to adjust the time of clocks of different cities in the lobby of a hotel as easily as possible,

As an employee of the hotel,

I want to adjust the time of any one clock and the time of all other clocks will be adjusted automatically.

Development Environment

  1. Java SE 1.8.0_241

  2. Maven 3.6.1

  3. Spring Boot 2.2.3.RELEASE

Branch

Check out the branch cucumber-java8-with-springboot for reference

Steps

  1. Create a folder called resources under src/test

  2. Write a feature file called hotel_world_clocks.feature under folder src/test/resources/com/wubinben/katas/bdd/cucumber

  3. Locate a line in the feature file and press <Alt> + <Enter> in intellij IDEA, and then generate all clue code

  4. Update pom.xml

  5. Add RunCukesTest class under the test/java folder

  6. Run mvn clean test and get cucumber-reports in the folder target

  7. Run mvn clean verify and get cucumber-html-reports in the folder target

pom.xml
  <properties>
    <file.encoding>UTF-8</file.encoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <cucumber.version>4.7.0</cucumber.version>
    <maven.test.failure.ignore>true</maven.test.failure.ignore> <!-- To generate the cucumber HTML report on test failure also  -->
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>2.8.0</version>
        <executions>
          <execution>
            <id>execution</id>
            <phase>verify</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <projectName>CucumberWebGui</projectName>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
              <skippedFails>true</skippedFails>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-java8</artifactId>
      <version>${cucumber.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-junit</artifactId>
      <version>${cucumber.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-spring</artifactId>
      <version>${cucumber.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-autoconfigure</artifactId>
    </dependency>
  </dependencies>
RunCukesTest.java
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/", plugin = { "json:target/cucumber.json", "pretty",
        "html:target/cucumber-reports" })
public class RunCukesTest {
}

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/wubin28/hotel-world-clocks-cucumber-java8.git
git@gitee.com:wubin28/hotel-world-clocks-cucumber-java8.git
wubin28
hotel-world-clocks-cucumber-java8
hotel-world-clocks-cucumber-java8
master

搜索帮助