首页 > 编程知识 正文

自动化测试框架目录,web自动化什么框架比较好

时间:2023-05-04 04:31:25 阅读:125312 作者:101

一. TestNG相关jar软件包引用1,添加到pom.xml文件中:

! - -与-- testNG相关的jar包参考----dependencygroupidorg.TestNG/groupidartifactidtestng/artifactidversion6. 14.3/versiong 基于SpringBoot框架的测试文件引入基本标签1,SpringBoot引入以下依赖关系。 版本最好与项目中使用的Spring版本匹配。

部署springboot :

ependencygroupidorg.spring framework.boot/groupidartifactidspring-boot-test/artifact id/dependency 2,…/src/mm

打开此主类以验证以下内容:

@ springbootapplication @ mappers can (com.nuonuo.nnjf.financing.mapper ) )。 @ enableeurekaclient @ enablefeignclientspublicclassfinancingmain { publicstaticvoidmain { string [ ] args } throws exception { 必须指定启动类。

@runwith(springrunner.class ) springboottest ) classes=financingmain.class ) /启动系统publiccclassapplicationtestextent { @ autowiredprivateproductcontrollerproductcontroller; @test(publicvoidtest ) throwsexception ) system.out.println ) ' Helloworld!' ); @test(publicvoidtest ) throwsexception ) system.out.println ('产品列' productController.getXX ) ); }注意:

)1)引用了Junit的@Test,import org.junit.Test; 不需要继承AbstractTestNGSpringContextTests

)2)如果使用TestNG框架,则importorg.TestNG.annotations.test; 创建测试类时,继承AbstractTestNGSpringContextTests

)3) Spring2.5及更高版本支持测试。 org.spring framework.test.context.Testng包为基于TestNG的测试用例提供支持类。

1、abstracttestngspringcontexttests

抽象出了集成了Spring TestContext Framework和TestNG环境下应用程序上下文测试支持的基础测试类。 如果明智的笔继承abstracttestngspringcontexttests,则可以访问以下protected成员变量: 应用程序上下文:使用它来测试显式bean搜索或上下文的整体状态。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。