Hypertest v2 Docs
HyperTest
  • Overview
    • How It Works?
  • SETUP GUIDE
    • Installation
      • Deploy HyperTest Server
      • Creating your first User
      • Adding your first service
      • Integrate SDK
        • Node.js
          • Node.js SDK with CJS
          • Node.js SDK with ESM
        • Java
    • Start a Test Run
      • CLI Login
      • Type References
      • Java
  • Interpreting Test Results
    • Test Results
    • Understanding Results Categories
    • Mock Not Found
    • AI Match Mocks
    • Accepting Changes
  • USER GUIDES
    • Node.js SDK
      • Limit memory usage
      • Supported NPM packages
      • Mock Dependencies Manually
      • Unmocking/Passing Through
      • Sampling and blocking requests
      • Manage Global Variables
      • Mocking Environment Variables
      • Tags
      • Set HTTP path patterns
      • Discard a test case(Request) while recording
      • Set Git Commit Hash
      • Code coverage based features
        • Continuous Coverage
        • Updating test coverage
        • Running post test deduplication
        • Only testing modified requests
        • Ignore differences for unmodified requests
      • Experimental flags
      • Manual Request
      • Only testing modified requests
      • Server hooks
    • Java SDK
      • Sampling and blocking requests
      • Mock Dependencies Manually
      • Tags
      • Unmocking/Passing Through
      • Code Coverage Setup and Report Generation
      • Supported Java packages
    • Build your own Docker Image
    • CLI Config
    • Ignoring Differences
      • Type References for Filter functions
  • Impact Features
    • Fast Mode
    • Code Coverage Report
    • Delete Recorded Requests
    • Inter Service Testing
  • Release History
    • Slack Integration
    • Version History
Powered by GitBook
On this page
  1. USER GUIDES
  2. Java SDK

Unmocking/Passing Through

This page documents how to tell the hypertest sdk to not mock certain parts of your code.

UnMocked Calls will be called as-is in both RECORD and REPLAY modes. Any network calls make inside the callback of executeUnmocked() would be actually made


import hypertest.javaagent.HypertestAgent;
/**
   .. code normally instrumented by hypertest
**/

// old code
// ResponseEntity<String> xmlResponse = restTemplate.postForEntity("https://myexampleurl.com/api/v1/sample", requestEntityXml, String.class);


// new code
HypertestAgent.executeUnmocked(() -> {
  // Anything called here is not captured/mocked by hypertest in any mode
  ResponseEntity<String> xmlResponse = restTemplate.postForEntity("https://myexampleurl.com/api/v1/sample", requestEntityXml, String.class);
  // the above http call would not be captured by hypertest during record mode.
  // it would actually hit myexampleurl.com in replay mode.
});
PreviousTagsNextCode Coverage Setup and Report Generation

Last updated 2 months ago