Search code examples
javaspring-bootseleniumcucumberbdd

Maven test not running cucumber tests


In my sample spring boot security project I want to add some BDD tests. I have added dependencies, feature file, sep definition etc. but mvn test ignoring all my test classes. I have some junit and selenium tests which are running fine.

Project is public https://gitlab.com/vivart/spring-boot-security to make it more simple I have removed all junit and selenium test.

Note: I have already tried all similar question suggestions.


Solution

  • I ahve done 2 modificatuons and able to run test:

    1: Scenario keyword is missing in your feature file. Instead you have given Login:

    Feature: Login
      Scenario: Login functionality
    

    2: CucumberTestContextConfiguration class is missing. Please add it to your src/test/java like below:

    package com.example.auth;
    
    import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
    import org.springframework.boot.test.context.SpringBootTest;
    
    import io.cucumber.spring.CucumberContextConfiguration;
    
    @CucumberContextConfiguration
    @SpringBootTest
    @AutoConfigureMockMvc
    public class CucumberTestContextConfiguration {
    
    }