码迷,mamicode.com
首页 > 其他好文 > 详细

ngrinder测试工具注意事项

时间:2019-06-27 09:21:41      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:import   turn   github   enables   不执行   asp   spring   creation   ofo   

1、下载源码

https://github.com/naver/ngrinder/releases
技术图片

2、导入idea

3、修改pom.xml文件:

<groupId>net.sf.grinder</groupId>
            <artifactId>grinder</artifactId>
            <version>3.9.1</version

4、源码出现报错修改:


import org.ngrinder.infra.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Dynamic creation of {@link PerfTestService} depending on the cluster enable or disable.
 *
 * @author JunHo Yoon
 * @since 3.1
 */
@Configuration
@Profile("production")
@EnableScheduling
@EnableTransactionManagement
@EnableAspectJAutoProxy
public class PerfTestServiceConfig implements ApplicationContextAware {

    @Autowired
    private Config config;

    private ApplicationContext applicationContext;

    /**
     * Create PerTest service depending on cluster mode.
     *
     * @return {@link PerfTestService}
     */
    @Bean(name = "perfTestService")
    public PerfTestService perfTestService() {
        if (config.isClustered()) {
            return applicationContext.getAutowireCapableBeanFactory().createBean(ClusteredPerfTestService.class);
        } else {
            return applicationContext.getAutowireCapableBeanFactory().createBean(PerfTestService.class);
        }
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }
}

顺利启动成功

技术图片

打包命令:
-DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下。
-Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类。
一 使用maven.test.skip,不但跳过单元测试的运行,也跳过测试代码的编译。
mvn package -Dmaven.test.skip=true

ngrinder测试工具注意事项

标签:import   turn   github   enables   不执行   asp   spring   creation   ofo   

原文地址:https://blog.51cto.com/357712148/2413924

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!