-
Notifications
You must be signed in to change notification settings - Fork 58
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
Supporting using different json files in Class/SubClass #242
Comments
Hi @patown, that's a very useful scenario which I haven't thought of. I guess you want The current hoverfly-java doesn't support it, but it's doable, as hoverfly already has a REST API for combining simulations (https://docs.hoverfly.io/en/latest/pages/reference/api/api.html#post-api-v2-simulation), that leaves us to make some tweaks in the library to support it. It's not going to have multiple hoverfly rules though, one hoverfly per test is recommended to avoid conflicts in proxy config. So something like this:
|
Hi Tommy,
Thank you for your mail.
This is very helpful.
Antony
At 2020-11-03 05:17:10, "Tommy Situ" <[email protected]> wrote:
Hi @patown, that's a very useful scenario which I haven't thought of. I guess you want logonRule to be invoked on all the subclasses, and then every subclass has a specific simulation too.
The current hoverfly-java doesn't support it, but it's doable, as hoverfly already has a REST API for combining simulations (https://docs.hoverfly.io/en/latest/pages/reference/api/api.html#post-api-v2-simulation), that leaves us to make some tweaks in the library to support it.
It's not going to have multiple hoverfly rules though, one hoverfly per test is recommended to avoid conflicts in proxy config. So something like this:
Public class TestBase() {
@ClassRule
public static HoverflyRule baseRule = HoverflyRule.inCaptureOrSimulationMode("logon.json");
}
public class TestA extends TestBase {
// Setup
baseRule.captureOrSimulate("TestA.json", ImportMode.APPEND);
}
public class TestB extends TestBase {
// Setup
baseRule.captureOrSimulate("TestB.json", ImportMode.APPEND);
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
How can we do this in Junit5 ? |
A TestBase class is commonly useful to setup shared test context . Hope Hoverfly could support this scenario below,
Public class TestBase() {
@ClassRule
public static HoverflyRule logonRule = HoverflyRule.inCaptureOrSimulationMode("logon.json");
}
public class TestA extends TestBase {
@ClassRule
public static HoverflyRule TestARule = HoverflyRule.inCaptureOrSimulationMode("TestA.json");
//
}
public class TestB extends TestBase {
@ClassRule
public static HoverflyRule TestBRule = HoverflyRule.inCaptureOrSimulationMode("TestB.json");
//
}
The text was updated successfully, but these errors were encountered: