Skip to content

Little project which shows how to test a spring-boot application within different activated profiles with cucumber

Notifications You must be signed in to change notification settings

borisskert/spring-cucumber-profiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I need help! Problem SOLVED!

My goal is to run different cucumber step definitions with different spring profiles:

Feature: My Feature

  Scenario: Get my text with default profile
    Given The application is running
    And No profile is active
    When I ask for my text
    Then I should get 'This is default'

  Scenario: Get my text with debug profile
    Given The application is running
    Given Profile 'debug' is active
    When I ask for my text
    Then I should get 'This is for debug'

  Scenario: Get my text with real profile
    Given The application is running
    Given Profile 'real' is active
    When I ask for my text
    Then I should get 'This is for real!'

The reason is there a several services implementing the interface MyService

public interface MyService {
    String get();
}

Each of them only active for its profile:

class profile result
MyDefaultService "This is default"
MyRealService "real" "This is for real!"
MyDebugService "debug" "This is for debug"

The cucumber tests are failing, the goal is to make them green... Thank you in advice.

Tests are now green - problem solved.

About

Little project which shows how to test a spring-boot application within different activated profiles with cucumber

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published