Skip to content

Commit 5e7f270

Browse files
committed
code refactoring
1 parent a35474d commit 5e7f270

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/QAToolKit.Engine.Bombardier/BombardierTestsGenerator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using QAToolKit.Core.Helpers;
2-
using QAToolKit.Core.Interfaces;
1+
using QAToolKit.Core.Interfaces;
32
using QAToolKit.Core.Models;
43
using QAToolKit.Engine.Bombardier.Helpers;
54
using System;
@@ -23,7 +22,7 @@ public BombardierTestsGenerator(Action<BombardierOptions> options)
2322
}
2423

2524
/// <summary>
26-
/// Generate a Bombardier script
25+
/// Generate a Bombardier script from requests
2726
/// </summary>
2827
/// <returns></returns>
2928
public async Task<IEnumerable<BombardierTest>> Generate(IList<HttpTestRequest> restRequests)

src/QAToolKit.Engine.Bombardier/BombardierTestsRunner.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public BombardierTestsRunner(IList<BombardierTest> bombardierTests)
1919
_bombardierTests = bombardierTests;
2020
}
2121

22+
/// <summary>
23+
/// Run Bombardier tests
24+
/// </summary>
25+
/// <returns></returns>
2226
public async Task<IList<BombardierResult>> Run()
2327
{
2428
var bombardierResult = new List<BombardierResult>();

src/QAToolKit.Engine.Bombardier/Helpers/GeneratorHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ internal static string GenerateAuthHeader(HttpTestRequest request, BombardierOpt
136136
return authHeader;
137137
}
138138

139-
internal static string GetOauth2AuthenticationHeader(Dictionary<AuthenticationType, string> accessTokens, AuthenticationType authenticationType)
139+
private static string GetOauth2AuthenticationHeader(Dictionary<AuthenticationType, string> accessTokens, AuthenticationType authenticationType)
140140
{
141141
string authHeader;
142142
if (accessTokens.ContainsKey(authenticationType))
@@ -146,13 +146,13 @@ internal static string GetOauth2AuthenticationHeader(Dictionary<AuthenticationTy
146146
}
147147
else
148148
{
149-
throw new Exception("One of the access token is missing.");
149+
throw new Exception($"One of the access token is missing (AuthenticationType {authenticationType.Value()} required).");
150150
}
151151

152152
return authHeader;
153153
}
154154

155-
internal static string GetBasicAuthenticationHeader(BombardierOptions bombardierOptions)
155+
private static string GetBasicAuthenticationHeader(BombardierOptions bombardierOptions)
156156
{
157157
string authHeader;
158158

@@ -164,13 +164,13 @@ internal static string GetBasicAuthenticationHeader(BombardierOptions bombardier
164164
}
165165
else
166166
{
167-
authHeader = String.Empty;
167+
throw new Exception($"User name and password for basic authentication are missing and are required).");
168168
}
169169

170170
return authHeader;
171171
}
172172

173-
internal static string GetApiKeyAuthenticationHeader(BombardierOptions bombardierOptions)
173+
private static string GetApiKeyAuthenticationHeader(BombardierOptions bombardierOptions)
174174
{
175175
string authHeader;
176176

@@ -180,7 +180,7 @@ internal static string GetApiKeyAuthenticationHeader(BombardierOptions bombardie
180180
}
181181
else
182182
{
183-
authHeader = String.Empty;
183+
throw new Exception($"Api Key is missing and is required.");
184184
}
185185

186186
return authHeader;

0 commit comments

Comments
 (0)