Re: [testng-users] Make TestNG project executable

33 views
Skip to first unread message

Cédric Beust ♚

unread,
Oct 10, 2022, 4:45:00 PM10/10/22
to testng...@googlegroups.com
What would that executable do?

-- 
Cédric


On Mon, Oct 10, 2022 at 6:19 AM Nilesh <nilesh...@siliconstack.com.au> wrote:
I have created a new project using testNG. i want to create an executable jar. do you have any reference article or sample project?

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/cf3f39c8-5643-4f49-95d4-979f062f7574n%40googlegroups.com.

zaw...@gmail.com

unread,
Oct 11, 2022, 8:44:20 AM10/11/22
to testng-users
Hey - actually I was able to successfully achieve more or less what You seem to be trying to achieve.
My goal was to create a precompiled, fat test jar that won't download all dependencies from nexyus on each maven test run. All the test code together with dependencies and source code is packed as a single jar using "maven-assembly-plugin".

I've used the given configuration descriptor: 
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>fat-tests</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>test</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}/test-classes</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>**/*.class</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>./suites</directory>
<outputDirectory>./suites</outputDirectory>
<includes>
<include>*.xml</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
<containerDescriptorHandlers>
<containerDescriptorHandler>
<handlerName>metaInf-services</handlerName>
</containerDescriptorHandler>
</containerDescriptorHandlers>
</assembly>

Then, I've created my own Test Runner that creates a new TestNG instance inside the main method. 

I think that should be a good starting point for Your further investigation.

Reply all
Reply to author
Forward
0 new messages