0

TestNG+Maven, I have a framework where a block of code generates the testNG.xml on runtime, so my problem is that when I execute the command - mvn test, it starts looking for the TestNG file which is still not there because the code to generate that TestNG.xml is yet not executed.

So I want to know an approach where whenever I execute mvn test, system should first execute a block of code (I already have that code which generates the TestNG.xml file) and pom.xml should pick the newly generated xml file and start running the test cases from newly generated testNG.xml.

Nikunj Aggarwal
  • 754
  • 2
  • 12
  • 32
  • Possible duplicate of [Can we execute exec-maven-plugin before maven-surefire-plugin?](https://stackoverflow.com/questions/41258985/can-we-execute-exec-maven-plugin-before-maven-surefire-plugin) – Krishnan Mahadevan Aug 05 '17 at 08:43
  • This looks like a duplicate of https://stackoverflow.com/questions/41258985/can-we-execute-exec-maven-plugin-before-maven-surefire-plugin – Krishnan Mahadevan Aug 05 '17 at 08:43

1 Answers1

0

You just need to create a .bat or .sh file. using these batch files you can trigger your first code and once it will complete the mvn command will be triggered.

below are some links which can help you to create a batch or sh file

https://fossbytes.com/what-is-a-batch-file-in-windows-how-to-create-a-batch-file/

https://askubuntu.com/questions/223691/how-do-i-create-a-script-file-for-terminal-commands/223698

Hope it will help you :)

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125