-
junit 基于 spring 工程的测试基类编写
无论是SSH,SSI架构,都少不了用spring, 但一般写后台程序的人都需要自己检测功能是否正确,数据是否正确,一般不会运行web application 起来通过界面测试。都是直接通过 junit 写单元测试的, 但 通过 spring 配置的程序,需要拿到 配置的 bean 才可以。可以直接通过 ClassPathXmlApplicationContext 拿到beanFactory, 然后去获得各种bean. 这可以写一个基类,供其他测试类extend
Date: 2013-11-07 View: 1520
-
Spring Batch unit test example
In this tutorial, we will show you how to unit test Spring batch jobs with jUnit and TestNG frameworks. To unit test batch job, declares spring-batch-test.jar, @autowired the JobLauncherTestUtils, launch the job or step, and assert the execution status.
Date: 2019-08-18 View: 1520
-
Java Read a file from resources folder
In this tutorial, we will show you how to read a file from a resources folder or classpath, in both runtime and unit test environment. Try putting a file into the src/main/resources folder, and read the file with following code snippets :
Date: 2019-08-17 View: 1520
-
Must include junit.jar if not in Ants own classpath
Declares a junit task in Ant like this
Date: 2019-08-17 View: 1520
-
Ant and jUnit Task example
In this tutorial, we will show you how to run a junit test in Ant build.
Date: 2019-08-17 View: 1520
-
Gradle and JUnit example
In Gradle, you can declare the JUnit dependency like this:
Date: 2019-08-17 View: 1520
-
Maven and JUnit example
In Maven, you can declare the JUnit dependency like this:
Date: 2019-08-17 View: 1520
-
JUnit How to test a List
First, exclude the JUnit bundled copy of hamcrest-core, and include the useful hamcrest-library, it contains many useful methods to test the List data type.
Date: 2019-08-17 View: 1520
-
JUnit How to test a Map
Forget about JUnit assertEquals(), to test a Map, uses the more expressive IsMapContaining class from hamcrest-library.jar
Date: 2019-08-17 View: 1520
-
JUnit Run test in a particular order
In JUnit, you can use @FixMethodOrder(MethodSorters.NAME_ASCENDING) to run the test methods by method name, in lexicographic order.
Date: 2019-08-17 View: 1520
-
JUnit Assert if a property exists in a class
Includes hamcrest-library and test the class property and its value with hasProperty() :
Date: 2019-08-17 View: 1520
-
JUnit Categories Test
In JUnit, you can organize the test cases into different categories, and run those categorized test cases with @Categories.ExcludeCategory or @Categories.IncludeCategory
Date: 2019-08-17 View: 1520
-
JUnit + Spring integration example
In this tutorial, we will show you how to test the Spring DI components with JUnit frameworks.
Date: 2019-08-17 View: 1520
-
Unit Test What is Mocking? and Why?
In simple, mocking is creating objects that mimic the behavior of real objects. Refer to the following case study :
Date: 2019-08-17 View: 1520
-
Spring Boot WebFlux + Server-sent events example
In this article, we will show you how to develop a reactive web application, using Server-sent events
Date: 2019-08-11 View: 1520