Middleware testing - Ready for review

@kikito why it needs to pass it when it is global value?