栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

可以在黄瓜测试中使用弹簧自动连接控制器吗?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

可以在黄瓜测试中使用弹簧自动连接控制器吗?

我用黄瓜jvm将Spring自动接线到黄瓜中。

<dependency>        <groupId>info.cukes</groupId>        <artifactId>cucumber-core</artifactId>        <version>1.1.5</version>        <scope>test</scope>    </dependency>    <dependency>        <groupId>info.cukes</groupId>        <artifactId>cucumber-spring</artifactId>        <version>1.1.5</version>        <scope>test</scope>    </dependency>    <dependency>        <groupId>info.cukes</groupId>        <artifactId>cucumber-junit</artifactId>        <version>1.1.5</version>        <scope>test</scope>    </dependency>

并将applicationContext.xml导入Cucumber.xml

<import resource="/applicationContext.xml" />   // refer to appContext in test package<context:component-scan base-package="com.me.pos.**.it" />   // scan package IT and StepDefs class

在CucumberIT.java中,调用

@RunWith(Cucumber.class)
并添加
CucumberOptions

@RunWith(Cucumber.class)@CucumberOptions(    format = "pretty",    tags = {"~@Ignore"},    features = "src/test/resources/com/me/pos/service/it/"  //refer to Feature file)public class CucumberIT {  }

在CucumberStepDefs.java可以

@Autowired

@ContextConfiguration("classpath:cucumber.xml")public class CucumberStepDefs {    @Autowired    SpringDAO dao;    @Autowired    SpringService service;}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/398333.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号