chore: 测试覆盖率action

This commit is contained in:
CaptainB 2023-05-04 18:28:22 +08:00 committed by 刘瑞斌
parent 5183a9f919
commit 7e94a91fbb
3 changed files with 17 additions and 0 deletions

View File

@ -26,3 +26,5 @@ jobs:
run: mvn -B package --file pom.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -5,6 +5,7 @@ import io.metersphere.domain.User;
import io.metersphere.sdk.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -20,4 +21,9 @@ public class UserController {
public List<User> listAll() {
return userService.list();
}
@GetMapping("/get/{userId}")
public User getUser(@PathVariable String userId) {
return userService.getById(userId);
}
}

View File

@ -28,4 +28,13 @@ public class UserControllerTests {
.andDo(print());
}
@Test
public void testSelectAll2() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/user/get/admin"))
.andExpect(status().isOk())
// .andExpect(content().contentType(MediaType.APPLICATION_JSON))
// .andExpect(jsonPath("$.person.name").value("Jason"))
.andDo(print());
}
}