Skip to content

Commit 8a4eecf

Browse files
authored
version bump, readme, core nuget update to 0.2.2
1 parent afda6e5 commit 8a4eecf

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.1.6</Version>
3+
<Version>0.2.0</Version>
44
</PropertyGroup>
55
</Project>

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
`QAToolKit.Engine.Bombardier` is a .NET standard library, which takes `IEnumerable<HttpTestRequest>` object and runs load tests with tool called [Bombardier](https://github.com/codesenberg/bombardier).
55

6-
Library is a thin wrapper, that generates requests and parses results so you can export them to whatever format you prefer.
6+
Library is a thin wrapper, that generates requests and parses results to JSON. You can process or import that JSON in other tools. We plan to release an exporter to CSV, HTML and maybe other formats.
77

88
Major features:
99

10-
- Library takes `IEnumerable<HttpTestRequest>` object, which can be produced in your code or can be imported from other sources. One example can be QAToolKit Swagger library that can produce that object with many options. Check it out [here](https://github.com/qatoolkit/qatoolkit-source-swagger-net).
11-
- Generate a Bombardier report that can be exported to the format you want.
10+
- Library takes `IEnumerable<HttpTestRequest>` object, which can be produced in your code or can be imported from other sources. One example can be `QAToolKit Swagger` library that can produce that object with many options. Check it out [here](https://github.com/qatoolkit/qatoolkit-source-swagger-net).
11+
- Generate a Bombardier report in JSON format.
1212

1313
Bombardier version [1.2.5](https://github.com/codesenberg/bombardier/releases/tag/v1.2.5) is used for `windows-amd64` and `linux-amd64`.
1414

@@ -82,6 +82,19 @@ Use `AddBasicAuthentication` if your APIs are protected by basic authentication.
8282
##### 1.4 AddReplacementValues
8383
When you use `AddReplacementValues` values those can set or replace URL and HTTP body parameters before executing the tests. Replacement values have precedence over the `example` values that are set in Swagger file.
8484

85+
For example, you can add replacement values dictionary to the `BombardierTestsGenerator`.
86+
87+
```csharp
88+
var bombardierTestsGenerator = new BombardierTestsGenerator(options =>
89+
{
90+
options.AddReplacementValues(new Dictionary<string, object> {
91+
{"api-version","2"},
92+
{"bicycleType","1"}
93+
});
94+
...
95+
});
96+
```
97+
8598
#### 2. Bombardier parameters
8699

87100
You can also set those `BombardierGeneratorOptions` options:

src/QAToolKit.Engine.Bombardier.Test/BombardierTestsGeneratorTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,29 @@ public async Task GenerateBombardierTestPostNewBikeTest_Successfull()
439439
Assert.Equal("https://qatoolkitapi.azurewebsites.net/api/bicycles?api-version=1", bombardierTests.FirstOrDefault().Url.ToString());
440440
}
441441

442+
[Fact]
443+
public async Task GenerateBombardierTestPostNewBikeCaseInsensitiveTest_Successfull()
444+
{
445+
446+
var bombardierTestsGenerator = new BombardierTestsGenerator(options =>
447+
{
448+
options.AddReplacementValues(new Dictionary<string, object> {
449+
{"bicycle",@"{""id"":66,""name"":""my bike"",""brand"":""cannondale"",""BicycleType"":1}"}
450+
});
451+
});
452+
453+
var content = File.ReadAllText("Assets/AddBike.json");
454+
var httpRequest = JsonConvert.DeserializeObject<IEnumerable<HttpRequest>>(content);
455+
456+
var bombardierTests = await bombardierTestsGenerator.Generate(httpRequest);
457+
458+
Assert.NotNull(bombardierTests);
459+
Assert.Single(bombardierTests);
460+
Assert.Contains($@" -m POST https://qatoolkitapi.azurewebsites.net/api/bicycles?api-version=1 -c 3 -H ""Content-Type: application/json"" -b ""{{\""id\"":66,\""name\"":\""my bike\"",\""brand\"":\""cannondale\"",\""BicycleType\"":1}}"" --http2 --timeout=30s --duration=5s", bombardierTests.FirstOrDefault().Command);
461+
Assert.Equal(HttpMethod.Post, bombardierTests.FirstOrDefault().Method);
462+
Assert.Equal("https://qatoolkitapi.azurewebsites.net/api/bicycles?api-version=1", bombardierTests.FirstOrDefault().Url.ToString());
463+
}
464+
442465
[Fact]
443466
public async Task GenerateBombardierTestPutUpdateBikeTest_Successfull()
444467
{

src/QAToolKit.Engine.Bombardier/QAToolKit.Engine.Bombardier.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
<ItemGroup>
3535
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
36-
<PackageReference Include="QAToolKit.Core" Version="0.2.1" />
36+
<PackageReference Include="QAToolKit.Core" Version="0.2.2" />
3737
<PackageReference Include="System.Text.Encodings.Web" Version="4.7.1" />
3838
</ItemGroup>
3939

0 commit comments

Comments
 (0)