[Solved] Không thể import testng framework vào maven project trong intellij idea

  • Em tạo một maven project chứa các module con nằm trong đó
    file pom.xml của module cha
<properties>
	<testng.version>6.8.8</testng.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.testng</groupId>
		<artifactId>testng</artifactId>
		<version>${testng.version}</version>
		<scope>test</scope>
	</dependency>
</dependencies>
  • module con em có file pom.xml
 <parent>
 	<relativePath>../pom.xml</relativePath>
 </parent>
  • Khi em viết một class trong thư mục test của module con thì không thể import được testng framework cụ thể là khi viết @Test (org.testng.anotations.*) thì bị lỗi

    , mà rõ ràng em đã thấy file jar của testng được load vào project rồi.
  • Em cũng đã google cho lỗi này nhưng cũng không thể fix được:
    https://github.com/cbeust/testng/issues/1458
  • Mong anh/chị giúp đỡ em với ạ. Em xin cảm ơn :slight_smile:
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?