GithubHelp home page GithubHelp logo

rodionovsasha / commentservice Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 251 KB

Demo project to show how JFixtures works on practice. https://github.com/vkorobkov/jfixtures

License: MIT License

Java 35.72% Groovy 64.28%

commentservice's Introduction

Build Status Coverage Status

Comment Service

This is a demo project to show how JFixtures works on practice
https://github.com/vkorobkov/jfixtures

Preparing a test data for integration tests

The main goal of this demo project to show how we can use JFixtures for populating relational databases with yml-based test data and test our services. There are some simple steps for using:

  • add maven dependency of JFixtures to your pom.xml file:
    <dependency>
        <groupId>com.github.vkorobkov</groupId>
        <artifactId>jfixtures</artifactId>
        <version>${jfixtures.version}</version>
        <scope>test</scope>
    </dependency>
  • put a yaml based test data to resources folder
  • convert the test data using JFixtures to a string or a file and execute generated SQL query:
    import com.github.vkorobkov.jfixtures.JFixtures;

    Path fixturesPath = Paths.get("src/test/resources/yaml/user")
    String sql = JFixtures
            .withConfig(fixturesPath.resolve('.conf.yml'))
            .load(fixturesPath)
            .compile()
            .toSql99()
            .toString()
    jdbcTemplate.execute(sql)
  • That's all! Now you can use it anywhere you need in the project. Please see test examples here: CommentService/src/test/groovy/com/github/rodionovsasha/commentservice/services

Build the application

mvn clean install

or using wrapper

./mvnw clean install

Rest JSON API URL

http://localhost:8080/v1/api

Run the application

mvn spring-boot:run

or using wrapper

./mvnw spring-boot:run

or simply run the application in your IDE using public static void main method.

commentservice's People

Contributors

rodionovsasha avatar vkorobkov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.