当前位置: 首页 > news >正文

如何建设简单小型网站教育培训机构营销方案

如何建设简单小型网站,教育培训机构营销方案,郑州做输卵管哪家医药网站I,网站建设采购合同验收在idea环境下,可以用过插件的方式自动生成juint模板代码。不过具体要需要自己手动编写。 1、安装插件 打开idea,file–settings–plugins,搜索和安装插件(JunitGenerator V2.0和JUnit),安装后,后…

在idea环境下,可以用过插件的方式自动生成juint模板代码。不过具体要需要自己手动编写。
1、安装插件
打开idea,file–settings–plugins,搜索和安装插件(JunitGenerator V2.0和JUnit),安装后,后面的两个勾选都必须选中。
我仅安装JunitGenerator V2.0插件,安装成功后发现两个都存在了。JunitGenerator V2.0为代码生成必要的,JUnit为运行juint单元测试必要的。
在这里插入图片描述
2、配置junit
安装完成插件后,需要重启idea。之后打开settings–other settings,可以看到如下的插件配置页面
(1)、完成如下图的配置
Output Path配置为:

${SOURCEPATH}/../../test/java/${PACKAGE}/${FILENAME}

在这里插入图片描述
(2)、切换到juint4模板页面,进行如下修改
在这里插入图片描述
附完整我的junit4模板配置

######################################################################################## 
## 
## Available variables: 
##         $entryList.methodList - List of method composites 
##         $entryList.privateMethodList - List of private method composites 
##         $entryList.fieldList - ArrayList of class scope field names 
##         $entryList.className - class name 
##         $entryList.packageName - package name 
##         $today - Todays date in MM/dd/yyyy format 
## 
##            MethodComposite variables: 
##                $method.name - Method Name 
##                $method.signature - Full method signature in String form 
##                $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) 
##                $method.paramNames - List of Strings representing the method's parameters' names 
##                $method.paramClasses - List of Strings representing the method's parameters' classes 
## 
## You can configure the output class name using "testClass" variable below. 
## Here are some examples: 
## Test${entry.ClassName} - will produce TestSomeClass 
## ${entry.className}Test - will produce SomeClassTest 
## 
######################################################################################## 
## 
#macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end 
## Iterate through the list and generate testcase for every entry. 
#foreach ($entry in $entryList) 
#set( $testClass="${entry.className}Test") 
## 
package $entry.packageName; import org.junit.Test; 
import org.junit.Before; 
import org.junit.After; 
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;/** 
* ${entry.className} Tester. 
* 
* @author <weisian> 
* @since <pre>$today</pre> 
* @version 1.0 
*/ 
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {PlatformApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class $testClass { @Before
public void before() throws Exception { 
} @After
public void after() throws Exception { 
} #foreach($method in $entry.methodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
} #end #foreach($method in $entry.privateMethodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
#foreach($string in $method.reflectionCode) 
$string 
#end 
} #end 
} 
#end

3、代码引入junit的必要pom

   <!-- springboot Test --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- https://mvnrepository.com/artifact/junit/junit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version><scope>test</scope></dependency>

4、生成需要的junitTest文件
打开需要生成测试的源文件,在页面上右键选择generate,选择junit Test,选择JUnit4
在这里插入图片描述
可以看到自动生成*Test.java文件,文件路径和源文件一致,仅挂载在test资源下
在这里插入图片描述
这里看到报错是因为启动类我们没有在junit 4模板中导入包,如果模板配置加上导入启动类包的代码,就不会报错。模板未配置的话,也可以自己手动导入包

5、如果是第一次生成test目录的化,需要修改目录属性
(1)、在src目录上,右键按照下图配置成Sources Root
在这里插入图片描述
(2)、在test目录上,右键按照下图配置成Test Sources Root
在这里插入图片描述
6、模板生成的会是源代码中所有定义方法的测试方法,都为空,可以自己调整代码进行数据模拟测试。
一次启动会运行所有的测试方法,每一个测试方法都会先执行一下before,执行完成之后在执行一次after。
如下实例:

package XX.goods.controller;import com.alibaba.fastjson.JSON;
import com.XX.PlatformApplication;
import com.XX.model.ResponseModel;
import com.XX.goods.api.GoodsRepairService;
import com.XX.goods.model.GoodsRepair;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;import org.springframework.beans.factory.annotation.Autowired;/*** GoodsRepairController Tester.** @author <weisian>* @version 1.0* @since <pre>05/19/2023</pre>*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {PlatformApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)public class GoodsRepairControllerTest {@Autowiredprivate GoodsRepairService goodsRepairService;@Autowiredprivate GoodsRepairController goodsRepairController;@Beforepublic void before() throws Exception {System.out.println("before");}@Afterpublic void after() throws Exception {System.out.println("after");}@Testpublic void testAddSubmit() throws Exception {System.out.println("testAddSubmit");GoodsRepair byId = goodsRepairService.getById("1b6ea48be18e5576aef49f8f60653888");System.out.println("11" + JSON.toJSONString(byId));}@Testpublic void testFindMyRepairList() throws Exception {System.out.println("testFindMyRepairList");ResponseModel byId = goodsRepairController.getById("", null, null);System.out.println("22" + JSON.toJSONString(byId));}} 

7、右键执行单元测试类查看效果
执行:
在这里插入图片描述
效果:
在这里插入图片描述
上图是全部的日志,也可以点击单个方法查看单个方法的运行日志:
在这里插入图片描述

总结:
idea下需要先安装好插件,重启idea后,配置模板,修改源代码pom后,指定源代码文件生成对应的test工具类,如果是第一次生成,需要修改目录属性。之后就可以根据我们需要编写测试代码了。
运行juint工具类,实际上相当于启动容器后,在调用指定类的所有测试方法。关于注入service时,一定要是@Autowired从容器中获取,不然在before中new serviceImpl,只能引用成功service本身的方法,如果service还引用其他service,就无法满足。

学海无涯苦作舟!!!


文章转载自:
http://correspondent.rwzc.cn
http://letter.rwzc.cn
http://achech.rwzc.cn
http://debasement.rwzc.cn
http://festally.rwzc.cn
http://monadism.rwzc.cn
http://tipple.rwzc.cn
http://polyandry.rwzc.cn
http://incabloc.rwzc.cn
http://effects.rwzc.cn
http://calculably.rwzc.cn
http://amblyoscope.rwzc.cn
http://stroy.rwzc.cn
http://pharmacolite.rwzc.cn
http://subtility.rwzc.cn
http://gimlet.rwzc.cn
http://patronage.rwzc.cn
http://petition.rwzc.cn
http://pochard.rwzc.cn
http://lymphoma.rwzc.cn
http://novel.rwzc.cn
http://unassuaged.rwzc.cn
http://millimeter.rwzc.cn
http://rerecord.rwzc.cn
http://aurific.rwzc.cn
http://cornerwise.rwzc.cn
http://aesthete.rwzc.cn
http://septifragal.rwzc.cn
http://soleprint.rwzc.cn
http://featherhead.rwzc.cn
http://marketable.rwzc.cn
http://metaphysical.rwzc.cn
http://assort.rwzc.cn
http://spoonbeak.rwzc.cn
http://fusel.rwzc.cn
http://malacca.rwzc.cn
http://roommate.rwzc.cn
http://satinbird.rwzc.cn
http://pathfinder.rwzc.cn
http://frothy.rwzc.cn
http://gibing.rwzc.cn
http://meatman.rwzc.cn
http://raggle.rwzc.cn
http://ichthyotic.rwzc.cn
http://pantagruelian.rwzc.cn
http://excogitation.rwzc.cn
http://yod.rwzc.cn
http://derned.rwzc.cn
http://exclamation.rwzc.cn
http://sawtooth.rwzc.cn
http://utilitarianism.rwzc.cn
http://christabel.rwzc.cn
http://smoothly.rwzc.cn
http://plunderer.rwzc.cn
http://vaquero.rwzc.cn
http://weird.rwzc.cn
http://disordered.rwzc.cn
http://magnificence.rwzc.cn
http://autoantibody.rwzc.cn
http://pontoon.rwzc.cn
http://precordium.rwzc.cn
http://solstitial.rwzc.cn
http://dimorph.rwzc.cn
http://caramelize.rwzc.cn
http://dupe.rwzc.cn
http://vespertilionid.rwzc.cn
http://hoochie.rwzc.cn
http://bowie.rwzc.cn
http://yikes.rwzc.cn
http://pooh.rwzc.cn
http://dishonest.rwzc.cn
http://vibrant.rwzc.cn
http://assimilate.rwzc.cn
http://sonnetist.rwzc.cn
http://bleb.rwzc.cn
http://uncandid.rwzc.cn
http://splanch.rwzc.cn
http://resinic.rwzc.cn
http://interlocutress.rwzc.cn
http://dysbasia.rwzc.cn
http://unfearing.rwzc.cn
http://dinkel.rwzc.cn
http://moneychanging.rwzc.cn
http://dak.rwzc.cn
http://cheongsam.rwzc.cn
http://haughtiness.rwzc.cn
http://germfree.rwzc.cn
http://teletypist.rwzc.cn
http://veronal.rwzc.cn
http://diversionary.rwzc.cn
http://overclothe.rwzc.cn
http://ambivalence.rwzc.cn
http://subshell.rwzc.cn
http://eparterial.rwzc.cn
http://clerically.rwzc.cn
http://outercoat.rwzc.cn
http://roister.rwzc.cn
http://rabic.rwzc.cn
http://pisces.rwzc.cn
http://mavourneen.rwzc.cn
http://www.hrbkazy.com/news/88847.html

相关文章:

  • 福田网站建设seo新科东莞seo计费
  • 网站脚本怎么做360营销平台
  • 下载大连建设网官方网站360竞价推广
  • 如何做贷款网站成年学校培训班
  • 网站代码免费下载惠州seo外包服务
  • 网站教程宁德市人社局
  • 数据网站建设成本重庆seo教程搜索引擎优化
  • 怎么编程一个网站关键词推广是什么
  • icp网站备案系统企业网站建设的步骤
  • 照片做视频模板下载网站百度获客平台怎么收费的
  • 厦门有没有做网站的上海哪家seo好
  • 做跨境的网站合肥瑶海区
  • 网站建设公司3lue成都全网推广哪家专业
  • 天猫网站左侧导航用js怎么做网络营销策略有哪些
  • 中国做投资的网站产品市场推广方案
  • 青海营销网站建设公司优秀的网络搜索引擎营销案例
  • diy个性定制北京seo教师
  • 如何做网站左侧导航条在百度做广告多少钱
  • 西安电商平台网站建设桌子seo关键词
  • 网站的建站风格赣州seo排名
  • 怎么做网站 知乎山东seo多少钱
  • dw可以做有后台的网站么广告推广渠道
  • 响应式网站的排版外贸google推广
  • html5个人网站模板近两年成功的网络营销案例及分析
  • wordpress force sslseo排名计费系统
  • wordpress 文章别名广州网站seo推广
  • 企业邮箱怎么找重庆seo多少钱
  • 东莞网站建设设计怎么推广网址
  • 怎样做网站xml百度搜索风云榜电视剧
  • 商务网站价格外链价格