-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CC-34875: Dev performance Phase 2. SAPI tests.
- Loading branch information
1 parent
f2ab244
commit cd5fbb8
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import AbstractResource from './abstract.resource'; | ||
|
||
export default class ConcreteProductsResource extends AbstractResource { | ||
get(sku) { | ||
return this.getRequest(`concrete-products/${sku}`); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/tests/product-details/SAPI3_product_details_retrieve_information_1.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { group } from 'k6'; | ||
import OptionsUtil from '../../utils/options.util'; | ||
import { createMetrics } from '../../utils/metric.util'; | ||
import { ProductFixture } from '../../fixtures/product.fixture'; | ||
import EnvironmentUtil from '../../utils/environment.util'; | ||
import ConcreteProductsResource from '../../resources/concrete-products.resource'; | ||
|
||
const testConfiguration = { | ||
...EnvironmentUtil.getDefaultTestConfiguration(), | ||
id: 'SAPI3', | ||
group: 'Product Details', | ||
metrics: ['SAPI3_get_concrete_products'], | ||
thresholds: { | ||
SAPI3_get_concrete_products: { | ||
smoke: ['avg<400'], | ||
load: ['avg<800'], | ||
}, | ||
}, | ||
}; | ||
|
||
const { metrics, metricThresholds } = createMetrics(testConfiguration); | ||
export const options = OptionsUtil.loadOptions(testConfiguration, metricThresholds); | ||
|
||
export function setup() { | ||
const dynamicFixture = new ProductFixture({ | ||
productCount: 1, | ||
}); | ||
|
||
return dynamicFixture.getData(); | ||
} | ||
|
||
export default function (data) { | ||
const product = ProductFixture.iterateData(data); | ||
|
||
group(testConfiguration.group, () => { | ||
const concreteProductsResource = new ConcreteProductsResource(); | ||
const response = concreteProductsResource.get(product.sku); | ||
|
||
metrics[testConfiguration.metrics[0]].add(response.timings.duration); | ||
}); | ||
} |