Presentation is loading. Please wait.

Presentation is loading. Please wait.

UI 테스트 자동화(Coded UI Test)를 통한 품질 혁신 가이드

Similar presentations


Presentation on theme: "UI 테스트 자동화(Coded UI Test)를 통한 품질 혁신 가이드"— Presentation transcript:

1 UI 테스트 자동화(Coded UI Test)를 통한 품질 혁신 가이드
김태영(Taeyo) 부장, 개발자 플랫폼 사업본부 한국마이크로소프트

2 테스트(& UI 테스트)는 왜 필요한가? 어…어...어떤 버튼을 눌러야 하지?

3 애플리케이션 계층과 테스트 UI 테스트 단위 테스트 사용자 인터페이스 (ASP.NET, WinForms, XAML 등)
Presentation 계층 Business Logic/Service 계층 단위 테스트 Data Access/리파지토리 계층 Database

4 개발자의 테스트를 무시하지 마라 수동 UI 테스트는 언제나 우리들의 친구였다

5 Unit Test? Coded UI Test? Unit Test Coded UI Test
클래스와 메서드에 대한 API 수준의 테스트 개발 품질 향상을 위해 가장 우선적으로 고려해야 할 테스트 UI 관련된 부분을 테스트하기에는 어려움이 있음 Coded UI Test 사용자 인터페이스가 올바로 동작하는지 검사하는 테스트 응용 프로그램의 실행 동작을 레코딩 및 테스트 사용자의 키보드, 마우스 움직임을 시뮬레이트 UI 테스트를 단위 테스트처럼 자동화할 수 있음 통합 테스트 용도로 활용 가능 코드 검사분석(Coverage) 지원

6 4/9/2019 테스트 경험의 발전 F5 경험 UI를 통해 전체 응용프로그램을 빌드하고 수동으로 테스트 일반적인 비-CUIT 테스트 UI를 이용하지 않고 전체 응용 프로그램 테스트 (예, 단위 테스트) 일반적인 CUIT 테스트 UI를 통하여 전체 응용프로그램을 자동으로 테스트 UI를 검증하는 테스트 격리 상태에서 UI 테스트 출처 : © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

7 UI Test 자동화를 위한 Visual Studio의 지원
4/9/2019 UI Test 자동화를 위한 Visual Studio의 지원 Coded UI 테스트 작성 수동 코딩 기존 테스트 케이스 Import 레코드 액션 테스트 케이스 연계 테스트 케이스 실행 방법 직접 실행 빌드 통합 Test Manager Visual Studio 도구 단위 테스트 UI 자동화 테스트 성능 테스트 부하 테스트 코드 품질 분석 결함 보고 품질 분석 코드 커버리지 빌드 보고서 버그 생성 키워드 기반 UI Automation test creation is handled from the Visual Studio IDE. There are three methods for creating these tests: manual creation via code, keyword based scripts (using the preferred partner solution LogiGear), recording your actions as you interact with the UI, or importing an existing manual test case that has an action recording. Once the test has been created in the IDE, it can be ran from the IDE itself directly, from Test Manager, or automated as part of an automated build or deploy scenario. Automated UI tests can be associated with test cases in TFS for maximum visibility. Just like all other types of testing in Visual Studio, automated UI tests are backed by Team Foundation Server, enabling up to the minute detailed reporting. Depending on the method of execution, bugs can be created (directly in the case of MTM execution, or part of a failed build in the case of complete automation). © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

8 CUIT의 핵심. 코딩된 UI 테스트 빌더 테스트 녹화기 종료 코드 자동 생성 어설션 추가 스텝(단계) 편집
녹화/일시 멈춤/녹화재개 스텝(단계) 편집 어설션 추가 코드 자동 생성 테스트 녹화기 종료

9 CUIT의 핵심. 코딩된 UI 테스트 빌더

10 Assertion 추가 테스트 빌더로 어셜션 추가

11 4/9/2019 코딩된(Coded) UI 테스트 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

12 Data-Driven Coded UI Test
코딩된 UI 테스트 준비된 데이터를 사용하여 UI 테스트를 실행 현재 5가지 종류의 데이터 소스 형식을 지원 CSV, Excel, Test Case(TFS), XML, SQL Express 기 작성된 UI 테스트에 [DataSource] 어트리뷰트를 사용하여 적용 데이터 소스의 각 행은 코딩된 UI 테스트를 각각 반복 실행 실제 해당 데이터에 대한 접근은 TestContext.DataRow["열 이름"] 사용 테스트의 전체 결과는 모든 반복의 결과를 기반으로 함 테스트 반복이 하나라도 실패하면 전체 테스트 결과가 실패 참고 :

13 Data-Driven Coded UI Test
데이터 형식 데이터 원본 어트리뷰트 CSV [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential), DeploymentItem("data.csv"), TestMethod] Excel [DataSource("System.Data.Odbc", "Dsn=Excel Files;Driver={Microsoft Excel Driver (*.xls)}; dbq=|DataDirectory|\\Data.xls;defaultdir=.;driverid=790;maxbuffersize=2048; pagetimeout=5;readonly=true", "Sheet1$", DataAccessMethod.Sequential), TestMethod] 테스트 케이스 (TFS) [DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", " "30", DataAccessMethod.Sequential), TestMethod] XML [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\data.xml“, "Iterations", DataAccessMethod.Sequential), DeploymentItem("data.xml"), TestMethod] SQL Express [DataSource("System.Data.SqlClient", "Data Source=.\\sqlexpress;Initial Catalog=tempdb; Integrated Security=True", "Data", DataAccessMethod.Sequential), TestMethod]

14 Data-Driven Coded UI Test 코드 샘플

15 크로스 브라우저 지원 추가 컴포넌트 설치 필요 테스트 브라우저 설정
4/9/2019 크로스 브라우저 지원 추가 컴포넌트 설치 필요 Selenium components for Coded UI Cross Browser Testing 테스트 브라우저 설정 BrowserWindow.CurrentBrowser = “IE” BrowserWindow.CurrentBrowser = “Chrome” BrowserWindow.CurrentBrowser = “Firefox” © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

16 코드 검사분석(Code Coverage)
4/9/2019 코드 검사분석(Code Coverage) 얼마나 테스트 되었는지를 정량적으로 검증 코드 커버리지가 없는 단위 테스트는 앙꼬없는 찐빵 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

17 Code UI Test Platform Support
4/9/2019 Code UI Test Platform Support 운영체제 Windows 7, 8, Windows Server 2008 R2 .NET .NET 2.0, 3.0, 3.5, 4.0, 4.5 (상기 버전으로 개발된 앱을 지원한다는 의미임) Internet Explorer 8 ,9, 10, 11 버전 지원 (10, 11은 데스크탑 버전만 지원) Window Store App 지원. XAML 기반 앱 Windows Forms와 WPF 써드파티 컨트롤 지원 Chrome, Firefox 최신 버전만 지원 Window Form 2.0 이상 MFC 부분적으로 지원 WPF 3.5 이상 지원 (다만, 일부 써드파티 컨트롤은 지원되지 않을 수 있음) SharePoint Dynamics CRM web client © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

18 Code UI Test Platform No Support
Internet Explorer 6, 7 지원안함 Silverlight (플러그인 설치 시 가능하긴 하나 문제있음) Flash Java Office Client Applications SAP

19 Visual Studio 11 4/9/2019 Coded UI Test Coded UI tests는 단위 테스트 수트의 일부로 실행되기 때문에, 결함을 조기에 발견할 수 있게 한다 Coded UI tests 는 소스 제어로 버전 관리도 가능하다 Coded UI 테스트와 그 밖의 회귀 테스트를 빌드 자동화의 일부로 실행하도록 설정하면, 개발팀은 테스트 실행에 관해 고민할 필요가 없다. 문제가 생기는 경우에 그 원인을 찾아서 해결하면 된다 Talk Track: As coded UI tests are code, you can attach them to your continuous integration build verification tests, or other automated builds to ensure that defects in your application’s UI are discovered as soon as possible. 룩앤필이 변경된다 하더라도, 자동화된 테스트는 여전히 잘 동작한다 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

20 로그 설정 추적수준을 조정하여 로그 출력 설정 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE QTAgent32.exe.config 파일 수정 system.diagnostics 섹션의 EqtTraceLevel 기본 값은 0으로 설정. 1, 2는 오류 로그만 출력 3, 4는 상세 로그 출력

21 로그 출력 화면

22 DEMO

23 최선의 구현 방법 가능하면 항상 코딩된 UI 테스트 빌더를 사용하세요
UIMap.designer.cs 파일을 직접 편집하지 마십시오. 그 파일은 빌더에 의해서 자주 변경됩니다 테스트를 일련의 기록된 메서드로 만듭니다 기록된 각 메서드는 단일 페이지, 폼 또는 대화 상자에서 작동해야 합니다 각각의 새 페이지, 폼 또는 대화 상자에 대한 새 테스트 메서드를 만듭니다 메서드를 만들 때, 기본 이름 대신 의미 있는 메서드 이름을 사용하세요 가능하면 기록된 각 메서드의 작업 수를 10개 미만으로 제한하는 것이 좋습니다 이러한 모듈 방식을 사용하면 UI가 변경되는 경우 메서드를 쉽게 바꿀 수 있습니다 참고 :

24 최선의 구현 방법 (계속) 코딩된 UI 테스트 빌더를 사용하여 각 어설션을 만듭니다
그러면 어설션 메서드가 자동으로 UIMap.Designer.cs 파일에 추가됩니다 UI가 변경되는 경우 테스트 메서드 또는 어설션 메서드를 다시 기록하거나 영향을 받는 기존 테스트 메서드 섹션을 다시 기록하세요 테스트 대상 응용 프로그램의 각 모듈에 대한 별도의 UIMap 파일을 만듭니다 테스트 대상 응용 프로그램에서 UI 컨트롤을 만들 때 의미 있는 이름을 사용 코딩하여 어설션을 만드는 경우 UIMap.cs 파일에 있는 UIMap 클래스 부분에 각 어설션에 대한 메서드를 만듭니다 API로 직접 코딩하는 경우, UIMap.Designer.cs 파일에 생성된 클래스의 속성과 메서드를 가능한 한 많이 코드에 사용합니다 이러한 클래스를 사용하면 작업이 더 간단해지고 신뢰도와 생산성을 높일 수 있습니다. 참고 :

25 참조 Testing for Continuous Delivery with Visual Studio 2012
Visual Studio 진단 도구로 품질 개선 코딩된 UI 테스트를 사용하여 코드 확인

26 Q & A


Download ppt "UI 테스트 자동화(Coded UI Test)를 통한 품질 혁신 가이드"

Similar presentations


Ads by Google