Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add deduplication in java according to v2 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Sarthak160 wants to merge 3 commits into main
base: main
Choose a base branch
Loading
from feature007

Conversation

@Sarthak160
Copy link
Member

@Sarthak160 Sarthak160 commented Feb 1, 2024
edited
Loading

Related Issue

  • Info about Issue or bug

Closes: #[issue number that will be closed through this PR]

Describe the changes you've made

  • This PR also contains changes in Junit test file. Earlier there were lot of functions which can be hidden from the user. But now we have to call only one function inside the keploy test file -
import com.example.demo.SamplesJavaApplication;
import com.example.demo.controller.EmployeeController;
import com.example.demo.exception.ResourceNotFoundException;
import com.example.demo.model.Employee;
import com.example.demo.repository.EmployeeRepository;
import io.keploy.cli.KeployCLI;
import io.keploy.cli.KeployCLI.TestRunStatus;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.ResponseEntity;
import org.junit.jupiter.api.Order;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.http.HttpClient;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
class SamplesJavaApplication_Test {
 
 @Test
 @Order(Integer.MAX_VALUE)
 public void testKeploy() throws IOException, InterruptedException {
 String jarPath = "target/springbootapp-0.0.1-SNAPSHOT.jar";
 String[] testSets = KeployCLI.FetchTestSets();
 if (testSets == null) {
 System.err.println("Test sets are null ");
 return;
 }
 System.out.println("TestSets: " + Arrays.asList(testSets));
 KeployCLI.runTestsAndCoverage(jarPath, testSets);
 }
}
  • Command use to run the tests along with coverage is -
sudo -E env PATH=$PATH enterprise test -c "mvn test" --coverage --delay 20
  • After the successful build of mvn and if all keploy tests pass we can see the coverage report to be created at target/site folder . Here you can analyse through coverage reports present at target/site/e2e-ut-aggregate/index.html in the form of HTML .

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How did you test your code changes?

Please describe the tests(if any). Provide instructions how its affecting the coverage.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

A clear and concise description of it.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas and used java doc.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Screenshots (if any)

Original Updated
original screenshot updated screenshot

Signed-off-by: Sarthak160 <rocksarthak45@gmail.com>
Signed-off-by: Sarthak160 <rocksarthak45@gmail.com>
@@ -0,0 +1,8 @@
package io.keploy.cli;
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck> reported by reviewdog 🐶
Missing package-info.java file.


public class KeployUtils {


Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck> reported by reviewdog 🐶
Line has trailing spaces.

return Integer.parseInt(processName.split("@")[0]);
}

public static void runTestsAndCoverage(String jarPath, String[] testSets) {
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

return Integer.parseInt(processName.split("@")[0]);
}

public static void runTestsAndCoverage(String jarPath, String[] testSets) {
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter jarPath should be final.

return Integer.parseInt(processName.split("@")[0]);
}

public static void runTestsAndCoverage(String jarPath, String[] testSets) {
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter testSets should be final.

}
}

private static void waitForTestRunCompletion(String testRunId) {
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter testRunId should be final.


private static void waitForTestRunCompletion(String testRunId) {
// Implement the logic to wait for test run completion using KeployCLI
long MAX_TIMEOUT = 6000000; // 1m
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck> reported by reviewdog 🐶
Name 'MAX_TIMEOUT' must match pattern '^[a-z][a-zA-Z0-9]*$'.


private static void waitForTestRunCompletion(String testRunId) {
// Implement the logic to wait for test run completion using KeployCLI
long MAX_TIMEOUT = 6000000; // 1m
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck> reported by reviewdog 🐶
'6000000' is a magic number.

KeployCLI.TestRunStatus testRunStatus;

while (true) {
Thread.sleep(2000);
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck> reported by reviewdog 🐶
'2000' is a magic number.

System.out.println("Test run passed");
}
} catch (InterruptedException e) {
System.err.println("Error waiting for test run completion: " + e.getMessage());
Copy link

@github-actions github-actions bot Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 91).

Signed-off-by: charankamarapu <kamarapucharan@gmail.com>

try {
KeployCLI.FindCoverage(testSet);
Thread.sleep(5000);
Copy link

@github-actions github-actions bot Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck> reported by reviewdog 🐶
'5000' is a magic number.

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

8 similar comments
Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

⚠️ Oops! We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

keploy-staging bot commented Apr 14, 2025
edited
Loading

Nice Pr 😄. We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

3 similar comments
Copy link

Nice Pr 😄. We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

Nice Pr 😄. We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Copy link

keploy bot commented Apr 15, 2025
edited
Loading

Nice Pr 😄. We currently support Unit Test Generation only for Go projects.
Stay tuned – support for more languages is coming soon! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments

@gouravkrosx gouravkrosx Awaiting requested review from gouravkrosx

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /