# Knowledge check: Automated testing - Advanced React

1. **Why is automated testing important? Select all that apply.**
    
    * <mark>It reduces human error.</mark>
        
    * <mark>It offers a faster feedback cycle, bringing faster validation and helping the development team to detect problems or bugs early.</mark>
        
    * <mark>It saves time to development teams.</mark>
        
2. **What are some of the best practices when writing your automated tests? Select all that apply**
    
    * <mark>They should resemble the way your software is used.</mark>
        
    * <mark>They should be maintainable in the long run.</mark>
        
    * Your tests need to be focused on the implementation details of your components.
        
3. **Imagine you have a component that renders both an** `input` **tag and a** `label` **tag with the exact text** `Comments`**:. Inside your test, you have the below piece of code:**
    
    ```javascript
    const element = screen.getByLabelText(/Comments:/);
    ```
    
    * The label element
        
    * <mark>The input element</mark>
        
    * The document object
        
4. **In a particular test that’s been written for a form component, you encounter the below two lines of code. What kind of data would the** `handleSubmit` **variable represent?**
    
    ```javascript
    const handleSubmit = jest.fn();
    render(<FeedbackForm onSubmit={handleSubmit} />);
    ```
    
    * A copy of the real function that’s used in the parent component that renders the FeedbackForm.
        
    * <mark>A mock function to track how is called by external code and thus explore the arguments passed in.</mark>
        
    * A specific function jest provides to handle form submissions
        
5. **What are some of the benefits of Continuous Integration (CI)? Select all that apply.**
    
    * <mark>Find bugs earlier and fix them faster.</mark>
        
    * <mark>Improved developer productivity.</mark>
        
    * Faster manual integrations.
        
    * <mark>Deliver working software more often.</mark>
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726476519336/84abfc9d-ab5a-4000-9eed-e6c2d1759a99.png align="center")
