Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Integration Test is not generating code coverage

  1. #1
    Junior Member
    Join Date
    Sep 2021
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Integration Test is not generating code coverage

    I have integration test like one sample given below. Is not generating code coverage. Any suggestion will be highly appreciated
        @Test
    	public void testgetUpdatedResultCodes() {
    		HttpMethod getMethod = new GetMethod(RESTURL_WEB_SERVER);
    		HttpClient httpClient = new HttpClient();
    		int result = httpClient.executeMethod(getMethod);
     
    		InputStream responseInputStream = getMethod.getResponseBodyAsStream();
    		BufferedReader in   = 
    			  new BufferedReader (new InputStreamReader(responseInputStream));
    		String line;StringBuilder data=new StringBuilder();
    		while ((line = in.readLine()) != null) {
    			data.append(line);
    			  MIAmandaAdapterGetUpdatedResultCodesTest.info("Response  is :"+line);
    		 }
     
    		 assertEquals(HttpStatus.SC_OK,result);
     
    	}
    Last edited by ashok.code; September 14th, 2021 at 12:47 PM. Reason: Sample code is missing

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Integration Test is not generating code coverage

    Sorry, I have no idea what you mean by "Integration Test is not generating code coverage"
    Can you define Integration Test?
    What does it mean to generate code?
    What do you mean by coverage?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Sep 2021
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Integration Test is not generating code coverage

    Can you define Integration Test?
    --We are trying to test a Rest api, and verify the response from the api as per the expectation and format that is understandable at the client side.
    What does it mean to generate code?
    --We are trying to execute test suit with following command, mvn clean test -Dtest=AllTests , and we are observing the jacoco report is showing zero code coverage
    What do you mean by coverage?
    --In coverage we are trying to achieve the following while running the tests
    how many of the functions defined have been called.
    how many of the statements in the program have been executed.
    how many of the branches of the control structures (if statements for instance) have been executed.
    how many of the boolean sub-expressions have been tested for a true and a false value.
    how many of lines of source code have been tested.

    PS: we want to get the details of the above coverage details by running the test suite , any more details required please revert.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Integration Test is not generating code coverage

    How would anyone compile and execute the code to see the problem?

    Do you have any output from the code that shows the problems you are having?
    What output are you expecting?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Sep 2021
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Integration Test is not generating code coverage

    How would anyone compile and execute the code to see the problem?
    -- We have to run the test suite with commands like - mvn clean test -Dtests=AllTests
    Do you have any output from the code that shows the problems you are having?
    ----we have jacoco reports configured which has zero code coverage.
    What output are you expecting?

    At least the code coverage report should be more than 80% for it to be working stable code.
    Last edited by ashok.code; September 16th, 2021 at 03:50 AM. Reason: unable to attach images

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Integration Test is not generating code coverage

    Move from What's Wrong with my code section.
    There does not appear to be code with a problem for this thread.

    Try asking your question at this site. There are more people there that know about mvn
    http://www.coderanch.com/forums
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how do I test my code on a tablet?
    By saveyourself1 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: June 12th, 2014, 01:08 PM
  2. Uncomplete code to test another program
    By Gerock7 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 17th, 2014, 12:51 PM
  3. Generating JNI code automatically (using a tool)
    By doofx in forum Java Native Interface
    Replies: 1
    Last Post: February 20th, 2014, 05:50 AM
  4. [SOLVED] How do I run test code in different file under a project
    By lostbit in forum Java Theory & Questions
    Replies: 1
    Last Post: September 28th, 2011, 11:31 AM