简体   繁体   中英

serenity bdd default url with spring boot random port number

In tests with Serenity I'm starting my Spring Boot application with a random port.

At some point I need to use a PageObject like this:

@DefaultUrl("http://localhost:8080")
public class GreetPage extends PageObject {
}

The question is: how can I inject a random port number in the PageObject?

I want to somehow replace the 8080 (which is the default port) with the random port provided by Spring Boot test.

您可以使用setDefaultBaseUrl()在Page Object的构造函数中设置适当的URL。

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