# 26. Cypress Hooks

* **before:** Herhangi bir testin önceden yürütülmesinden sonra yürütülür gerçekleştirilir.
* **after:** Tüm testlerin yürütülmesinden sonra yürütülür gerçekleştirilir.
* **beforeEach:** Her bir testin yürütülmesinden önce yürütülür.
* **afterEach:** Her bir testing yürütülmesinden sonra yürütülür

```javascript
describe('Tutorialspoint', function() {
    before(function() {
        // executes once prior all tests in it block
        cy.log("Before hook")
    })
    
    after(function() {
        // executes once post all tests in it block
        cy.log("After hook")
    })
    
    beforeEach(function() {
        // executes prior each test within it block
        cy.log("BeforeEach hook")
    })
    
    afterEach(function() {
        // executes post each test within it block
        cy.log("AfterEac hook")
    })
    
    it('First Test', function() {
        cy.log("First Test")
    })
    
    it('Second Test', function() {
        cy.log("Second Test")
    })
 })
```

## Implementation with .only and .skip

```javascript
describe('Tutorialspoint', function()
    //it block with tag .only
    it.only('First Test', function() {
        cy.log("First Test")
    })
    
    //it block with tag .only
    It.only('Second Test', function() {
        cy.log("Second Test")
    })
    
    it('Third Test', function() {
        vacy.log("Third Test")
    })
    
    //it block with tag .skip
     it.skip('Skip Test', function() {
         cy.log("Skip Test")
     })
})
```
