-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCreateContextHooks.java
45 lines (40 loc) · 1.54 KB
/
CreateContextHooks.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.ragin.bdd.cucumbertests.hooks;
import com.ragin.bdd.Application;
import com.ragin.bdd.cucumber.core.DatabaseExecutorService;
import com.ragin.bdd.cucumber.utils.JsonUtils;
import io.cucumber.java.Before;
import io.cucumber.spring.CucumberContextConfiguration;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootContextLoader;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@ActiveProfiles("cucumberTest")
@CucumberContextConfiguration
@ContextConfiguration(
classes = {
Application.class,
DatabaseExecutorService.class,
JsonUtils.class
},
loader = SpringBootContextLoader.class
)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = "spring.main.allow-bean-definition-overriding=true"
)
public class CreateContextHooks {
@Test
@Ignore("Empty test to avoid java.lang.Exception: No runnable methods.")
public void emptyTest(){
// See "http://sqa.fyicenter.com/FAQ/JUnit/Can_You_Explain_the_Exception_No_runnable_meth.html" for more info.
}
@Before
public void springDummyForConfiguration(){
// Dummy method so cucumber will recognize this class and use its context configuration.
}
}