I need to test some api. For example I have multiple @Test methods in the class to test my functionality, before init I connect to some url of my service, and use it.
If I have my service at multiple urls(different server environments), how can I Test this functionality for different service urls?
Flow:
- Init conncetion by url
- Run all Tests
- Init conncetion by another url
- Run all Tests(the same)
- ...
when was only one host I do like this:
public class TestAPI{
@org.junit.Before
public void init() {
service = new Service("www.test.com");
}
@org.junit.Test
public void testA(){
service.CallA();
}
@org.junit.Test
public void testB(){
service.CallB();
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…