genetic-orange
genetic-orange7mo ago

How to write testing for refine project

I am new to frontend development, so I want to know how to write testing for refine project? I know there is a unit testing within Refine framework, but is there anything I need to do for writing testing.
3 Replies
kapa.ai
kapa.ai7mo ago
Hi @Zion. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Refine's components and hooks are designed to be testable and work independently of each other. However, you don't need to write unit tests for them as they are already tested by the Refine maintainers. Instead, it's recommended that you write end-to-end tests for your application. Refine uses the Cypress framework as an example for end-to-end testing, but you are free to use any testing framework you prefer [^1^][^4^]. Here's an example of how to run a Refine project with Cypress on your local machine:
npm create refine-app@latest -- --example with-cypress
npm create refine-app@latest -- --example with-cypress
[^3^] If you're contributing to Refine, you should know that Refine uses Jest as the test runner and @testing-library/react for testing React components. For E2E tests, it uses Cypress. You're expected to write proper tests for each feature/bugfix you make. If you're not sure how to write tests, you can ask for help in the Refine community room [^5^]. ^1^]: [Refine Testing Documentation (https://refine.dev/docs/further-readings/testing) ^3^]: [Refine Testing Example (https://github.com/refinedev/refine/tree/master/examples/with-cypress) ^4^]: [Refine Blog on Testing (https://refine.dev/blog/how-to-build-a-web-app#7-testing-processes) ^5^]: [Refine Contributing Guide (https://refine.dev/docs/guides-concepts/contributing#running-tests) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@1156621086176321576> kapa.ai is still learning and improving, please let us know how it did by reacting below
genetic-orange
genetic-orange7mo ago
But if I don't need to write a unit test for Refine component, should I need to write a unit test for my own component?