是否可以通过脚本在SoapUI pro中的环境之间进行切换?我必须创建一个在环境1上运行测试后切换环境2的脚本。我正在使用测试运行程序从Eclipse运行我的脚本。 请提供一些建议。
答案 0 :(得分:0)
您可以向下钻取并使用Groovy而不是Java来更改环境,如下所示:
export class ListPage implements OnInit, OnDestroy {
car1: CarModel[];
car2: CarModel[];
constructor(private carService: CarService) {}
ngOnInit() {
// 1. subscribe Observable Subject
const carsSubscription = this.carService
.getObservableList()
.subscribe(serviceResult => {
// Here we can use returned serviceResult
// but our service will be called 2 times with 2 different parameters!
});
}
// in my business, I need to call the same service 2 times with different parameters
// The issue here, BOTH calls will refresh the same Observable
// so i can not know the returned serviceResult is related to the first or second call?
public coreBusiness(carId1: string, carId2 string) {
// 2. call service method by parameters to fetch/refresh Observable
this.carService.fetchCarInfo(carId1);
this.carService.fetchCarInfo(carId2);
}
}
根据测试用例的结构,您可能需要编写一个新的测试用例,其中仅包括上述内容作为Groovy测试步骤,并调出调用其他测试用例的功能。