简体   繁体   中英

Multiple methods calls inside test method

I am writing unit test to test some converters in my app which has three languages. The test results depends from the value of the language, for example if the language is "en" i should expect one output and if the language is "fr" i should expect different output. Is it ok inside my test method annotated with @Test to make three calls to one method that receives language as method parameter, or i should duplicate my code and create three different test methods, each for a specific language ?

对每种语言进行单独的测试将为您提供更好的测试报告,但是您不必重复代码,在Test类内部创建私有方法并重用它们。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM