Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Don't you like Integration testing as Me&
Search
Yevhen
March 12, 2018
Technology
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Don't you like Integration testing as Me&
Slides of public talk at SeleniumCamp 2018
Yevhen
March 12, 2018
Other Decks in Technology
See All in Technology
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
160
Rust で関数型ドメインモデリング
takonda
0
140
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
160
パッチ更新でterraform initが落ちた日
grimoh
1
140
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
170
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
220
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
490
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
860
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
First, design no harm
axbom
PRO
2
1.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Navigating Weather and Climate Data
rabernat
0
560
WENDY [Excerpt]
tessaabrams
14
40k
Thoughts on Productivity
jonyablonski
76
5.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
sira's awesome portfolio website redesign presentation
elsirapls
0
450
Transcript
Don’t you like Integration testing as Me?
Yevhen Rudiev • QA Automation Lead at GamePoint • ~6
years experience in IT • ~3 years experience in Automated Testing • ~2 years experience in Micro- Service architecture
INTEGRATION TESTING
INTEGRATION TESTING
INTEGRATION TESTING
INTEGRATION TESTING
None
None
HOW TO TEST IT?
#1 END TO END TESTING
System under test DB Test Provider
#1.1 PROBLEMS: • Test data
TEST DATA <PayPointSettings> <MerchantId>1234</MerchantId> <MerchantPassword>Password</MerchantPassword> <Url>https://TestPayPoint.com/Payment</Url> <ApiVersion>v2.1</ApiVersion> <SecretWord>SecretWord</SecretWord> </PayPointSettings>
TEST DATA [Test] public void VisaDeposit_Positive_PaymentCaptured() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithCreditCardNumber(TestData.PositiveCardPayPoint) .WithExpectedFinalStatus(PaymentStatus.Captured) .Send(); }
TEST DATA [Test] public void VisaDeposit_Positive_PaymentCaptured() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithCreditCardNumber(TestData.PositiveCardPayPoint) .WithExpectedFinalStatus(PaymentStatus.Captured) .Send(); }
TEST DATA [Test] public void VisaDeposit_Negative_PaymentRefused() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithCreditCardNumber(TestData.RefusedCardPayPoint) .WithExpectedFinalStatus(PaymentStatus.Refused) .Send(); }
TEST DATA <SkrillSettings> <Login>Name</Login> <ApiPassword>Password</ApiPassword> <PublicKey>PublicPassword</PublicKey> <PrivateKey>PrivatePassword</PrivateKey> <Url>https://TestPayPoint.com/Payment</Url> </SkrillSettings >
TEST DATA [Test] public void SkrilWithdrawal_PaymentRefused() { BuildPaymentRequest(PaymentType.Withdrawal) .WithAmount(TestData.NegativeAmountSkrill) .WithExpectedFinalStatus(PaymentStatus.Refused)
.Send(); }
#1.1 PROBLEMS: • Test data • Fail investigation
FAIL INVESTIGATION Test Failed: PaymentStatus was not updated to Captured
in 30 seconds Expected: Captured Actual: Refused
Provider System under test FAIL INVESTIGATION Test Provider Test System
under test System under test
#1.1 PROBLEMS: • Test data • Fail investigation • Speed
System under test SPEED DB Test Provider
None
SPEED DB Provider Additional services
#1.1 PROBLEMS: • Test data • Fail investigation • Speed
• Stability
• New unstable version • WebRequest.Timeout • Delayed responses •
Test Data changes • Hardware issues STABILITY
#2 TESTING WITH FAKES
#2.1 PRINCIPLE Fake of Provider Provider DB
System under test #2.1 PRINCIPLE DB Test Fake of Provider
Provider
#2.1 PRINCIPLE HOST Provider 1 Provider 2 Provider N System
under test
#2.2 E2E TESTING PROBLEMS: • Test data • Fail investigation
• Speed • Stability
TEST DATA HOST Behavior Context Provider N Test
BEHAVIOR CONTEXT GET Request http://Testing.Fakes/BehaviorContext? paymentId={0}&status={1} ConcurrentDictionary<string,string>
BEHAVIOR CONTEXT [Test] public void VisaDeposit_Positive_PaymentCaptured() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithCreditCardNumber(TestData.PositiveCardPayPoint) .WithExpectedFinalStatus(PaymentStatus.Captured) .Send(); }
BEHAVIOR CONTEXT [Test] public void VisaDeposit_Positive_PaymentCaptured() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithBehavior(req => BehaviorHelper.Set(req.PaymentId, PaymentStatus.Captured)) .WithExpectedFinalStatus(PaymentStatus.Captured) .Send(); }
#2.2 E2E TESTING PROBLEMS: • Test data • Fail investigation
• Speed • Stability
System under test System under test Provider FAIL INVESTIGATION Test
Test
• Test data • Fail investigation • Speed • Stability
#2.2 E2E TESTING PROBLEMS:
SPEED HOST System under test Fake of Provider localhost
• Test data • Fail investigation • Speed • Stability
#2.2 E2E TESTING PROBLEMS:
STABILITY • New unstable version • WebRequest.Timeout • Delayed responses
• Test Data changes • Hardware issues
#2.2 E2E TESTING PROBLEMS: • Test data • Fail investigation
• Speed • Stability
PRICE: • Higher tech level of QA • Increased time
of development • More code to support • Synchronize Changes
Do we still need integration testing?
Fake of Provider System under test DB Test
REQUEST VALIDATION “b50cb600-ddd4-4cea-a4ce-0f266a33e922” => “John1990” “
[email protected]
” => “John Doe” “en”
=> “English” “EUR” => “USD”
None
E2E TESTING PROBLEMS: • Test data • Fail investigation •
Speed • Stability
None
#3 SMART FAKES
System under test #3 SMART FAKES DB Test Fake of
Provider Verification of request
#3.1 ISupportLogging public void ProcessRequest(HttpContext context) { logger.Log(context.Request.PaymentId, context.Request); return
BehaviorContext.Response(context.Request.PaymentId); }
#3.1 ISupportLogging [Test] public void VisaDeposit_Positive_PaymentCaptured() { . . .
var request = FakeHelper.GetRequest(payment.Id); AssertRequest(request); } public void AssertRequest(HttpRequest request)
#3.2 ISupportValidation public void ProcessRequest(HttpContext context) { if (!IsValidRequest(context.Request)) {
return BadRequest(“Request violates the contract”); } return BehaviorContext.Response(context.Request.PaymentId); }
#3.2 ISupportValidation [Test] public void VisaDeposit_Positive_PaymentCaptured() { BuildPaymentRequest(PaymentType.Deposit) .WithProvider(TestData.PayPointProviderName) .WithPaymentMethod(TestData.Visa)
.WithBehavior(req => BehaviorHelper.Set(req.PaymentId, PaymentStatus.Captured)) .WithExpectedFinalStatus(PaymentStatus.Captured) .Send(); }
#3.3 PLUSSES: • All plusses from Fakes approach: • Fast
• Stable • Controlled • Request verification
#3.4 BLIND SPOTS: • Changes in the contracts on prod
• New integration testing • Documentation errors
#3.5 MICROSERVICES TESTING Microservice #1 Microservice #2 Microservice #3 Microservice
#4 Microservice #5
Smart Fake #5 #3.5 MICROSERVICES TESTING Microservice #1 Smart Fake
#2 Smart Fake #3 Smart Fake #4
RESULTS • Made our tests faster, more stable and controlled
• Fakes guaranteed integration compatibility • Lives became easier
ALWAYS LOOK FOR THE IMPROVEMENTS
CONTACTS: www.linkedin.com/in/yevhen-rudiev-a5609590 www.facebook.com/evgeniy.rudev.5
Q&A