Jboss Fuse and Cobertura - cobertura

I have my application which runs in Jboss Fuse on Linux. I deploy my artifacts as jar files under the /deploy directory. I was planning to make use of Cobertura to get code coverage report after executing my jmeter tests. I instrumented my jars and placed under /deploy. I ran my jmeter tests.
Now I am unable to find the location where .ser file will be present.
I tried searching inside fuse directory.
Can anyone help me in getting Cobertura working with Jboss Fuse?

For most versions of Cobertura, you can add:
-Dnet.sourceforge.cobertura.datafile=<filename>.ser
to the JBoss/JVM startup parameters (e.g. run.conf) to specify explicitly the file where you want the report to be created.
Also, you need to make sure the cobertura.jar itself is present in the classpath if you haven't done so yet.

Related

Set Glue Code to External Libraries in Cucumber

We have multiple testing repos, and some of the scenarios depend on the steps already created in a separate repo, so I'm trying to build the JAR file and include it in the external libraries of the other repo. Then I define my gluecode in the IntelliJ runner with two separate lines:
com.edge.automation
C:\Users\MY_NAME\.m2\repository\com\reissue-automation\2.0.3-SNAPSHOT\reissue-automation-2.0.3-SNAPSHOT-tests.jar!\com.reissue.automation.stepdefinitions
IntelliJ is able to recognize the Gherkin sentence, but when I run it, it is throwing this exception:
eissueautomationstepdefinitions'
at io.cucumber.core.options.CucumberPropertiesParser.parseAll(CucumberPropertiesParser.java:156)
at io.cucumber.core.options.CucumberPropertiesParser.parse(CucumberPropertiesParser.java:88)
at io.cucumber.core.cli.Main.run(Main.java:48)
at io.cucumber.core.cli.Main.main(Main.java:33)
Does anybody know what this error means or if it's possible to include glue code from external libraries?
I ended up running the following command to copy my dependencies into the target folder which added it to the classpath.
mvn install dependency:copy-dependencies -DskipTests
Then it picked up the glue no problem.
com.edge.automation
com.reissue.automation.stepdefinitions
If anyone has a better solution feel free to post.
May you add the detailed steps on how you accomplish it?
I tried running
mvn install dependency:copy-dependencies -DskipTests
And then running my maven command for running the test cases and not luck.
If you can add your folder structure and how you put it in the glue code of cucumber runner will be appreciated.
Also cucumber version might help.
Thanks

Running gauge tests from jar file

I am new to gauge testing tool .I have a maven project that consists of specs and step implementations. Mvn package phase does generate a jar file with all the required classes. However I cant figure out how i can run the gauge specs using a Main class in java, such that i can just run the jar file to run the tests. Is this possible?
Unfortunately no, Gauge binary must be installed and available to execute the specs.
As the Gauge binary is not written in java it cannot be bundled in a jar file and invoked from a Main class.
If you'd like to automatically download and use Gauge in a CI/CD environment, try something like https://github.com/maven-download-plugin/maven-download-plugin to download gauge into a convenient location as part of your mvn build itself.
More info about this here
There is a way to do this. You have to package maven and gauge inside the project directory and include them in the jar. In the main method, unzip all files, then run a shell script to export maven and gauge in the project directory to $PATH, then execute mvn gauge:execute as usual. It's a bit of a hack as it extracts everything to the directory in which the jar is located, but it works on RHEL 7 and I haven't managed to find a cleaner method.

External log4j property file with Jetty

I'm migrating a bunch of our webapps (run in Jetty) from log4j to slf4j. Previously, log4j would find the log4j.properties file from jetty.home/resources/log4j.properties. After moving to slf4j, the external log4j.properties file is not found and everything is getting logged to stderror.
If I build the same log4j.properties file inside the war, everything works as expected (and as it did previously). What am I doing wrong? I'd like to use an external logging config in jetty.home/resources as opposed to building it into the war.
In each webapp war, I have log4j-1.2.17, slf4j-api-1.7.10 and the binder slf4j-log4j12-1.7.10.
The Jetty start.ini is OPTIONS=Server,jmx,resources,websocket
I was able to resolve this by adding the -Dlog4j.debug java option to the start-up script. In doing so, I found that log4j was picking up a log4j.properties file from within the war that had been added for test.
The two options I found for fixing this were either remove the embedded config file, or add a start-up option. I was able to move module's log4j file to it's root so that it was excluded from the maven build. This way, it is still available locally (for test) but not built into the war.
The other option that worked was to add -Dlog4j.configuration=file:resources/log4j.properties
to the start-up options. This approach seems a bit convoluted but will override the embedded file.

Would JRebel work with this project setup?

we have a project where we use Maven to deploy to Tomcat on mvn clean install. I'm fairly new to Java development and finding it difficult to continually wait for install to complete to view changes. I use IntelliJ and I think the class files are only created during mvn install in the target directory.
Is it possible to use JRebel so when I save a file in IntelliJ the compiled class updates Tomcat immediately like they show on the JRebel video?
Thanks
IntelliJ saves the file automatically for you. All you need to do is to recompile the changed classes and these will be picked up by JRebel, given you have included rebel.xml configuration file into the deployed archive.

Error with cssparser-0.9.5.jar in Netbeans using richfaces/JSF

For some reason when I make minor chances to the title or anything linked to css I get the following error:
Deleting directory C:\Users...
C:\Users...\nbproject\build-impl.xml:1057: Unable to delete file
C:\Users...\build\web\WEB-INF\lib\cssparser-0.9.5.jar
BUILD FAILED (total time: 6 seconds)
Line 1057: <delete dir="${build.dir}"/>
I undid the changes but the error seems to persist.
Why would it want to delete the cssparser jar file?
What's the solution to the problem.
I am using Richfaces in JSF using Netbeans as my IDE, thanks.
By default, NetBeans does a Clean to the project, that means NetBeans will try to delete the compiled files and any libraries it has copied into the deploy directory. In Windows, NetBeans can't find the deploy dir and shows this error, specially when this dir is inside My Documents. I recommend you to change your project directory, or just performing Run or Debug, these commands will Compile, Build, Deploy and Launch your application so there won't be the Clean error.
For more info, see http://forums.netbeans.org/topic39444.html

Resources