Skip to content

Commit dc34d13

Browse files
committed
[Blog] [Ajay]: Add more details to integration tests with aws
1 parent 20611f7 commit dc34d13

File tree

3 files changed

+68
-10
lines changed

3 files changed

+68
-10
lines changed

TestArena/Blog/IntegrationTesting/aws-integration/Index.razor

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@using TestArena.Blog.Common.NavigationUtils
44

55
@code{
6-
PageInfo currentPage = SiteMap.Pages.FirstOrDefault(x => x.RelativePath == "/blog/integration-testing-in-dotnet-with-aws");
6+
PageInfo currentPage = SiteMap.Pages.FirstOrDefault(x => x.RelativePath == "/blog/integration-testing-in-dotnet-with-aws")!;
77
}
88

99
<BlogContainer>
@@ -24,6 +24,8 @@
2424
<h6>Challenges in testing cloud integrations</h6>
2525
<p>Here’s the twist: while using AWS services like SNS, SQS, S3, or SES is straightforward with the SDK, how do we ensure that our messages actually reach AWS? It’s not just about calling the right method with the right input; it’s about verifying that AWS receives and processes our requests correctly.</p>
2626

27+
<p>Another challenge is the cost associated with testing on real AWS infrastructure. Running integration tests frequently on live AWS services can quickly add up, especially when dealing with high volumes of requests or multiple environments. This is where tools like LocalStack come in handy, allowing us to emulate AWS services locally and avoid unnecessary expenses.</p>
28+
2729
<h6>Lets dive into the article</h6>
2830
<p>To make this more fun, imagine we’ve built an API called <code>call-superhero</code>. This API takes a superhero’s name as a parameter and sends an SNS notification, hoping that the superhero hears the call and springs into action!</p>
2931

@@ -76,8 +78,67 @@
7678
<p><i>Note: To retrieve the SNS Topic ARN, create a topic in the AWS Management Console or using the AWS CLI. Refer to the <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html" target="_blank">AWS documentation</a> for details.</i></p>
7779

7880
<h4>Setting Up LocalStack for Integration Testing</h4>
81+
<p>For more information, visit the official LocalStack website: <a href="https://localstack.cloud/" target="_blank">https://localstack.cloud/</a>.</p>
7982
<p>LocalStack is like having your own personal AWS cloud running locally. Below is a step-by-step guide to setting it up for integration testing in a .NET application. For more details, refer to the <a href="https://testcontainers.com/modules/localstack/" target="_blank">Testcontainers.LocalStack documentation</a>.</p>
8083

84+
85+
<div class="small-table">
86+
<h6>A quick glance on using localstack for testing vs using real AWS resources</h6>
87+
<table class="table table-bordered table-striped">
88+
<thead class="thead-light">
89+
<tr>
90+
<th>Aspect</th>
91+
<th>LocalStack</th>
92+
<th>Real AWS</th>
93+
</tr>
94+
</thead>
95+
<tbody>
96+
<tr>
97+
<td>Cost</td>
98+
<td>✅ Free or minimal cost for local testing.</td>
99+
<td>❌ Can be expensive, especially for high-frequency testing.</td>
100+
</tr>
101+
<tr>
102+
<td>Speed</td>
103+
<td>✅ Faster as it runs locally without network latency.</td>
104+
<td>❌ Slower due to network calls and AWS service response times.</td>
105+
</tr>
106+
<tr>
107+
<td>Environment</td>
108+
<td>✅ Runs locally, no dependency on internet or AWS account.</td>
109+
<td>❌ Requires internet and a valid AWS account.</td>
110+
</tr>
111+
<tr>
112+
<td>Feature Coverage</td>
113+
<td>❌ Supports many AWS services but may lack full feature parity.</td>
114+
<td>✅ Complete feature set and latest updates.</td>
115+
</tr>
116+
<tr>
117+
<td>Realism</td>
118+
<td>❌ Simulates AWS services but may not perfectly replicate behavior.</td>
119+
<td>✅ Provides real-world behavior and interactions.</td>
120+
</tr>
121+
<tr>
122+
<td>Setup Complexity</td>
123+
<td>✅ Can be quickly spinned up using docker or local setup</td>
124+
<td>❌ Requires AWS credentials and service configuration.</td>
125+
</tr>
126+
<tr>
127+
<td>Scalability Testing</td>
128+
<td>❌ Limited to local machine resources.</td>
129+
<td>✅ Can test real-world scalability and performance.</td>
130+
</tr>
131+
<tr>
132+
<td>Debugging</td>
133+
<td>✅ Easier to debug locally with full control over the environment.</td>
134+
<td>❌ Harder to debug due to remote infrastructure.</td>
135+
</tr>
136+
</tbody>
137+
</table>
138+
</div>
139+
140+
<p class="tip">💡 LocalStack isn't just for testing; it also speeds up development by emulating AWS locally, reducing costs and dependency on internet connectivity while ensuring AWS API compatibility.</p>
141+
81142
<h5>Define the LocalStack Container</h5>
82143
<p>The <code>LocalStackContainer</code> is configured using the <code>Testcontainers.LocalStack</code> library. This setup specifies the Docker image, wait strategy, and cleanup options.</p>
83144

TestArena/Blog/Security/Vulnerabilities/detection-in-dotnet/Index.razor

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
PageInfo currentPage = SiteMap.Pages.FirstOrDefault(x => x.RelativePath == "/blog/package-vulnerability-detection-in-dotnet")!;
77
}
88

9-
<style>
10-
/* Add your custom styles here */
11-
.small-table {
12-
font-size: 0.85rem; /* Smaller font size */
13-
width: 80%; /* Reduce table width */
14-
margin: auto; /* Center the table */
15-
}
16-
</style>
17-
189
<BlogContainer>
1910
<Header
2011
Title="@currentPage.Header"

TestArena/wwwroot/css/app.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,9 @@ code {
109109
border-left: 5px solid #3498db;
110110
margin: 1em 0;
111111
}
112+
113+
.small-table {
114+
font-size: 0.85rem; /* Smaller font size */
115+
width: 80%; /* Reduce table width */
116+
margin: auto; /* Center the table */
117+
}

0 commit comments

Comments
 (0)