Skip to content

rodionovsasha/CommentService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published