Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I want to coe covergae of my test case which used SingleLaunchActivity in android

Mahavir Gupta April 26, 2016


public class MyActivityTest extends SingleLauncgActivtiy<MyMainProjectClassName> {

public MyActivityTest () {
super("com.hilti.android.plt.measure_and_record", MainMeasureAndRecordActivity.class);
}

}

2 answers

1 accepted

1 vote
Answer accepted
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2016

Hi, here's some tutorial describing how to turn on experimental code coverage for Android platform. However keep in mind that Android OS is not officially supported.

Sridhar Reddy June 9, 2016

Hi Grzegorz, the link you have provided is not understandable. Can you please share any example android code or example working script? 

Please help me out on this below questions..

How to generate instrumented Java classes of Android app from code? 

How it will generate the Clover.db file? and how to built the apk with the instrumented classes? 

Please help me out on this, Thank you!! Really appreciate your efforts !! 

 

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2016

Hello, here you have example code and tutorial how to integrate Ant or Maven with Clover. Regarding Java instrumentation, you can read about it in any of the following tutorials (depending which integration you'd like to use):

Proper source code instrumentation will generate clover.db which you can use. In order to build apk archive from instrumented sources, you need to follow any other typical build procedure. The only difference will be that you need to use instrumented sources, not the original ones.

Sridhar Reddy June 22, 2016

Hi @Grzegorz Lewandowski, I am looking for specific android example code?

If you have such code, can you please paste the link for the code? 

Thank you so much!!

shpnow shpnow September 17, 2016

I am trying through command promt

C:\Temp>java -Dclover.license.path=C:\Path\clover.license -cp C:\Temp\clover-run
time.jar com.cenqua.clover.CloverInstr ...
Error: Could not find or load main class com.cenqua.clover.CloverInstr

getting highlight error ..

I have db as well as their content.

Now from the command line i have to genrate report.

Can you please tell me the process.

I have clover.db + some file generated their.

 

 

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2016

Hi, you're trying to invoke CloverInstr main class but most probably it's not in the classpath. Please, make sure clover.jar is in the classpath of that java invocation. Please take a look at this Oracle tutorial how to achieve it. 

http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/classpath.html

shpnow shpnow September 18, 2016

My claspath of jave is 

C:\Program Files\Java\jdk1.7.0_45

so inside their is lib folder

I paste my colver .jar their 

After that i ran my command prompt

C:\Temp>java -Dclover.license.path=C:\Path\clover.license -cp C:\Temp\clover-run

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument

-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m
ore details.

C:\Temp>time.jar com.cenqua.clover.CloverInstr ...

 

I am getting above error.

 

Can u please elaborate in step by step

 

Thanks u so much for guding

0 votes
Mahavir Gupta April 26, 2016

It not working at all .

I have a android project in eclipse which have a test class like below

public class MainMeasureAndRecordActivityTest extends SingleLaunchActivityTestCase<MainMeasureAndRecordActivity> {

private static MainMeasureAndRecordActivity activity;
private long projectId;
private ContentResolver contentResolver;
private long jobId;
private long projectUUID;
private Station station;
private long stationId;
MainMeasureAndRecordActivity activity2=new MainMeasureAndRecordActivity();

public MainMeasureAndRecordActivityTest() {
super("com.hilti.android.plt.measure_and_record", MainMeasureAndRecordActivity.class);
}

 

Error I am geeting SingleLaunchActivityTestCase not defined.I have to show my client at any cost.

 

Can you please help me out.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events