qa-tester
1
总安装量
1
周安装量
#46227
全站排名
安装命令
npx skills add https://github.com/shaul1991/shaul-agents-plugin --skill qa-tester
Skill 文档
QA Tester Agent
ìí
í ì¤í¸ ìì± ë° ì¤íì ë´ë¹í©ëë¤.
í ì¤í¸ ì¤í
- Framework: Jest
- E2E: Supertest
- Mocking: jest.mock, jest.spyOn
í ì¤í¸ 구조
test/
âââ unit/ # ë¨ì í
ì¤í¸
â âââ services/
â âââ controllers/
âââ integration/ # íµí© í
ì¤í¸
â âââ modules/
âââ e2e/ # E2E í
ì¤í¸
â âââ app.e2e-spec.ts
â âââ [feature].e2e-spec.ts
âââ fixtures/ # í
ì¤í¸ ë°ì´í°
âââ [entity].fixture.ts
í ì¤í¸ ëª ë ¹ì´
# ì ì²´ í
ì¤í¸
npm run test
# í¹ì íì¼ í
ì¤í¸
npm run test -- [file-pattern]
# 커ë²ë¦¬ì§
npm run test:cov
# E2E í
ì¤í¸
npm run test:e2e
# Watch 모ë
npm run test:watch
í ì¤í¸ í¨í´
ë¨ì í ì¤í¸
describe('UserService', () => {
let service: UserService;
let repository: MockType<Repository<User>>;
beforeEach(async () => {
const module = await Test.createTestingModule({
providers: [
UserService,
{ provide: getRepositoryToken(User), useFactory: repositoryMockFactory },
],
}).compile();
service = module.get<UserService>(UserService);
repository = module.get(getRepositoryToken(User));
});
describe('findById', () => {
it('should return user when found', async () => {
const user = { id: 1, name: 'Test' };
repository.findOne.mockReturnValue(user);
const result = await service.findById(1);
expect(result).toEqual(user);
});
it('should throw when not found', async () => {
repository.findOne.mockReturnValue(null);
await expect(service.findById(1)).rejects.toThrow(NotFoundException);
});
});
});
E2E í ì¤í¸
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
afterEach(async () => {
await app.close();
});
it('/health/live (GET)', () => {
return request(app.getHttpServer())
.get('/health/live')
.expect(200)
.expect({ status: 'ok' });
});
});
í ì¤í¸ 커ë²ë¦¬ì§ 목í
| ì í | 목í |
|---|---|
| ì ì²´ | > 80% |
| ìë¹ì¤ | > 90% |
| 컨í¸ë¡¤ë¬ | > 70% |
| ì í¸ë¦¬í° | > 95% |
í ì¤í¸ ëª¨ë² ì¬ë¡
- AAA í¨í´: Arrange â Act â Assert
- ë¨ì¼ ì± ì: íëì í ì¤í¸ë íëë§ ê²ì¦
- ë 립ì±: í ì¤í¸ ê° ìì¡´ì± ìì
- ëª íí ë¤ì´ë°: 무ìì í ì¤í¸íëì§ ëª ì