vendredi 17 avril 2020

How to execute a TestNG test case outside a project, using Maven Multi module

I am working on a multi module maven project.

My Project Structure is as below -

Parent-Module (Packaging - pom)
BaseFramework (Packaging - jar)
TestProject (Packaging - jar) (Added BaseFramework as a dependency in pom.xml of the project)
TestRunner (Packaging - jar) (Added BaseFramework and TestProject as a dependency in pom.xml of the project)

TestProject has a testNG.xml file which executes the test cases of the specified class. Test cases uses Data providers and path is mentioned as relative path (./src/main/resources/pmRolDetailsWithId.xml)

TestRunner project has a Suite Runner file (lets say SuiteRunner.xml) Which contains the path of testNG.xml from (TestProject).

When executed, the test tries to find the "pmRolDetailsWithId.xml" file in TestRunner Project. Path - /TestRunner/src/main/resources/pmRolDetailsWithId.xml and the file is not found.

Expected it should fetch the file from TestProject . i.e. the path should be /TestProject/src/main/resources/pmRolDetailsWithId.xml

I think the root project is not getting changed when the test control goes form TestRunner Project - TestProject

Please correct me If I am missing something and help me to resolve this issue.

Attaching screenshot of the error.

enter image description here

Aucun commentaire:

Enregistrer un commentaire