Skip to content

테스트 대상 시스템 로그인시 세션이 test() 이후에 저장되는 현상 #839

Answered by imbyungjun
wooyounggggg asked this question in Q&A
Discussion options

You must be logged in to vote

로컬에서 실행중인 서버가 어떻게 동작하는지 정확하게는 알 수 없지만, 가장 먼저 의심되는 부분은 cookie 처리에 대한 부분입니다.
일반적인 경우 로그인 후 세션 ID를 쿠키에 저장하게 될 텐데요. 올려주신 테스트 스크립트에서는 쿠키에 대한 처리를 수행하지 않고 있습니다. 위 스크립트에서 사용하는 HTTPRequest 클래스는 상당히 낮은 추상화 수준의 구현체로 쿠키에 대한 처리도 직접 수행해주어야합니다.

이슈 해결을 위해서 Groovy 로그인 샘플 코드를 참고하여 로그인 요청 이후 쿠키를 추가해보는게 좋을 것 같습니다.

예시)

@BeforeThread
public void beforeThread() {
    HTTPResponse result = request.POST("http://192.168.219.118:8081/apis/auth/signIn", body.getBytes(), headers);

    def threadContext = HTTPPluginControl.getThreadHTTPClientContext()
    cookies = CookieModule.listAllCookies(threadContext)
}

@Before
public void before() {
    def threadContext = HTTPPluginControl.getThreadHTTPClientContext()
    co…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by wooyounggggg
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants