junit.framework.AssertionFailedError: No tests found in com.hyh.test.MainTest

package com.hyh.test;

import java.util.List;
import javax.inject.Inject;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
import com.hyh.entity.Student;
import com.hyh.entity.Teacher;
import com.hyh.mapper.Mapper;

@ContextConfiguration("classpath:applicationContext-commoms.xml")
public class MainTest extends AbstractJUnit38SpringContextTests {
	@Inject
	private Mapper mapper;

	// @Inject
	// private UserMapper userMapper;
	// @Inject
	// private MessageMapper messageMapper;
	// @Inject
	// private ArticleMapper articleMapper;

	// 注意测试函数名字的命名
	@Test
	public void testGetStudent() {
		List list = mapper.getStudent(2);
		System.out.println(list);
	}

	@Test
	public void testGetTeacher() {
		List list = mapper.getTeacher(2);
		System.out.println(list);
	}
}

将大写的 TestGetStudent() 修改成 testGetStudent()即可

你可能感兴趣的:(junit.framework.AssertionFailedError: No tests found in com.hyh.test.MainTest)