如何在Maven pom.xml中集成邮递员收藏

我有postman.collection.json文件,我可以通过newman并使用以下命令来运行这些集合文件。

   newman run test.postman.collection.json -e environment.collection.json -d test.csv 

它成功运行并给予回复。

我只想通过使用Maven系统来获得相同的行为,因为我需要将其与pom.xml集成,并且该文件将运行上述集合。

这可能吗?如果可以运行,请分享一些示例以实现相同的目标。

Yushujun 回答:如何在Maven pom.xml中集成邮递员收藏

Maven like thisthis有一些非官方的邮递员赛跑者。我从未尝试过其中任何一种,所以我不建议推荐其中任何一种。

我希望maven-exec-pluginintegration-testverify生命周期阶段运行邮递员/新人收集。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <executions>
        <execution>
            <id>integration-tests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>
                    <!-- PATH_TO_NEWMAN_EXECUTABLE-->
                </executable>
                <commandlineArgs>
                    run <!--PATH_TO_COLLECTION_JSON--> -e <!--PATH_TO_ENVIRONMENT_JSON-->
                </commandlineArgs>
            </configuration>
        </execution>
    </executions>
</plugin>
,

此外,您可以将可用的 newman 集成到 Maven docker 映像中并作为管道运行。

    spec:
  containers:
  - image: "miksonx/node-newman-maven"
    imagePullPolicy: "Always"
    name: "maven"
    tty: true
"""
...
   stages {
       stage('Unit Test') {
           agent{
               kubernetes {
                   yaml NodeNewmanMaven
               }
           }
           steps {
               container(MVN_AGENT) {
                   sh 'mvn clean integration-test'
               }
           }
    }

https://miksonx.wordpress.com/2021/04/19/postman-newman-using-maven-under-jenkins-kuberenets/

本文链接:https://www.f2er.com/3086182.html

大家都在问