Sanjeev Shrestha

  • Github
  • Twitter
  • Linkedin
  • Behance
  • Tutorials
  • Features
  • Topics
  • Machine Learning
  • Photography
  • Tips and Tricks

Recent Posts

  • Running a single test with Maven
  • Disabling Cache in Tests
  • Changing Springboot Properties at runtime in tests
  • Using Docker to build Software
  • Creating Code Coverage reports with JaCoCo Maven Plugin

Recent Comments

Calendar

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Oct    

Find me on Facebook

Find me on Facebook
Skip to content

Sanjeev Shrestha

Category: Java

Running a single test with Maven

We can test just one class with maven by providing the test class as follows

$ mvn -Dtest=com.abc.package.xyz.TestClass test

or just one test

$ mvn -Dtest=com.abc.package.xyz.TestClass#TestMethod

Saves a lot of time when you want to skip all the tests but one.

Posted on October 25, 2017October 25, 2017 by Sanjeev Shrestha 0

Disabling Cache in Tests

Disable Caching in your test in your Spring boot application by adding following properties in application.properties file in your test resources folder

spring.cache.type = none

This will disable the cache in your tests.

Posted on October 25, 2017October 25, 2017 by Sanjeev Shrestha 0

Changing Springboot Properties at runtime in tests

So you have different tests that have different properties requirements and you want to change the springboot properties at runtime for some of the tests. The simplest way to do that is to set the properties using @TestPropertySource annotation.  Continue reading →

Posted on October 24, 2017October 24, 2017 by Sanjeev Shrestha 0
Create a website or blog at WordPress.com
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Sanjeev Shrestha
    • Already have a WordPress.com account? Log in now.
    • Sanjeev Shrestha
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar