接口自动化(第一回)配置 idea+maven+testng

1. 安装idea IDE,官网下载合适的版本https://www.jetbrains.com.cn/idea/

2. 创建新项目,试错法(少啥 就去下载安装啥)

 

 安装插件testNG

 

3. pom文件修改

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>myproject</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- TestNG dependency -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version> <!-- Use the latest version -->
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Maven Surefire Plugin for running tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version> <!-- Use the latest version -->
                <configuration>
                    <suiteXmlFiles>
                        <!-- Specify your testng suite XML file here -->
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

  如果爆红,maven刷新 ,重新导入

 

 

posted @ 2025-04-17 10:20  南柯南  阅读(26)  评论(0)    收藏  举报