How to write a Tear down groovy script with maven dependent classes
Hi,
I have a tear down script which is as below:
From Soatest perspective if i add the java project in the system properties, it identifies the jar files and the groovy script execute fines.
But how can I do it from Java perspective with a maven command. For instance, in the above code LoggerMainImpl class is the one I am getting from the maven dependency.
Comments
-
Can you please see the earlier response from @jakubiak?
https://forums.parasoft.com/discussion/3530/how-to-use-soatest-extension-tool-with-mavenWhen driving test execution from soatestcli or from the Parasoft maven plugin, you must specify jars in your localsettings.properties file. There is no option to automatically pick up jars from dependencies in a maven pom.xml. However, without listing jars in the localsettings.properties file, SOAtest will automatically pick up any jars added to any /TestAssets/system_jars folder in the workspace.
In case this helps, if you would like to dump all the dependencies (including transitive ones) to a folder then you can run a maven command like this:
mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=system_jars1 -
Thanks @benken_parasoft and @jakubiak . I followed that i need to add the path of the jars in the localsettings file.
Now the next question is can we make this path generic so that with maven command i can execute it on any machine? Kindly let me know if this can be done.0 -
Now the next question is can we make this path generic so that with maven command i can execute it on any machine?
You can use variables in the paths in your localsetings file, including one called "env_var" which can reference shell/environment variables. For example, ${env_var:HOME}/path/to/somejar.jar. Some are described in Using Variables in Preference Settings.
Alternatively, I've also seen users have a localsettings property file that is a template, where they use a little script to perform their own string/token replacements to generate the final version with final values/paths injected as a step prior to executing soatestcli.
1 -
Hi,
I tried the suggestions given in the above comment but i could not implement it. Please see below the requirement.
I am able to point to the files using the below entries in the localsettings
system.properties.classpath=C:\Users\!username\parasoft\workspace\dynamite\Automation_Code;C:\Users\username\.m2\repository\com\abc\selenium\logtransactions\1.6-SNAPSHOT\logtransactions-1.6-SNAPSHOT.jarHowever, when I am attempting to parametrize it using the below entries
system.properties.classpath=${project_loc}\..\dynamite\Automation_Code;${env_var:USERPROFILE}\.m2\repository\com\abc\selenium\logtransactions\1.6-SNAPSHOT\logtransactions-1.6-SNAPSHOT.jar
it is not working.Could someone please let me know what I am doing wrong here
0 -
"project_loc" takes a parameter. For example, ${project_loc:NameOfMyProject}. The name of your project should appear in the .project file next to the pom.xml
Please also recall that this is a java properties file where backslash is an escape character. Any backslashes in file paths need to be escaped with an extra backslash. Alternatively, using forward-slash in file paths instead of backslash also generally works.
1 -
Thanks a lot @benken_parasoft . With implementing the above comments, it is working.
0