Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

README.md

CodeSV

CA CodeSV is a new, lightweight way to define virtual services and save valuable time.

At the core, CodeSV delivers a simple yet powerful Java library that provides an easy to use API so you can create and run virtual services as a part of jUnit testing.

You can create and run HTTP virtual service definitions directly in your unit testing code.

Even better, the HTTP virtual services are completely transparent to an application under test. This means you don't have to make any other configuration tweaks.

How to use CodeSV

Share ideas and raise issues

Code Example

Here is a simple example of a jUnit test running an embedded virtual service using CodeSV.

import static com.ca.codesv.protocols.http.fluent.HttpFluentInterface.*;
import static org.junit.Assert.*;

import com.ca.codesv.engine.junit4.VirtualServerRule;
import org.junit.*;

public class ExampleTest {

  @Rule
  public VirtualServerRule vs = new VirtualServerRule();

  @Test
  public void exampleTest() {
    // virtual service definition
    forGet("http://www.example.com/time").doReturn(
        okMessage()
            .withJsonBody("{\"timestamp\":1498838896}")
    );

    // application connects to http://www.example.com/test and retrieves JSON response
    int currentTimestamp = Application.retrieveCurrentTimestamp();

    // received timestamp check
    assertEquals(1498838896, currentTimestamp);
  }
}

About

A fluent Java API for virtualizing HTTP services. Service virtualization simplified. No endpoint configuration. Import/export of request-response pairs.

Resources

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages

You can’t perform that action at this time.