Questions tagged [betamax]

"Betamax is a tool for mocking external HTTP resources such as web services and REST APIs in your tests. The project was inspired by the VCR library for Ruby"

Betamax is a tool for mocking external HTTP resources such as web services and REST APIs in your tests. The project was inspired by the VCR library for Ruby

The official site for Betamax

13 questions
3
votes
1 answer

"Illegal use of nonvirtual function call" when using Betamax

I'm trying to set up Betamax in a Spring Boot application, but when I run my test, I get this error: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang/Object;) Illegal use of…
JimiJonJimbo
  • 43
  • 2
  • 5
3
votes
1 answer

Read a YAML file in Groovy

I am trying to load an existing YAML file (which uses snakeYaml library) in my Groovy project. I have a class called YamlTape.groovy which contains method to load the YAML file using the following code. static YamlTape readFrom(Reader reader) { …
Warrior
  • 39,156
  • 44
  • 139
  • 214
2
votes
0 answers

Example for mocking apache HTTPS request using Betamax version 2.x in java?

I am trying to mock Apache HTTPS calls in Java, using Betamax 2.x. The old documentation is deprecated, and the docs for 2.x are still in progress. Can someone help with an example of how this can be done?
hemanik
  • 965
  • 3
  • 14
  • 33
2
votes
1 answer

Stubbing SOAP requests in Scala

I use scalaxb to generate models and client part of the SOAP interface. For testing I use Betamax, which can also be used in Scala. However, scalaxb uses Netty as a transport, which ignores proxy settings set up by Betamax. How would you cope with…
mirelon
  • 4,896
  • 6
  • 40
  • 70
1
vote
1 answer

Mocking the requests for testing in Scrapy Spider

My objective is to test the spider written using scrapy (Python). I tried using contracts but it is really limited in the sense that I can not test things like pagination or whether some attributes are extracted correctly or not. def parse(self,…
Riken Shah
  • 3,022
  • 5
  • 29
  • 56
1
vote
1 answer

How do I configure Betamax to use SSL for my Spock tests?

I have been trying to configure Betamax v2.0.0-alpha-1 to mock HTTP(S) calls from my spock tests. Calls to non-SSL sites work but a call to an HTTPS site causes the following exception: javax.ws.rs.ProcessingException:…
Duncan
  • 45
  • 5
1
vote
2 answers

Betamax with Spring Boot throws Illegal use of nonvirtual function call

I'm trying to setup a simple test in Groovy with Spock using Betamax: class BetaMaxSpockTest extends Specification { @Rule public Recorder recorder = new Recorder() @Betamax(tape = "some_tape") def 'You shall pass'() { …
raduy
  • 482
  • 5
  • 11
1
vote
0 answers

Betamax is not recording in Grails

I have a class that contains a RESTClient, and it performs a simple get request. The test is built as follows @Rule Recorder recorder = new Recorder() @Betamax(tape = 'meetupEventsList') void testListEvents() { when: def instance = new…
monksy
  • 14,156
  • 17
  • 75
  • 124
1
vote
2 answers

Betamax fails to record HTTPS traffic

My question is connected with Betamax library. I have problem with recording HTTPS traffic. I am using Betamax 1.1.2, JDK 1.6, Groovy 2.2.2 and jUnit 4.11. My test code: @Rule public Recorder recorder = new Recorder(); @Before public…
0
votes
1 answer

Betamax HTTPS Recording with Proxy - Certificate Error - Java Groovy

I can't get HTTPS URL's working with betamax. It's similar to this other issue posted below, however I've already done the betamax.pem file import and it seems to have had no effect: Here's the import command I ran:…
solvingJ
  • 1,321
  • 1
  • 19
  • 30
0
votes
0 answers

Using Betamax to record HTTP traffic from browser?

The betamax documentation seems to imply that the only way betamax can be/is meant to be used is through jUnit tests. But I hope that's not the case. I want to use betamax to record the http traffic a user experiences through the browser,…
Waffles
  • 349
  • 1
  • 8
  • 19
0
votes
0 answers

Betamax is not recording calls to RESTClient in Grails

I have a Betamax test that I'm trying to configure to intercept calls to a web service that is using RESTClient. The calls to the web service aren't getting recorded. My test code looks like this: @Betamax(tape = 'pending_transfer_success') …
user1866924
  • 431
  • 5
  • 17
0
votes
2 answers

How do I write this Maven exclusion code in Gradle?

I'm trying to use the latest (master) version of Betamax in a Spring Boot project, and I'm getting the error SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.. So I looked at the top…
JimiJonJimbo
  • 43
  • 2
  • 5