投稿時間:2022-04-14 11:26:54 RSSフィード2022-04-14 11:00 分まとめ(28件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT InfoQ Java Newsラウンドアップ: Hibernate 6.0、JobRunr 5.0、JHipster 7.8.0、Spring CVE、JReleaser 1.0-RC2 https://www.infoq.com/jp/news/2022/04/java-news-roundup-mar28-2022/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global JavaNewsラウンドアップHibernate、JobRunr、JHipster、SpringCVE、JReleaserRC年月日、今週のJavaラウンドアップは、JDK、SpringBoot、SpringのCVE対応、ApacheTomcatのポイントリリース、QuarkusToolsforVisualStudioCode、Micronaut、JetBrainsのMicronautFoundation参加、OpenLibertyPaketoLibertyBuildpack、Hibernate、JobRunr、WildFlyBetaSIイメージ、JReleaserRC、MicroStreamM、JHipster、JMHといったニュースをお届けする。 2022-04-14 01:06:00
ROBOT ロボスタ 長距離3D-LiDARを使って滑走路の異常を確認!NECが南紀白浜エアポートで異物検知を行う実証実験へ その仕組み解説 https://robotstart.info/2022/04/14/nec-nanki-air-lidar.html 長距離DLiDARを使って滑走路の異常を確認NECが南紀白浜エアポートで異物検知を行う実証実験へその仕組み解説シェアツイートはてブ空港における飛行機の安全と運航効率を確保するために、滑走路点検の一つである定時点検主に路面の欠片などの異物検知が目的は重要な業務だ。 2022-04-14 01:50:37
ROBOT ロボスタ 「アレクサ、玄関を見せて」Alexa対応ドアベルとセキュリティカメラ「Ring」をAmazonが国内販売へ 外出先から来訪者の確認や通話も https://robotstart.info/2022/04/14/ring-jp-start.html 2022-04-14 01:37:29
IT ITmedia 総合記事一覧 [ITmedia News] アトラシアン製品群で“ページを正常表示できない不具合”発生 約400社に影響 メンテ中に操作ミス https://www.itmedia.co.jp/news/articles/2204/14/news085.html confluence 2022-04-14 10:43:00
IT ITmedia 総合記事一覧 [ITmedia News] 約3億円で落札の世界初ツイートNFTが売り出されるも高値付かず(現在は約45万円) https://www.itmedia.co.jp/news/articles/2204/14/news084.html itmedia 2022-04-14 10:36:00
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 女性活躍の「行動計画」、策定から届け出までを一挙解説【22年4月施行・改正女性活躍推進法】 https://www.itmedia.co.jp/business/articles/2204/14/news005.html itmedia 2022-04-14 10:30:00
TECH Techable(テッカブル) 22年1~3月の国内スタートアップ資金調達額ランキング。新規8社、トップ3は70億円超 https://techable.jp/archives/176964 startupdb 2022-04-14 01:00:30
AWS AWS Japan Blog AWS Lambda Function URLs の提供開始: 単一機能のマイクロサービス向けの組み込み HTTPS エンドポイント https://aws.amazon.com/jp/blogs/news/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/ しかし、Lambda以外の追加のサービスを学習、設定、および運用することなく、関数の前にHTTPSエンドポイントを設定するための簡単な方法だけが必要な場合もあります。 2022-04-14 01:26:21
python Pythonタグが付けられた新着投稿 - Qiita Pythonでファイル名一覧を取得 https://qiita.com/reiko_s/items/98ed21051dcda295c452 mportosfilenamesoslistdir 2022-04-14 10:27:05
js JavaScriptタグが付けられた新着投稿 - Qiita 【Vuetify】iPhoneやiPodTouchでv-data-table のexpanded-itemが表示/非表示切り替えで崩れる https://qiita.com/tktr90755/items/54fc8e542a5210da7aec bleheadersheadersitems 2022-04-14 10:11:22
golang Goタグが付けられた新着投稿 - Qiita 競プロ落とし穴 #1 SetでDFS https://qiita.com/acta/items/2f595c8a8326f048584e 落とし穴 2022-04-14 10:14:36
海外TECH DEV Community Examples of unit, widget and integration testing in Flutter applications https://dev.to/shehanat/examples-of-unit-widget-and-integration-testing-in-flutter-applications-2m40 Examples of unit widget and integration testing in Flutter applicationsEver wondered why there are so many Flutter development tutorials and guides and yet only a few sources on Flutter testing Me too In this blog post I ll show you how to conduct unit widget and integration testing for Flutter applications Introduction amp Apps We ll Be TestingThis blog post will be split into three main parts Unit testing Widget testing and Integration testing We will be testing a Calorie Tracker Application built in an earlier blog post click here to learn how to build a Calorie Tracker app in Flutter Here is its GitHub repo linkAlso for the later part of the Widget Testing section we will be using a sample Flutter application called form app contained in this GitHub repoFree feel to clone them and follow along Here are some screenshots of the apps we ll be testing Figure Calorie Tracker App HomepageFigure Calorie Tracker App Day View screenFigure Calorie Tracker App History screenFigure Calorie Tracker App Settings screenFigure Form App HomepageFigure Form App Form Widgets Demo screenFigure Form App Validation screen Unit TestingFirst let s write a couple of unit tests for testing the FavoriteFoods class in the models folder of the calorie tracker app application To do this we ll have to add the following code to the calorie tracker app test unit tests models favorite food tests dart file calorie tracker app test unit tests models favorite food tests dartimport package calorie tracker app src model favorite foods dart import package calorie tracker app src model food dart import package test test dart void main group Testing Model classes var favoriteFoods FavoriteFoods test A new Food instance should be added to Favorite Foods array var newFood Food id food name Sandwich favoriteFoods add newFood expect favoriteFoods getFavoriteFoodItems contains newFood true test A specified Food instance should be deleted from Favorite Foods array var newFood Food id food name Pasta favoriteFoods add newFood expect favoriteFoods getFavoriteFoodItems contains newFood true favoriteFoods remove newFood expect favoriteFoods getFavoriteFoodItems contains newFood false Now for an explanation of the following code First we instantiate an instance favoriteFoods of the type FavoriteFoods This model class will be the subject of testing for the two unit tests belowtest A new Food instance should be added to Favorite Foods array This unit test will test the favoriteFoodItems array by adding a Food instance and then checking for its existence inside the array using the contains methodtest A specified Food instance should be deleted from Favorite Foods array This unit test will test the delete functionality of the FavoriteFood class s favoriteFoodItems array This is done by first inserting a Food instance into the array and then deleting Finally the expect method is used to verify that the deleted item does not exist in the favoriteFoodItems arrayNext we ll write some unit tests involving the testing of the DatabaseService class in the calorie tracker app application This class s main purpose is to communicate with a Firebase Firestore database and manipulate data in the foodTracks collection by adding fetching or deleting data Let s navigate to the calorie tracker app test unit tests database dart file and add the following code to it calorie tracker app test unit tests database dartimport package calorie tracker app src services database dart import package calorie tracker app src utils constants dart import package flutter test flutter test dart import package firebase database firebase database dart import package firebase core firebase core dart import package flutter material dart import package calorie tracker app src model food track task dart void main DatabaseService databaseService group testing DatabaseService test DatabaseService getAllFoodTrackData should return non empty list of foodTrack instances async WidgetsFlutterBinding ensureInitialized await Firebase initializeApp databaseService DatabaseService uid DATABASE UID currentDate DateTime now List lt dynamic gt getAllFoodTrackData await databaseService getAllFoodTrackData print getAllFoodTrackData expect getAllFoodTrackData length gt true test First element of the list returned by DatabaseService getAllFoodTrackData should contain the required values to create FoodTrackTask instance async WidgetsFlutterBinding ensureInitialized await Firebase initializeApp databaseService DatabaseService uid DATABASE UID currentDate DateTime now List lt dynamic gt getAllFoodTrackData await databaseService getAllFoodTrackData dynamic firstFoodTrack getAllFoodTrackData FoodTrackTask foodTrack FoodTrackTask food name firstFoodTrack food name calories firstFoodTrack calories carbs firstFoodTrack carbs protein firstFoodTrack protein fat firstFoodTrack fat mealTime firstFoodTrack mealTime createdOn firstFoodTrack createdOn grams firstFoodTrack grams expect foodTrack true Now for an explanation for the code above databaseService This is the DatabaseService class used to communicate with the Firebase Firestore database It will be used to fetch all foodTrack instances for the purposes of our testinggroup testing DatabaseService The group function is used to combine tests that are similar in functionality In our case we will be grouping all unit tests related to testing the DatabaseService class in one group functiontest DatabaseService getAllFoodTrackData should return non empty list This is our first unit test for testing whether we receive a non empty list of foodTrack instances from the DatabaseService class If you re wondering why the WidgetsFlutterBinding ensureInitialized and await Firebase initializedApp methods are called it is because they are required in order to establish a connection to the Firebase Firestore instance Once the foodTrack instances are assigned to the List lt dynamic gt getAllFoodTrackData variable we assert that its length must be greater than zero in order for the unit test to passtest First element of the list returned by DatabaseService getAllFoodTrackData This test is designed to test the fields of the foodTrack instances that are received from the Firestore database instance If we are able to create a FoodTrackTask instance which is a class that uses all the fields in the foodTrack instances stored in the Firestore database using the data recevied from the first foodTrack instance in the list that we ve retrived then we know that the instances in the database have all the fields that are required by the application or at least the first one does The setup looks identical to the first unit test with the only difference being the creation of the FoodTrackTask instance that is created using the data from the first instance contained in the List lt dynamic gt getAllFoodTrackData list variable The assertion for this test will basically check if the newly created foodTrackTask instance created is not nullOk that s it for unit testing let s move on to the Widget Testing section Widget TestingWidget testing can be considered one step up from unit testing because instead of testing a single class and block of code widget tests as the name implies tests widgets The primary method used for this type of testing is the WidgetTester class which allows for the building and interacting with widgets in a test environment WidgetTester instances are created by using the testWidgets function which are the functions that encapsulate each individual widget test Now let s test the DatePicker widget in the Flutter Calorie Tracker application as shown here Figure DatePicker widget in Day View screenFirst let s define a ShowDatePicker widget in order to test it In the calorie tracker app lib src page day view folder we ll add the following code to the showDatePicker dart file calorie tracker app lib src page day view showDatePicker dartimport package flutter cupertino dart import package flutter material dart class ShowDatePicker extends StatefulWidget override ShowDatePicker createState gt ShowDatePicker class ShowDatePicker extends State lt ShowDatePicker gt Color rightArrowColor Color xffCCC Color leftArrowColor Color xffCCC DateTime value DateTime now DateTime today DateTime now Future selectDate async DateTime picked await showDatePicker context context initialDate value firstDate new DateTime lastDate new DateTime now builder BuildContext context Widget child return Theme data ThemeData light copyWith primaryColor const Color xffFAA Head background child child if picked null setState gt value picked stateSetter void stateSetter if today difference value compareTo Duration days setState gt rightArrowColor Color xffEDEDED else setState gt rightArrowColor Colors white String dateFormatter DateTime tm DateTime today new DateTime now Duration oneDay new Duration days Duration twoDay new Duration days String month switch tm month case month Jan break case month Feb break case month Mar break case month Apr break case month May break case month Jun break case month Jul break case month Aug break case month Sep break case month Oct break case month Nov break case month Dec break default month Undefined break Duration difference today difference tm if difference compareTo oneDay lt return Today else if difference compareTo twoDay lt return Yesterday else return tm day month tm year override Widget build BuildContext context return MaterialApp home Scaffold width body Row mainAxisSize MainAxisSize max mainAxisAlignment MainAxisAlignment spaceBetween children lt Widget gt Expanded child IconButton key Key left arrow button icon Icon Icons arrow left size color leftArrowColor onPressed setState value value subtract Duration days rightArrowColor Colors white Expanded child TextButton textColor Colors white onPressed gt selectDate child Text dateFormatter value style TextStyle fontFamily Open Sans fontSize fontWeight FontWeight w Expanded child IconButton key Key right arrow button icon Icon Icons arrow right size color rightArrowColor onPressed if today difference value compareTo Duration days setState rightArrowColor Color xffCCC else setState value value add Duration days if today difference value compareTo Duration days setState rightArrowColor Color xffCCC Next let s add the corresponding test for the above widget in the calorie tracker app test widgets test day view dart file calorie tracker app test widgets test day view dartvoid main testWidgets Test that the ShowDatePicker widget is able to render WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android await tester pumpWidget ShowDatePicker expect find byType ShowDatePicker findsOneWidget debugDefaultTargetPlatformOverride null This first testWidgets test is testing whether the ShowDatePicker widget is able to be rendered The expect call of looking for one widget of the type ShowDatePicker is what validates this testcase Next let s test whether the Add Food button in the Day View screen is able to open the Add Food modal To do this we must first isolate the Add Food button and modal widgets into a seperate file in the folder path calorie tracker app lib src page day view addFoodButton dart by adding the following code to it calorie tracker app lib src page day view addFoodButton dartimport package flutter cupertino dart import package flutter material dart import package calorie tracker app src model food track task dart class AddFoodButtonWidget extends StatefulWidget override AddFoodButtonWidget createState gt AddFoodButtonWidget class AddFoodButtonWidget extends State lt AddFoodButtonWidget gt late FoodTrackTask addFoodTrack final addFoodKey GlobalKey lt FormState gt Widget addFoodButton return IconButton key Key add food modal button icon Icon Icons add box iconSize color Colors white onPressed async setState showFoodToAdd context showFoodToAdd BuildContext context return showDialog context context builder context return AlertDialog title Text Add Food Modal content new Scaffold body Column children lt Widget gt new Text Add Food Modal key Key add food modal actions lt Widget gt override Widget build BuildContext context return MaterialApp home Scaffold body Row children addFoodButton Now let s look at the other Flutter application used for testing form app its GitHub repo here where we ll add some more widget tests In this app s following file form app test widget tests form widgets dart let s add the following code form app test widget tests form widgets dartimport package flutter material dart import package flutter test flutter test dart import package form app src http mock client dart import package form app src sign in http dart import package form app src form widgets dart void main Future lt void gt enterFormWidgetsScreen WidgetTester tester async await tester pumpWidget MaterialApp home FormWidgetsDemo await tester pumpAndSettle testWidgets Given the user navigates to the Form Widgets screen When the user types into the title text field Then the TextFormField widget should contain the matching text WidgetTester tester async await enterFormWidgetsScreen tester var titleTextFormField find byKey ValueKey title text field await tester enterText titleTextFormField Know Thyself await tester pumpAndSettle expect find text Know Thyself findsOneWidget expect find text Know Thyselves findsNothing Here is a screenshot of the field we re testing Figure Title field in Form Widgets Demo page for form app applicationNow for an explanation of what we just added enterFormWidgetsScreen This method can be considered a test fixture because it sets up the environment that is to be used for testing In this case we navigate to the FormWidgetsDemo screen of this applicationtestWidgets Then the TextFormField widget should contain the matching text This test method first navigates to the FormWidgetsDemo screen and locates the TextFormField widget with the key title text field Then the string Know Thyself is entered after which the expect method would search for a widget with a text value of the string we just entered The assertion of this widget is done by the expect method and we look for the coresponding widget by using the find text method more on find text in the Flutter docs Let s add one more widget test to the same file form app test widget tests form widgets dart testWidgets Given the user navigates to the Form Widgets screen When the user selects a date from the DatePicker Then the DatePicker s value should be the picked date WidgetTester tester async await enterFormWidgetsScreen tester var datePickerFieldEditButton find byKey ValueKey form date picker edit await tester tap datePickerFieldEditButton await tester pumpAndSettle await tester tap find text await tester tap find text OK await tester pumpAndSettle expect find textContaining findsOneWidget expect find textContaining findsNothing expect find textContaining findsNothing So this test is targeting the DatePicker widget using the find byKey method more on find byKey in the Flutter docs Here is a screenshot of it Figure DatePicker widget in form appThen we select the th day of whatever month we re currently in and tap the OK button to set the value of this DatePicker widget Finally we validate that the value of the DatePicker widget is actually and not or This widget test is a simple way to test DatePicker widgets Let s add one widget test to test the Slider widget in the FormWidgetsDemo screen Here is a screenshot of it Figure Slider widget in Form AppAll we have to do is add the following code to the widget tests dart file form app test widget tests form widgets dart testWidgets Given the user navigates to the Form Widgets screen When the user slides the Estimated Value Slider to a certain value Then the Estimated Value Slider s value should be the specified value WidgetTester tester async await enterFormWidgetsScreen tester var estimatedValueSlider find byKey ValueKey estimated value slider await SlideTo tester slideToValue estimatedValueSlider await tester pumpAndSettle Slider slider tester firstWidget estimatedValueSlider expect slider value expect slider value lt false expect slider value gt false Also before we forget the above test requires an extra extention method more on extension methods in the Dart docs in the form app test extensions slide to dart file with the following code form app test extensions slide to dartimport package flutter test flutter test dart extension SlideTo on WidgetTester Future lt void gt slideToValue Finder slider double value double paddingOffset async final zeroPoint this getTopLeft slider Offset paddingOffset this getSize slider height final totalWidth this getSize slider width paddingOffset final calculatedOffset value totalWidth await this dragFrom zeroPoint Offset calculatedOffset I ll explain what the slideToValue method does shortly So the above test first navigates to the FormWidgetsDemo screen using the test fixture we defined above Then we locate the Slider widget by searching for the key value of estimated value slider Now we use the slideToValue extension method in the slide to dart file to slide the Slider widget s value to Now this method will take some trail and error to get the value perfected This is because the value parameter which is supposed to indicate the value to slide the widget to does not map one to one with the actual Slider widget meaning passing in a value value of would slide the Slider to whereas a value value of would slide the Slider to This is why we have the passed in a value of for our widget test Next we wait for all scheduled frames to stop using the pumpAndSettle method more on this method in the Flutter docs after which we use the firstWidget method more on this method in the Flutter docs to assign the Slider widget to a variable called slider This is done so that the value of this Slider widget can be extracted Finally we compare the value of the Slider widget and make sure it is using three expect methods Next let s add a widget test to test the error messages from the form field widgets in the Validation screen Here is a screenshot of the validation error messages we are going to test Figure Validation Errors in form appWe can do this by adding the following code to the form app test widget tests form widgets dart file form app test widget tests form widgets dart Future lt void gt enterValidationScreen WidgetTester tester async await tester pumpWidget MaterialApp home FormValidationDemo await tester pumpAndSettle testWidgets Given the user navigates to the Validation screen When the user submits the form without any values Then error messages should be shown under the text fields WidgetTester tester async await enterValidationScreen tester var submitButton find byKey ValueKey submit button await tester tap submitButton await tester pumpAndSettle expect find text Please enter an adjective findsOneWidget expect find text Please enter a noun findsOneWidget expect find text You must agree to the terms of service findsOneWidget Here is an explanation of the above code enterValidationScreen This method is a test fixture that navigates to the FormValidationDemo screentestWidgets Then error messages should be shown under the text fields This method tests whether the appropriate error messages for having empty text fields upon form submission show up when submitting the form This is done by first entering the Validation screen via await enterValidationScreen tester and then tapping the submitButton After waiting for the scheduled frames to die down we use find text to check whether the appropriate error messages are present in the screen Ok that s it for widget testing see you in the next section Integration TestingNow on to integration testing There are four main screens in the calorie tracker app application Homepage Day View screen History screen and Settings screen So our integration tests will be targeting these screens and their functionalities First let s start with the Homepage screen Let s go through some of the tests in the calorie tracker app test integration tests pages homepage dart file calorie tracker app test integration tests pages homepage dart testWidgets Given the user opens the app When the user is shown the homepage Then the user is shown the homepage title WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp expect find text Flutter Calorie Tracker App findsOneWidget debugDefaultTargetPlatformOverride null So this is our first integration test for the Homepage and it basically renders the Homepage using the tester pumpWidget method and checks for the existence of the Text widget with the text Flutter Calorie Tracker App This text will act as the title for the Homepage Next let s examine a different integration test contained in the calorie tracker app test integration tests pages day view dart file calorie tracker app test integration tests pages day view dart testWidgets Given user opens the app When user taps the Day View Screen button Then Day View Screen is shown WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp final Finder dayViewButton find text Day View Screen await tester tap dayViewButton warnIfMissed true await tester pumpAndSettle expect find text Today findsOneWidget debugDefaultTargetPlatformOverride null This test validates whether tapping on the Day View Screen button does the expected behavior of navigating to the Day View screen This is done through first finding the Day View button via the find text method and then using the tester tap method to simulate tapping on it Afterwards a pumpAndSettle method is issued to wait for all scheduled frames to stop Finally we use the expect call to find a TextButton widget with a text value of Today Finding this widget would definitively indicate that we have indeed navigated to the Day View screen Here is another integration test in the calorie tracker app test integration tests pages day view dart file calorie tracker app test integration tests pages day view dart testWidgets Given user opens the Day View screen When user taps the Add Food button Then Add Food modal opens WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp final Finder dayViewButton find text Day View Screen await tester tap dayViewButton warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey add food modal button warnIfMissed true await tester pumpAndSettle expect find byKey ValueKey add food modal findsOneWidget debugDefaultTargetPlatformOverride null This test s main purpose is to check whether a modal would open when clicking the appropriate button to open it Here is a GIF demonstrating this feature Figure Open Add Food modal WorkflowFirst we navigate to the Day View screen locate the IconButton widget with a icon as its value and then tap it After waiting for a tester pumpAndSettle call to complete we use the find byKey method to check whether the modal has been opened The find byKey method which you can learn more about in the Flutter docs uses the key parameter specified in select widgets to check for the modal s existence on the screen To elaborate this finding process further the find byKey method searches for a ValueKey class instance that is used as the key parameter value in widgets Next up let s test whether adding a new food entry via the Add Food modal would create a FoodTile instance in the bottom portion of the Day View screen To give a better idea of this workflow here is a GIF that goes through the process Figure Create Food Track Entry WorkflowHere is the test that is validating this feature contained in the calorie tracker app test integration tests pages day view dart file calorie tracker app test integration tests pages day view darttestWidgets Given user opens the Day View Screen When user submits the Add Food modal form Then a new FoodTrack instance is created WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp final Finder dayViewButton find text Day View Screen await tester tap dayViewButton warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey add food modal button warnIfMissed true await tester pumpAndSettle await tester enterText find byKey ValueKey add food modal food name field Cheese await tester enterText find byKey ValueKey add food modal calorie field await tester enterText find byKey ValueKey add food modal carbs field await tester enterText find byKey ValueKey add food modal protein field await tester enterText find byKey ValueKey add food modal fat field await tester enterText find byKey ValueKey add food modal grams field await tester tap find byKey ValueKey add food modal submit await tester pumpAndSettle expect find text Cheese at findsOneWidget debugDefaultTargetPlatformOverride null Picking up from the previous integration tests we tap the IconButton widget and enter the details of a food item in the form that is presented in the modal The entering of text is done by the tester enterText method more details of which can be learned through the Flutter docs Then after hitting the Submit button we check for the existence of a FoodTile instance that should contain the data entered in the form Namely the food name Cheese should be present in the first position of the list that is shown in the Day View screen We make sure to explicitly check the first element in the food list via find text Cheese at because as integration tests are run multiple times there are chances that the newly created food entry might render off screen toward the bottom In order to avoid complications of having to scroll down we only check the first item in the food track list Here s another interesting integration test for the Day View screen in the calorie tracker app app calorie tracker app test integration tests pages day view dart testWidgets Given user opens the Day View screen When the user taps the Left Arrow Button then Right Arrow Button Then DatePicker s value changes from Yesterday to Today WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp final Finder dayViewButton find text Day View Screen await tester tap dayViewButton warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey left arrow button warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey right arrow button warnIfMissed true await tester pumpAndSettle expect find text Today findsOneWidget debugDefaultTargetPlatformOverride null So this test is designed to test the ShowDatePicker widget s functionality of moving between dates upon tapping the arrow buttons Here is a GIF showing this functionality Figure Day View Screen Date Switching WorkflowAfter the usual tester tap method that simulates the tapping on the left and right arrow buttons we switch from yesterday s date to today s date and then check for the string Today via find text in order to validate this testcase Ok last but not least we can add this testcase in the Day view integration test file calorie tracker app test integration tests pages day view dart testWidgets Given user opens the Day View Screen When the user taps a Food Tile Delete Button Then that Food Tile is removed from the Food Track List WidgetTester tester async debugDefaultTargetPlatformOverride TargetPlatform android WidgetsFlutterBinding ensureInitialized await Firebase initializeApp await SharedPreferencesService init await tester pumpWidget CalorieTrackerApp final Finder dayViewButton find text Day View Screen await tester tap dayViewButton warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey add food modal button warnIfMissed true await tester pumpAndSettle Random random new Random int randomNumber random nextInt String foodName Cheese randomNumber toString await tester enterText find byKey ValueKey add food modal food name field foodName await tester enterText find byKey ValueKey add food modal calorie field await tester enterText find byKey ValueKey add food modal carbs field await tester enterText find byKey ValueKey add food modal protein field await tester enterText find byKey ValueKey add food modal fat field await tester enterText find byKey ValueKey add food modal grams field await tester tap find byKey ValueKey add food modal submit await tester pumpAndSettle await tester dragUntilVisible find ancestor of find text foodName matching find byType ExpansionTile find byKey ValueKey food track list const Offset await tester tap find ancestor of find text foodName matching find byType ExpansionTile warnIfMissed true await tester pumpAndSettle await tester tap find byKey ValueKey delete button warnIfMissed true await tester pumpAndSettle expect find text foodName findsNothing debugDefaultTargetPlatformOverride null Here is a GIF demostrating what this test encompases Figure Add Then Delete Food Entry WorkflowQuite possibly our most involved integration test this test validates the ability to add and then delete a food entry Here is a detailed breakdown of this test First the Add Food modal is opened and the details of a new food is added The reason for generating a random food name by adding a random number to the string Cheese is to prevent duplicate food names in the food list that can be problematic when using find text to search for the newly created food entry in the food list After adding a new food entry a new food item will appear in the food list Now before searching for the newly added food entry we make sure to scroll to the bottom of the food list via the tester dragUntilVisible method This method drags the current view until the first parameter is visible on screen for more info on dragUntilVisible here is the Flutter docs link Speaking of the first parameter which in this case is the newly added food entry the find ancestor method is used in combination with find text to find the food tile itself The find text method would locate the food entry Text widget and then the find ancestor method finds the parent widget containing that Text widget more on the find ancestor in the Flutter docs This parent widget is the food tile itself Now with the appropriate food tile located we can tap it via the tester tap method Afterwards we find the delete button via the find byKey method and tap it Finally we validate that the deleted food tile is not able to be found via the expect method Ok although we can go on and on with more examples of integration testing let s stop here for the sake of brevity ConclusionWhew If you made it this far congrats You now know some ways of testing Flutter applications Thanks for reading this blog post If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time If you found this article helpful please share it and make sure to follow me on Twitter and GitHub connect with me on LinkedIn and subscribe to my YouTube channel 2022-04-14 01:01:25
金融 ニッセイ基礎研究所 3億人の‘新市民’市場と保険サービス(中国) https://www.nli-research.co.jp/topics_detail1/id=70876?site=nli 臨時就労保険は、アリババグループというビッグテックによるオンライン金融事業に属するが、それを担うアリ保険は保険代理販売の資格を取得しており、当局による金融規制の下にある。 2022-04-14 10:56:02
海外ニュース Japan Times latest articles ‘Phoenix Goes On’: Buddy road trip offers fun hijinks https://www.japantimes.co.jp/culture/2022/04/14/films/film-reviews/phoenix-goes-on/ bizarre 2022-04-14 10:10:28
海外ニュース Japan Times latest articles Inside the curious creations of Fujiko A. Fujio https://www.japantimes.co.jp/culture/2022/04/14/books/motoo-abiko-manga/ humor 2022-04-14 10:00:41
ニュース BBC News - Home UK to sign deal to send asylum seekers to Rwanda for processing https://www.bbc.co.uk/news/uk-politics-61097114?at_medium=RSS&at_campaign=KARANGA charity 2022-04-14 01:23:09
GCP Google Cloud Platform Japan 公式ブログ BigLake: データレイクとデータ ウェアハウスを複数のクラウド間で統合 https://cloud.google.com/blog/ja/products/data-analytics/unifying-data-lakes-and-data-warehouses-across-clouds-with-biglake/ さらに、ユーザー側ではデータセットをより迅速に分析できるようになりました」ーBolcomソフトウェアエンジニアMartinCekodhima氏BigQueryをマルチクラウド環境全体に拡張し、ガバナンスとともにデータウェアハウスとデータレイクを統合BigLakeテーブルを作成することで、BigQueryのお客様はワークロードをGoogleCloudStorageGCS、AmazonS、AzureDataLakeStorageGenで構築されたデータレイクに拡張できます。 2022-04-14 03:00:00
北海道 北海道新聞 秋元市政、性別・年代問わず支持低下 除排雪や五輪招致不満反映か 本紙世論調査 https://www.hokkaido-np.co.jp/article/669206/ 世論調査 2022-04-14 10:29:20
北海道 北海道新聞 米グーグル、1・2兆円投資 22年に国内で、拡大続く https://www.hokkaido-np.co.jp/article/669306/ 米国 2022-04-14 10:27:00
北海道 北海道新聞 広島の平和監視時計、巻き戻し 米核実験受け「210」に https://www.hokkaido-np.co.jp/article/669305/ 巻き戻し 2022-04-14 10:26:00
北海道 北海道新聞 北朝鮮、功労者に豪華住宅 看板アナら、正恩氏が設計 https://www.hokkaido-np.co.jp/article/669294/ 北朝鮮メディア 2022-04-14 10:11:57
北海道 北海道新聞 台風1号、小笠原最接近へ 猛烈な風で建物被害恐れ https://www.hokkaido-np.co.jp/article/669269/ 非常に強い台風 2022-04-14 10:07:04
北海道 北海道新聞 ロシア黒海艦隊旗艦に重大損傷 乗組員退避 https://www.hokkaido-np.co.jp/article/669287/ 黒海艦隊 2022-04-14 10:11:42
北海道 北海道新聞 南ア東部の洪水、死者300人超 「気候変動」と大統領 https://www.hokkaido-np.co.jp/article/669301/ 南アフリカ 2022-04-14 10:08:00
北海道 北海道新聞 東北新幹線、全線で運転再開 1カ月ぶり 脱線や地震対策検証へ https://www.hokkaido-np.co.jp/article/669267/ 東北新幹線 2022-04-14 10:07:26
マーケティング MarkeZine オープンエイト、動画自動生成APIをリリース 第1弾として賃貸情報サービス「賃貸スモッカ」に導入 http://markezine.jp/article/detail/38772 情報サービス 2022-04-14 10:15:00
IT 週刊アスキー DMM GAMES、新作3DタクティクスRPG 「天啓パラドクス」正式サービス開始 https://weekly.ascii.jp/elem/000/004/089/4089220/ dmmgames 2022-04-14 10:40:00
GCP Cloud Blog JA BigLake: データレイクとデータ ウェアハウスを複数のクラウド間で統合 https://cloud.google.com/blog/ja/products/data-analytics/unifying-data-lakes-and-data-warehouses-across-clouds-with-biglake/ さらに、ユーザー側ではデータセットをより迅速に分析できるようになりました」ーBolcomソフトウェアエンジニアMartinCekodhima氏BigQueryをマルチクラウド環境全体に拡張し、ガバナンスとともにデータウェアハウスとデータレイクを統合BigLakeテーブルを作成することで、BigQueryのお客様はワークロードをGoogleCloudStorageGCS、AmazonS、AzureDataLakeStorageGenで構築されたデータレイクに拡張できます。 2022-04-14 03:00:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)