webtest cleanup and code improvement

webtest cleanup and code improvement for some profile tests