Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up Karate Test for GraphQl #42

Closed
wants to merge 9 commits into from

Conversation

olisaagbafor
Copy link
Contributor

@olisaagbafor olisaagbafor commented Dec 2, 2024

This PR is being superseded by #56 to align with project commit guidelines.

Pull Request for SafeTrust - Add Automated API Testing Framework

Pull Request Information

This PR implements comprehensive automated testing for the SafeTrust GraphQL API using the Karate framework. It establishes a robust testing infrastructure focusing on user authentication, permissions, and wallet functionality.

🌀 Summary of Changes

  • Test Infrastructure Setup:

    • Added Karate testing framework configuration
    • Created Docker test environment
    • Implemented test reporting system
  • Test Suite Implementation:

    • Authentication tests (Firebase token validation, JWT claims)
    • User management tests (CRUD operations, permissions)
    • Wallet functionality tests (creation, validation)
    • Error scenario coverage
  • Project Structure:

    • Organized test files in feature-based hierarchy
    • Added reusable test helpers and schemas
    • Implemented environment-specific configurations

🛠 Testing

Evidence Before Solution

  • No automated testing infrastructure
  • Manual verification required for API changes
  • Inconsistent test coverage

Evidence After Solution

  • Automated test execution via Docker
  • Comprehensive test coverage for:
    • User authentication flows
    • RBAC permissions
    • Wallet operations
    • Error scenarios
  • Generated test reports showing coverage metrics

📂 Related Issue

This pull request will close #29 - Implement automated API testing infrastructure


🎉 Thank you for reviewing this PR!

@olisaagbafor olisaagbafor marked this pull request as ready for review December 2, 2024 11:35
@diegoTech14
Copy link
Contributor

Hi @olisaagbafor

  1. Could you change the dependencies from package.json in the tests directory to the main package.json?
  2. We would like to see the setup working in a video. Could you make us a video, please?

For the video you can use loom -> https://www.loom.com/looms/videos

@diegoTech14
Copy link
Contributor

@olisaagbafor Hey man, PR looks good, just would like to see a video please 🚀

- Add Cucumber reporting dependencies
- Configure Maven Surefire plugin for report generation
- Add TestRunner class with report generation logic
- Update Docker configuration for report persistence
- Add .gitignore for report directories
@olisaagbafor
Copy link
Contributor Author

@diegoTech14 The video link is here

@diegoTech14
Copy link
Contributor

@diegoTech14 The video link is here

Will check ASAP, thanks!

Copy link
Contributor

@rvalenciano rvalenciano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olisaagbafor this is looking great, some mino comments;

Also, can we add some instructions on the README on how to run the tests?

Best

@diegoTech14
Copy link
Contributor

@olisaagbafor Hey man, any updates?

@olisaagbafor
Copy link
Contributor Author

Yeah, am on it, Just had some buds to clear up...

@sotoJ24 sotoJ24 self-requested a review December 6, 2024 19:18
@zleypner
Copy link
Contributor

zleypner commented Dec 8, 2024

Hello @olisaagbafor ,
May please have your Telegram or contact me at https://t.me/anwar_zlcr ?
I am having an error while running the Karate Tests.

@zleypner
Copy link
Contributor

Hello @olisaagbafor! As per our conversation in telegram. Do you have any updates regarding the errors for the tests?

@olisaagbafor
Copy link
Contributor Author

@zleypner Yeah I do will update soon

- Add Docker Compose setup for test environment
- Configure Karate test framework
- Set up test result reporting to tests/results
- Add README with test execution instructions

This commit sets up the initial testing infrastructure using Karate
framework and Docker Compose, enabling automated API testing against
a containerized Hasura GraphQL engine.
@olisaagbafor
Copy link
Contributor Author

@zleypner the errors should be gone now, and I have updated the README for the instruction on how to run the test

@olisaagbafor
Copy link
Contributor Author

Please let me know if there is anything else...

@zleypner
Copy link
Contributor

zleypner commented Dec 11, 2024

Hello @olisaagbafor Thank you for the updates! Checking

@zleypner
Copy link
Contributor

We are almost there @olisaagbafor , thank you! Would yo be so kind to please update the Loom video?

@olisaagbafor
Copy link
Contributor Author

Ok will do that shortly @zleypner

@olisaagbafor
Copy link
Contributor Author

@zleypner the video link is here

@zleypner
Copy link
Contributor

zleypner commented Dec 12, 2024

Thanks @olisaagbafor for this outstanding work! The implementation of the Karate testing framework is extremely well-structured and thorough. I particularly appreciate:

Your responsiveness to feedback and willingness to iterate on improvements
The clear documentation and testing instructions you've added to the README
Your professional approach to addressing all review comments and technical issues

Your attention to detail and commitment to quality really shows through in this PR. This testing infrastructure will be invaluable for maintaining code quality as we scale. Great job on delivering such a robust solution! 🎯 👏

I will proceed to merge asap

@olisaagbafor
Copy link
Contributor Author

@zleypner thanks alot for your complements ❤️, I truly appreciate 🙏

@zleypner
Copy link
Contributor

zleypner commented Dec 12, 2024

@olisaagbafor There is one detail pending mentioned in the Contributors guideline. Please update the atomic commits based on the git guidelines.
safetrustcr/Frontend#35
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up Karate Testing Framework for GraphQL API - Users Module
5 participants