42
David Hong • Jecelyn Yeen PRAGMATIC BATCH PROCESS MANAGEMENT & DEVELOPER TESTING

#speakgeek - Pragmatic Batch Process Management & Developer Testing

Embed Size (px)

Citation preview

David Hong • Jecelyn Yeen

PRAGMATIC BATCH PROCESS MANAGEMENT

& DEVELOPER TESTING

AgendaBatch Process Management

• Problems. • Job Scheduling Framework, Quartz.NET• What’s Next.

Developer Testing• Unit testing. • End to end testing.

BATCH PROCESS MANAGEMENT

Problems• No Automated Deployment

• Developer spend more time in deployment.• Cumbersome Error Log Analysis

• Support team having difficulties in troubleshooting.

Solution - “Job Scheduling Framework"• Quartz.NET, Open Source• Port of Java Scheduling Framework, Quartz.• Set up as Windows Service.

Download & Set-up Put in your job Your job is ready

Solution for No Automated Deployment• Quartz API method with CI tool (Jenkins)

Solution for Cumbersome Error Log Analysis• Quartz.NET with Common Logging Framework

Integration.• Send logging messages to Centralised Logging

Framework (ELK Stack).

Quartz.NET Features• Provide API method to interact with main

scheduler.• Support job execution on any .NET class that

implements the generic interface.

Quartz.NET Scheduling• Flexible triggers and rules

with Cron Expressions.• Time Zone specific

schedulers.• http://www.cronmaker.com/

Example of Cron Expression

Job Scheduler’s ParametersJob Parameter Remark

JobItemClassName Job namespace and class name . It have to be unique among the Job Item. Example: “Speakgeek.Session” that will accept topic name as parameter

Cron Schedule For Cron Schedule go to http://www.cronmaker.com/ to generate the expressionExample: “0 0 8 1/1 * ? *” – Run every day start from 8am

File Path Your dll, exe file location, beware of the securityExample: “C:\Speakgeek\speakgeek.dll or speakgeek.exe”

Argument Custom argument that you can pass to the jobExample: topic name :“BatchProcess, ContinouesIntegration”

HandleMisFire Misfired rule such as • Execute misfired immediately• Do nothing

Quartz.NET Clustering• Support Clustering with Load Balancing.

What’s Next• Expose Quartz.NET as Web Service

• Campaign Scheduler • Reporting Scheduler

• Clustering in Quartz.NET

Benefits of Quartz.NET• Low Set-up Time and Cost• Flexibility in Job Scheduling • Ease of Integration• Maintainability with Centralised Logging

Framework• Scalability with Clustering

Helpful Links• Quartz.NET Official Website

• http://www.quartz-scheduler.net/

• Cron Maker• http://www.cronmaker.com/

• Cron Maker Tutorial• http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

• Common Logging .NET• https://github.com/net-commons/common-logging

• Geeks with Blogs with detail walkthrough • http://bit.ly/1dzCwgA

Q & A

DEVELOPER TESTING

The Journey

Unit Testing

Unit testing framework

Unit testablecode Mocking Methodology

xUnit AutofacMEF

NSubstituteMockQ

Test Driven Development

Smooth Climb?

Common Challenges

NO TESTING REQUIRED

IT WILL WORK.IT WILL WORK !!

“ AINT NOBODY GOT TIME FOR THAT ”

TEST ALL THINGS

Unit testing framework

Unit testablecode Mocking Methodology

Working!• Legacy code• Inexperienced

• Static object• Refactoring• Time consuming

No one knows TDD in a proper way

1st round: Result

Start AgainStart Small

API

Principles

Mock external references

Thorough

Repeatable

ONE condition at a time

Isolated

End to end (E2E) testing

Verify that a system meets external requirements and

achieves its goals, testing the entire system, from end to end

Unit vs Integration vs E2E testing

Stimulate real user scenarios.

End to endtesting

Takes a small group of units (2 units), tests their behaviour as a

whole

Integrationtesting

Test a small piece of the product in

isolation

Unittesting

E2E testing

Framework AutomationMethodology

Behaviour Driven

Development

SpecFlow

SpecFlow

The Benefits of SpecFlow

Standard way of defining test case Reusable Human

understandable

Hide awayimplementation

details

Less require tech knowledge

The Testing Pyramid

• Fast• Reliable • Isolate failure

Need initialization, slower

• Stimulate real user • Take longer time

• Take longer time Manual tests

E2E tests

Integration tests

Unit tests

Number of tests

Journey thus Far

Start small

Having experienced guides

Motivation

Communication

What we’ve learn

Increase code coverage

Implement unit test for defects / enhancements

Where we’re heading to

Automate performance testing

Q & A

THANK YOU