how to generate coverage.xml in jmockit? - java

I am using Jmockit for my unit tests and I have also included jmockit-coverage.jar in my classpath. Currently it generates the following files under 'coverage-reports' folder:coverage.css,coverage.js,index.html,logo.png,prettify.js
But its not generating coverage.xml. According to the document here - http://jmockit.googlecode.com/svn-history/r289/trunk/www/tutorial/CodeCoverage.html, I think I need to add 'jmockit-coverage-xmlfull.jar' in my class path. But I am not able to find that jar online. Its not available in jmockit download link.
Could you please let me know how to fix this issue?
Thanks,
Suresh

This link seems to be an older one showing an older svn revision number (r289). The latest one lies here http://jmockit.googlecode.com/svn-history/trunk/www/tutorial/CodeCoverage.html#output. Looks like it supports html as of now, but could not find xml. Basically the jmockit-coverage-output property is used to decide the output.
If you really need the xml version, you might need to download an older version which has all the jars. Try this link.
https://jmockit.googlecode.com/files/jmockit-0.993.zip

Related

How to setup allure for selenium +TestNG+java project?

I used extent report with java selenium for the automation testing but I would like to try allure reporting. Can anyone please explain to me how to setup Allure+ TestNG+ selenium in eclipse for automation?
Does it supports only maven based projects or even for java projects as well we can do it? Thanks
There is no pom.xml file in my current java project ...so this is a doubt if I can implement
It's fairly simple. If you don't have a pom that means you are possibly using ant to build your tests. That's not an issue. What you can do is, download the allure .jar file. Add it to your project and off you go. With allure, there is no setup required. You will, however, need to implement annotations in your classes where you would like allure yo log things.
Here is an example :
Allure will then log your tests and steps as you would suspect natively. If you want screenshots and all the other goodies you would need to implement it. The docs can help with this part.
Here is the link to the jar file for allure - https://jar-download.com/artifact-search/allure-testng
Have a nice day!
If you are not using pom, then based on latest version which is available at the time you need following JAR files to be added in build path of your project in eclipse .
In my example I would be using version 2.9.0
allure-testng-2.9.0.jar
allure-model-2.9.0.jar
allure-java-commons-2.9.0.jar
allure-descriptions-javadoc-2.9.0.jar
sl4j-api-1.x.x.jar
Finally you need allure-commandline-2.9.0.zip .choose same version which you have downloaded above files.
Extract and set the path as described in the link -https://docs.qameta.io/allure/#_manual_installation
Hope It helps! Thanks

Info about version dependancies of enterprise java libraries

I am new to enterprise application developement and trying to create a REST server with Spring REST, JPA taking to mySQL database and Javascript on the client side. As I see loads of opensource libraries doing specific task, I started off with using 'maven project' with different 'arch type' (which is nothing but predefined POM with relevent libraries as I understand) provided by Eclipse. But I often run into version mismatch issues, in many cases found specific solution to that perticular libraries in StackOverflow or other sites.
Hence I started looking for a information these version dependancies such as, this version of JPA works with that version of Hibernate library and so on. I checked maven repository of major libraries, I did not find such information so far.
My queries are:
Where can I find these information about the versions dependancies?
Are these pre defined POM in eclipse reliable? Who owns them, where can I get last modified dates on these maven 'arch types'? (I find the ones I choose having fairly old version of libraries).
If I have to start off on my own creating a Maven dependacies, where will I get information about what are the dependent libraries, for example, if I need spring MVC, for sure it needs java servlet library. I am worried becuase the maven 'spring-mvc-jap' arch type whooping 50 libaries as dependancies.(Coming from embeded domain, I find to too hard to digest :D). So not sure if it is the right way.
Please correct if I am missing anything in my understanding.
You can find this information, if you are using maven and some IDE you can go to the dependancy and make click un > and this will show the librarys used for this dependancy or if you want to use the console you have http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html this will show the same that the IDE.
After normally in the documentation of the library used, you can find some doc about the dependancy about this.
Other solution is get the .jar and use 7zip to see the POM and know the dependancy used.
And for finish my answer if the IDE tell you that you dont have x dependancy normally you have to add this because any of the other dependancy used have it (they used only for the compiling task), but sometime somes projet change a lots of code between the version .a to .b so you will have some problem using the version .b, at this moment i didnt find one good and easy way to fix this, only using the way that i told you (only if i found some problem in the compilation)
3> I am not sure how it works in eclipse but in IntelliJ IDEA when you start using some class without proper dependency IDEA suggest you to add proper dependency automatically. The same approach should be in eclipse.

Need help to integrate a particular vendor's Javadoc to Eclipse

I'm working on big Java enterpriseware (MatrixOne / ENOVIA V6, if you mind). The maintainers provide some kind of Javadoc, which looks like very vanilla Javadoc, and I can read it as HTML in my browser.
However, I'm unable to integrate it to Eclipse, which is painful because I have to make round-trips to my browser. In Eclipse, I just get the dreaded Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.:
After learning that Javadoc can be defined at project and .jar level, I tried to do both, knowing that:
the javadoc folder contains a package-list file, which seems to sanely define the documented packages
the javadoc folder contains the typical folder/subfolder package structure, itself containing ClassName.html files. E.g. the com.matrixone.apps.domain line of my package-list file is matched by a com/matrixone/apps/domain structure, containing lots of ClassName.html files
the javadoc folder doesn't contain a index.html file
When I try to define my Javadoc, the Validate... button fails because of a missing index.html. Then if I create a dummy index.html file, validation works, but I still cannot see the Javadoc when hovering a vendor class/method.
So my question is: What's missing to get this skewed Javadoc to display in Eclipse? Sub-questions I see at this point are:
Was it a bad idea to create a dummy index.html file? If yes, what should I do? (i.e. what tags/meta-information does Eclipse expect?)
A quick comparison of a standard Javadoc file (String.html) vs. one of those vendor Javadoc (DomainObject.html) reveals that meta-information possibly used by Eclipse is absent from my javadoc. For example, my vendor Javadoc includes none of the many <meta> tags present in the String.html Javadoc <head>.
→ Does somebody know the logic/heuristic used by Eclipse to fetch a method/class Javadoc? Maybe point me to the code? With this information I may be able to figure out what's wrong in my Javadoc, and hopefully fix it.
Anything you see fit if you ever faced a similar problem.
I'm currently using Eclipse Juno SR1 on Java 7, under Windows 7.
Of course, feel free to comment to ask for information I forgot to include. Thanks for your help!
I had a similar problem; however, I didn't try to solve it by using a local copy of the JavaDoc for JDOM. Instead, I was trying to use the appropriate URL (the JavaDoc URL for the current version of JDOM is http://jdom.org/docs/apidocs/). So, on the jdom.jar library in the Java Build Path configuration for my Eclipse project, I configured the URL and hit the Validate button. Eclipse seemed to think it was valid, but I still got the same error about not having any attached JavaDoc.
I then discovered that jdom.org also has the JavaDoc for an older version of JDOM (http://www.jdom.org/docs/apidocs.1.1/). So, I tried that on the jdom.jar library JavaDoc configuration and that worked!
The lesson I learned was that the version of the library appears to be taken into consideration when Eclipse is deciding whether the configured JavaDoc is utilized (considered to be attached or not). Make sure the library version matches the version of the JavaDoc for the library (seems obvious now that I've found it).
Hope this helps.

Generating jaxb classes from a schema

I am trying to use the Jaxb classes generator in eclipse to generate jaxb classes from my schema.
I receive the following error:
"The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.
Please insure that a JAXB implementation is available on the classpath."
How can i solve this problem?
After a lot of research here is what I have done to fix the issue.
Windows> Preferences> Java> InstalledJREs...make sure to point your jre to the jdk directory. I was pointing to JRE and as soon as I changed it to JDK, it started working.
Hope this will help you guys.
Make sure to include the jaxb-impl.jar library in your project. You can download one for example from here:
https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar
If you're using Maven, you can include this as a dependency, otherwise download the file and add it as a library in your project.
If you need a different version of the library, move up one directory in the link that I added above, you can find other versions there as well.
If you want to automate the class generation, since you're changing the schema on a regular basis, you should automate the process, e.g through Maven.
Windows> Preferences> Java> InstalledJREs > Execution Environment. Select an environment JDK 1.8 and then try to create JAXB Classes.
Click on Below Image Link For Details.
Select the execution Environment
Put the tools.jar in the classpath of the projecct (where the generated code will reside).
I found an explanation here https://bugs.eclipse.org/bugs/show_bug.cgi?id=345617
It does not work because Eclipse only puts the JRE libraries in the classpath of the project. Since the xjc code is in tools.jar you need to provide this extra step.
Download com.springsource.com.sun.tools.xjc-2.1.7.jar
and configure the build path.
This solved the warning and the error for me. Hope this helps.

Jmeter - how to implement another java class

Greetings all,
In another post I asked about rendering PDF in Jmeter, and it would seem the solution is to use iText.
Using iText requires installing another library and referencing it. Does anyone know how to do this? I can't find a tutorial. Much thanks. iText is also dependent upon bouncycastle
iText: http://www.1t3xt.com/downloads/index.php
iText dependency: http://www.bouncycastle.org/latest_releases.html
You just need to add it to your classpath when running JMeter. Unfortunately in the jmeter.bat or jmeter.sh they run JMeter using the -jar flag which will ignore your custom classpath. To get around this you need to simply include the ApacheJMeter jar in your class path and run the class org.apache.jmeter.NewDriver as your starting class.

Categories

Resources