zoukankan      html  css  js  c++  java
  • 从reps下载jar,然后unzip test jar,再执行junit测试

    gradle脚本如下:

    dependencies {
        compile 'com.test.attachment:attachment:1.0-SNAPSHOT'
        compile group:'org.eclipse.emf.commonj', name:'sdo', version:'2.3+', ext:'jar'
        compile group:'org.eclipse.emf.ecore', name:'sdo', version:'2.3+', ext:'jar'
        
    }

    task unzip(type: Copy) {
        def zipPath = project.configurations.compile.find {it.name.startsWith("attachment")}
        println zipPath
        def zipFile = file(zipPath)
        def outputDir = file("${buildDir}/unpacked/dist")
        
        from zipTree(zipFile)
        into outputDir

        doLast {
            copy {
                from "${buildDir}/unpacked/dist/config.properties"
                into "."
            }
        }
    }

    sourceSets {
        test {
            java {
                srcDirs = ["${buildDir}/unpacked/dist"]
            }
        }
    }

    执行gradle unzip 从reps下载测试包attachment.jar以及依赖的包,然后unzip attachment.jar到build/unpackaged/dist目录,最后把执行junit时需要用到的config.properties拷贝到根目录。

    执行gradle test 会执行unzip后的目录下的junit test,在build目录下生成junit report。

    参考:https://stackoverflow.com/questions/23023069/gradle-download-and-unzip-file-from-url?newreg=3ae627393e9b47e09b97ddbd99785e8d

  • 相关阅读:
    钱到用时方恨少(随记)
    Ring0 打印log文件
    Mutation Testing(变异测试)
    GitHub
    常用js收藏
    ASP.NET初学者常用知识
    ASP.NET页面刷新方法总结
    C#中抽象类和接口的区别
    GridView 72般绝技
    55种网页常用小技巧
  • 原文地址:https://www.cnblogs.com/qdlk/p/7505119.html
Copyright © 2011-2022 走看看