TECH |
Engadget Japanese |
Amazonセール祭りで28%OFF、Ankerのポータブル電源『PowerHouse 100』を使ってみた |
https://japanese.engadget.com/anker-power-house-100-070050962-104550082.html
|
amazon |
2021-05-24 10:45:39 |
TECH |
Engadget Japanese |
5つのUSBポートとACポート装備で様々なデバイスを急速充電。「Worldplugトラベルアダプター」 |
https://japanese.engadget.com/worldplug-travel-adapter-101305469.html
|
海外への出張や旅行の時、飛行機から降りてすぐ充電ができなくて困ったことはありませんか荷物がデバイスとそのアダプターでいっぱいになったりしませんかWorldplugが台あれば、世界中どこへ行ってもMacBookからiPad、iPhoneまで様々なデバイスを充電することができます。 |
2021-05-24 10:13:05 |
TECH |
Engadget Japanese |
Chromeに実験機能「ウェブサイトをフォロー」、開発版でテスト開始 |
https://japanese.engadget.com/chrome-follow-website-100034501.html
|
chrome |
2021-05-24 10:00:34 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 小学校教員がSMSフィッシング被害に 学級名簿などを保存したクラウドストレージの個人アカウントが奪われる |
https://www.itmedia.co.jp/news/articles/2105/24/news142.html
|
itmedia |
2021-05-24 19:35:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] ヘッドフォン使う映画館、代官山に誕生 「映画関係者が活躍できる場に」 |
https://www.itmedia.co.jp/news/articles/2105/24/news139.html
|
itmedia |
2021-05-24 19:12:00 |
IT |
MOONGIFT |
mac-cleanup - macOSの不要ファイルをまとめて削除 |
http://feedproxy.google.com/~r/moongift/~3/atZZh9yF99M/
|
maccleanupmacOSの不要ファイルをまとめて削除macOSを使っていて、徐々にストレージが逼迫してきたことはないでしょうか。 |
2021-05-24 21:00:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Word2Vecのモデルのロード方法を理解する |
https://qiita.com/oral_anime_love/items/77569bcd01d9448f412e
|
WordVecのモデルのロード方法を理解するWordVecのモデルのロード方法を理解するモデルをロードする二つの方法gensimmodelsWordVecloadxxxbingensimmodelsKeyedVectorsloadwordvecformatxxxbinbinaryTrue隠れた重み、語彙頻度、および二分木など学習に用いられるデータを含めてロードする隠れた重み、語彙頻度、および二分木が欠落しているため、ベクトルのトレーニングを続行することはできない。 |
2021-05-24 20:00:09 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
使っていない大きなファイルを探すときのために |
https://qiita.com/azumabashi/items/35cd579b924efa023436
|
使っていない大きなファイルを探すときのために使っていない大きなファイルを探すときのために。 |
2021-05-24 19:47:52 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
[Rails]インクリメンタルリサーチの実装 |
https://qiita.com/tochisuke221/items/fcc71432a165eed5ac11
|
そのために、以下のような処理を行います。 |
2021-05-24 19:09:31 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
AmazonLexのレスポンスについて |
https://teratail.com/questions/340119?rss=all
|
amazon |
2021-05-24 19:58:24 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
[Python] ImportError: No module named PIL.Imageの解決方法 |
https://teratail.com/questions/340118?rss=all
|
PythonImportErrorNomodulenamedPILImageの解決方法前提・実現したいこと「Python年生」のlessonnbspで画像表示アプリを作っているのですが、「ImportErrornbspNonbspmodulenbspnamednbspPILImage」のエラーが出て先に進めません。 |
2021-05-24 19:35:55 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
単語照合プログラムについて |
https://teratail.com/questions/340117?rss=all
|
単語照合プログラムについて前提・実現したいこと与えられた単語以下、クエリと示すが標準入力されたファイルに対して、含まれていればその一文を出力しようとしています。 |
2021-05-24 19:34:12 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
前日の集計データのみ取得したい |
https://teratail.com/questions/340116?rss=all
|
前日の集計データのみ取得したい前提・実現したいこと昨日の集計データのみ抽出したいのですが、エラーを解決できません。 |
2021-05-24 19:32:13 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
python keras binary_crossentropy に関して |
https://teratail.com/questions/340115?rss=all
|
pythonkerasbinarycrossentropyに関して前提・実現したいことValueErrornbsplogitsnbspandnbsplabelsnbspmustnbsphavenbspthenbspsamenbspshapenbspNonenbspnbspvsnbspNonenbsp最終的に損出関数nbspbinarycrossentropynbspを用いて出力つを得たいのですがなぜかこのエラーが出てしまいます。 |
2021-05-24 19:30:22 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
テキストファイルの違いの数を出力させたい |
https://teratail.com/questions/340114?rss=all
|
テキストファイルの違いの数を出力させたいテキストファイルに含まれる単語のうち、テキストファイルテキストファイルと行数が異なり、既にソートされているに含まれないものの数を求めたいです。 |
2021-05-24 19:28:53 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
SDL2/OpenGL:画像を描画できないです。 |
https://teratail.com/questions/340113?rss=all
|
OpenGLで画像を描画したいと思います。 |
2021-05-24 19:28:27 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
python 2進数を4桁で表示したい |
https://teratail.com/questions/340112?rss=all
|
|
2021-05-24 19:23:38 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
漸化式の計算がうまくいかないです |
https://teratail.com/questions/340111?rss=all
|
漸化式の計算がうまくいかないです番号リストnbsp前提・実現したいこと漸化式annbspnbspnbspannbspの計算をしたいですnbspanはaのnを表していますここに質問の内容を詳しく書いてください繰り返し処理を使って漸化式の計算をしようと試みているのですが、計算結果が異なってしまいます。 |
2021-05-24 19:20:00 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
bitbucketでプルリクエストした時に差分が変更出来ない。 |
https://teratail.com/questions/340110?rss=all
|
bitbucketでプルリクエストした時に、コードを変更した時の差分が表示されるのですが、どのように直せばいいかわかりません。 |
2021-05-24 19:19:47 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Accessで、HTMLのような(キー:値)形式プルダウンを作りたい |
https://teratail.com/questions/340109?rss=all
|
Accessで、HTMLのようなキー値形式プルダウンを作りたいお世話になります。 |
2021-05-24 19:14:37 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
【PHP】乱数を用いた四則演算の計算結果表示方法 |
https://teratail.com/questions/340108?rss=all
|
【PHP】乱数を用いた四則演算の計算結果表示方法前提・実現したいことPHPの勉強をしています。 |
2021-05-24 19:11:58 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
【python】 twitterにて特定ユーザーのツイートをlineに通知するbotを作りたいのですが、うまくいきません。 |
https://teratail.com/questions/340107?rss=all
|
【python】twitterにて特定ユーザーのツイートをlineに通知するbotを作りたいのですが、うまくいきません。 |
2021-05-24 19:10:40 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
laravelインストール時のエラー |
https://teratail.com/questions/340105?rss=all
|
laravelインストール時のエラーいつもお世話になっております。 |
2021-05-24 19:05:00 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
[Rails]インクリメンタルリサーチの実装 |
https://qiita.com/tochisuke221/items/fcc71432a165eed5ac11
|
そのために、以下のような処理を行います。 |
2021-05-24 19:09:31 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Dockerを使った環境構築 |
https://qiita.com/subaru-hello/items/bc97daef89ad371024a2
|
Dockerを使った環境構築Farstepさんの動画「rails環境構築】dockerrailsmysqlで環境構築初心者でも分で完了」tsを視聴して環境構築をしました。 |
2021-05-24 19:29:30 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
f.collection_select |
https://qiita.com/takuo_maeda/items/18f683b9ffba6d6a42b7
|
|
2021-05-24 19:52:37 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Active Model Serializerを使用してAPIのJSONを指定のハッシュにネストしたい |
https://qiita.com/tripoodle/items/42895ee624970d04dcfe
|
ActiveModelSerializerを使用してAPIのJSONを指定のハッシュにネストしたいActiveModelSerializerを使ってAPIを生成してみました。 |
2021-05-24 19:40:40 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
[Rails]インクリメンタルリサーチの実装 |
https://qiita.com/tochisuke221/items/fcc71432a165eed5ac11
|
そのために、以下のような処理を行います。 |
2021-05-24 19:09:31 |
海外TECH |
DEV Community |
Scheduling API for Service Providers |
https://dev.to/spurwing/scheduling-api-for-service-providers-56de
|
Scheduling API for Service ProvidersManaging multiple offices with a high influx of client appointments can be complicated and error prone Tracking the appointments with client s payments makes it even more cumbersome That is where a system like what Spurwing provides becomes a crucial element of daily office life What Can Spurwing API Do Spurwing s Scheduling API has been used by a variety of companies from health related offices to engineering and development teams It has several scheduling tools to keep appointments organized and convenient to clients Custom time management solution systems can be designed around your specific use cases for instance Allow clients to maintain choice in who they are seeing during their appointment Keep track of scheduling of multiple staff members with various services in several locations Maintain all client information in one place This API system is super convenient for clients or customers because it creates recurring appointments automatically and also has management systems that keep businesses in good communication with their clients Will Clients Like It Clients will love this system even if they are resistant to online appointment booking One of the best features of this system is the ability for clients to choose who they will be seeing when they book their appointment through the system This is a great benefit to those in doctor s offices counseling banking or other heavily booked industries that may not always have the same staff available Spurwing s Scheduling API is the perfect option for those with franchise businesses or multiple locations because it centralizes appointments and bookings for all locations This allows all staff members to stay informed and help clients with their bookings regardless of where the clients call or who is answering the phone that day Maintaining the client s appointment history notes and contact information in one place saves time and effort for all staff members This reduces emails and phone calls to get the necessary information to assist a client with changing or canceling appointments or retrieving information regarding a booking Another great feature of this system is it has a two way synchronization with other appointment apps like iCal Google Calendar and Outlook Anyone can add to calendar links for any appointment with one click Why Spurwing s Scheduling API This system has been tested with million bookings It is known to have a ton of incredible features along with reliability Those using it know it s easy to worth with so the entire staff can use it quickly The integration system can be built either completely from scratch to customize it exactly you the business needs or it can be constructed using open source widgets It can be built to match your brand with no mention of the company behind the system so clients will see it as your system It is built as HIPAA compliant with all data encrypted fully audit logged and stores at SOC certified facilities Spurwing s API is a system to consider for those in medium to large offices if you plan to grow because it will grow with your office It is a solid appointment and information management system that keeps your clients on track with your business schedule For more information visit the links below or schedule an intro call with our engineers at Learn more |
2021-05-24 10:16:07 |
海外TECH |
DEV Community |
CSS Grid Course for Complete Beginners |
https://dev.to/zachgoll/css-grid-course-for-complete-beginners-4256
|
CSS Grid Course for Complete Beginners PrerequisitesA basic understanding of HTMLA basic understanding of CSSA working knowledge of Flexbox I will be borrowing many concepts from my Flexbox tutorial here The goal for this lessonView this lesson on YouTube hereBy the end of this lesson you will Be able to explain to someone what CSS Grid isUnderstand the basic syntax and model of CSS GridUnderstand how CSS Grid and Flexbox prior lesson relatesUnderstand when to use Flexbox and when to use CSS Grid for CSS layouts yes they can be used together Be able to build the Holy Grail Layout with CSS Grid and Flexbox see below What is the fullstackroadmap series This is part of my fullstack developer series where you ll go from never having written a line of code to deploying your first fullstack web application to the internet Click this link to get an overview of what this series is all about Series Table of ContentsGithub Repository where you ll find all the code we write in this seriesYouTube PlaylistSeries Overview Days of Code Challenge I highly recommend you take this on while reading this series Please tag me on Twitter zg dev and share this series with DaysOfCode Let s Begin What is CSS Grid CSS Grid is a dimensional layout system In other words you can control how elements sit on both the x and y axis which is an addition to Flexbox which we learned in the prior lesson of this series Here is why we need CSS Grid in our lives Before pre Flexbox Grid front end developers used hacky solutions to create complex layouts This included those nasty float and clear properties along with some tedious mathematical calculations From Flexbox exists Grid doesn t the CSS layout game was easier than before but still didn t have a great solution for high level layouts such as the Holy Grail layout You could get it done with Flexbox but this required some tricks and a good amount of ingenuity From forward we have CSS Grid for high level complex d layouts and Flexbox for simpler layouts It s the best of both worlds But the next obvious question becomes How do we know when to use CSS Grid vs Flexbox When to use CSS Grid vs FlexboxCSS Grid and Flexbox work together They are both part of the CSS spec and while they do similar things related to layouts they were not intended to compete with each other Use Grid when You need full control of rows AND columns examples full page layouts gallery items You want to explicitly define the layout regardless of content size i e if you are using Flexbox and it starts to get really complicated with a bunch of heights and widths you probably should be using Grid Use Flexbox when Your content is a row OR column examples horizontal navbar vertical sidebar You want the size of items to determine layoutWe will go through an example of this later in the tutorial so you can see this in action One more thing before we get started Do all browsers support CSS Grid For the sake of a beginner learning front end web development YES As of March all major browsers have built in support for CSS Grid and you shouldn t be worried about this For someone working in the industry who must support Internet Explorer bless your soul and some other old browsers NO You will need fallback styles Luckily with media queries this is straightforward supports display grid Put your CSS Grid styles here Everything you put in that block will apply if the browser supports CSS Grid Grid Container vs Grid ItemsIf this heading sounds familiar good If not please please please go read my Flexbox tutorial before continuing forward This post is highly dependent on concepts we learned there and I will be glossing over them here Just like we had Flex containers and Flex Items with CSS Grid we have Grid Containers and Grid Items Look at the following HTML and CSS lt div class grid container gt lt div class grid item gt lt div gt lt div class grid item gt lt div gt lt div class grid item gt lt div gt lt div gt grid container display grid Like Flexbox we activate CSS Grid by setting the display CSS property With a few tweaks to the grid settings and some additional color styles on the grid items you can create something that looks like this As a preview to the remainder of the tutorial notice the following things The above visual is one of many examples I could have used For our example I kept things simple and made our grid perfectly square rows columns all equal height and width The dotted lines are important These are the boundaries for our grid With CSS Grid we call the rows and columns tracks Understanding CSS Grid is all about knowing how to manipulate the size and location of each grid item To do that we have several container level properties and several grid item level properties available Before you freak outWhat you re about to see is a long list of CSS properties that we can use with CSS Grid At first glance they are intimidating but if you went through my Flexbox tutorial you have the foundation required to understand this stuff well We will add some new concepts but most of the content to follow is layers on top of what you already know I m confident that the overwhelm you re about to feel will subside quickly as we dive in Grid Container vs Grid Item PropertiesConsistent with my prior tutorial on Flexbox here are two cheat sheets for CSS Grid that have really helped me When I was learning I kept them open constantly I recommend you do the same for a couple weeks Cheat Sheet Great for experimenting with different property values in a live settingCheat Sheet Great for visualizing properties based on their container vs item classification as I ve done below Also consistent with previous tutorials below are links to the MDN documentation for CSS Grid properties I will explain each of these in detail throughout the post Grid Container PropertiesSet these properties on the HTML container you want to turn into a grid Don t memorize these we ll learn how they work later Activate the Griddisplay grid Activates CSS Grid system on your HTML elements other valid values include inline grid and subgrid but we won t cover these here Sizinggrid template rows Defines the size of the grid rowsgrid template columns Defines the size of the grid columnsrow gap Defines the size of the horizontal gutters between rowscolumn gap Defines the size of the vertical gutters between columnsgrid auto rows When you don t explicitly set a row s size via grid template rows the size is determined by this value grid auto columns When you don t explicitly set a column s size via grid template columns the size is determined by this value Alignmentgrid auto flow Sets the algorithm used to place grid items that you don t explicitly placegrid template areas A bit hard to explain this property without an example I will cover this later in the tutorial justify items Aligns items along the horizontal axis within their grid areasalign items Aligns items along the vertical axis within their grid areasjustify content Aligns the grid item group along the horizontal axis similar to how we used it in Flexbox where flex direction row align content Aligns the grid item group along the vertical axis a bit different than how we used it with Flexbox Grid Item Properties Sizinggrid row start For a given grid item defines the vertical starting pointgrid row end For a given grid item defines the vertical ending pointgrid column start For a given grid item defines the horizontal ending pointgrid column end For a given grid item defines the horizontal ending point Alignmentjustify self Aligns a single grid item on the horizontal axisalign self Aligns a single grid item on the vertical axisHere is a visual of all these properties in one spot Shorthand Grid PropertiesJust like Flexbox Grid has shorthand properties that combine some of the above properties together Remember this Both rules below are equivalent flex container flex grow flex shrink flex basis auto flex container Shorthand property for Flexbox Equivalent to flex lt flex grow gt lt flex shrink gt lt flex basis gt flex auto We can do similar things with CSS Grid I do not recommend using these until you have become comfortable with the longhand properties above Nevertheless here they are grid The shorthand of all shorthand properties This defines pretty much everything at once row columns areas flow grid template Similar to grid but less comprehensive Defines the rows columns and areas of the grid gap grid gap Defines all the gutters at oncegrid area Defines the entire area of a grid item at oncegrid row A subset of grid area this defines the row sizing of a grid itemgrid column A subset of grid area this defines the column sizing of a grid itemAnd if you need to see these visually like I do here is a mind map to reference Part Constructing the GridWhile I m confident we can get through this topic without much confusion it s going to require a methodical series of steps Read carefully and don t skip ahead This goes in a specific order First off let s construct the playground we are going to use to explore CSS Grid In the Codepen below the only grid related property I have set is this grid container display grid The Grid itself is activated but we haven t set any properties on it yet Please read through the CSS comments in the Codepen below and get yourself comfortable Visually speaking here is what we are dealing with In grid speak here is what we have done Since all of these properties default to these values you could delete everything below and achieve the same layout as above grid container display grid grid template rows auto auto auto grid template columns auto align items stretch justify items stretch gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end The Grid TemplateThere is a lot to unpack here Let s start with these two properties grid template rowsgrid template columnsThese two properties alone will define our gridlines and ultimately the structure of our grid If we don t set these properties explicitly we get something called an implicit grid which will always be column wide and the number of rows will be based on the number of grid items In our case we had column X rows because we had grid items To really see this in action let s remove the grid items for a moment and look at examples We will start simple grid container display grid grid template rows fr fr fr grid template columns fr fr When you see fr this means fractional unit and works identically to how our flex grow and flex shrink values did in our Flexbox tutorial again if you haven t please read it before moving on In the example above we have defined grid template rows in equal parts We have allocated fractional units fr fr fr so each row will receive of the available grid space We defined grid template columns in parts but they are not equal In total we have allocated fr units but gave of them to the first column and to the second If each unit is equal to then the first column will be wide and the second column will be wide Here is the grid we just defined One thing that you ll notice is that we have columns but lines that represent boundaries This is similar to the fence post math problem Because of this I have renamed them to CL n and RL n short for Column Line n and Row Line n Here s one more example grid container display grid grid template rows fr fr fr fr fr fr fr fr grid template columns fr fr fr fr fr fr fr fr We have defined rows and columns of equal width an height i e a perfectly square grid Here is what it looks like Before we move on let s simplify our CSS by using the repeat function In this tutorial I won t be getting into the shorthand Grid properties much but this one is simple and will save you some typing As opposed to typing a bunch of fr units to define our grid we can write this grid container display grid grid template rows repeat fr grid template columns repeat fr Positioning Items on the GridLet s keep going with that x grid example from above and add some grid items By default here is what we get when we add grid items with no width height and no additional Grid properties In CSS Grid terminology the grid area represents the space that a grid item occupies We have not explicitly instructed our grid to place the grid items so they will take up cell of the grid each Here is a more detailed visual The above visual is the default but what if I wanted to place these three items in specific locations on the grid Maybe something like this Before CSS Grid achieving this layout would require a tremendous effort With Grid it s simple To place items you just need to specify the line that they start end on from a row column perspective Let s break this down Grid item Starts on RL ends on RL Starts on CL ends on CL Grid item Starts on RL ends on RL Starts on CL ends on CL Grid item Starts on RL ends on RL Starts on CL ends on CL Let s take this information and translate it into CSS All of the properties below are grid item not container properties gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end Optionally you could could have used the grid row and grid column properties here to simplify but like I mentioned earlier it is best to use the longhand properties until you are really comfortable with CSS Grid Here s the result Sizing Items on the GridBy default our grid items are filling the space of one grid cell naturally If you look at any of the Codepens above you can see the following specs for our grid The Grid container is px wide and px tall with a border of px Therefore the total available space is px wide and px tall when box sizing border box The Grid is x Each grid cell will be px wide and px tall px There are two ways that we can resize them Set an explicit width and height on eachChange the grid row end and grid column end propertiesOption isn t great because it will open a can of worms we re not ready for yet Let s try option and replicate this While this might seem difficult we can use the same method we did to place the grid items above Here s the CSS gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end And here s the result Review Setting up the GridAt this point you know the basics of setting up a CSS Grid container and placing sizing items within it The structure is relatively simple as you have seen throughout the tutorial lt div class grid container gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div gt grid container Generic CSS properties width px height px border px solid Grid container properties display grid grid template rows repeat fr grid template columns repeat fr gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end While this will get you started there is more to talk about and certainly some details that I purposefully omitted here We will circle back to some of these properties later For now let s talk about aligning grid items within the grid container AND within their grid areas Basic CSS Grid AlignmentIf you following this tutorial closely you might be asking why we are talking about alignment Didn t we just talk about alignment While we discussed the placement and sizing of grid items we did not cover their alignment which can happen in two ways Alignment within a item s grid area Alignment within a grid container Grid Area AlignmentWe briefly covered what a grid area means but not enough for you to walk away confidently Let s go back to our x grid and define a grid area that we want to experiment with Since our grid is fr x fr this grid area is fr x fr We can place a grid item in this space using the following HTML and CSS lt div class grid container gt lt div class grid item gi gt lt div gt lt div gt grid container width px height px border px solid display grid grid template rows repeat fr grid template columns repeat fr gi grid row start grid row end grid column start grid column end And here it is live with some styling We know from earlier that the total size of a single grid cell is px wide and tall Therefore our grid area here is px wide and tall and our grid item is stretching to fit those dimensions But what if we explicitly set some dimensions on our grid item Let s set this grid item to px gi width px height px When we do this our grid area will remain the same but now our grid item does not fill of it So now we ve got this empty space within our grid area Would it be possible to center my grid item in the grid area Of course Here s the recipe grid container justify items center horizontal align items center vertical Here s what we just did See how our grid item is now centered in the grid area Here s the code I suggest toggling these two CSS properties on and off in the CSS to visualize what it is doing Seems similar to Flexbox Alignment In Flexbox we use the following two CSS properties to align items within their flex container justify content aligns items on the main axis align items aligns items on teh cross axis With CSS Grid if we want to align grid items within their grid areas we use these properties justify items aligns items in the horizontal direction within the grid areaalign items aligns items in the vertical direction within the grid areaCSS Grid also has the justify content and align content properties but we aren t quite ready to explore those yet To make this even more clear let s add another grid item into the equation This time it will occupy fr x fr units for the grid area This means that the grid area dimensions will be px wide and tall We will make our second grid item px arbitrary anything less than px will work wide and tall so that it has some empty space and we can see the effect of these alignment properties Here s what we re dealing with without any alignment properties set yet Let s go one step at a time First we ll set the vertical alignment of the grid items within their grid areas grid container align items center vertical Here s what we get Now we will set the horizontal alignment with justify items grid container align items center vertical justify items center horizontal As you can see our grid items are now centered within their grid areas Here is the relevant code In this tutorial I m supplying you with visualizes that help you see what is happening but how would we verify these things without them Glad you asked if you open up the Google Chrome Developer Tools other browsers like Firefox work too you will see something like this Notice how our items are perfectly centered within their grid areas Aligning the Entire GridUp to this point we have been working in perfect conditions grid container width px height px border px solid display grid grid template rows repeat fr grid template columns repeat fr Our grid container HTML element has px of available space which is evenly filled with our grid itself because of our grid template rules The repeat fr rule is saying I want rows and columns and I want each grid cell to evenly divide the px of available space Therefore in our examples so far each grid cell is px wide and tall What if we changed the rule to this grid container width px height px border px solid display grid grid template rows repeat px grid template columns repeat px Our grid container s available space is px but now our grid is px wide and tall px Our grid is smaller than our grid container Here s a visual of what that might look like by default Let s put our grid items back on Since we decreased the size of our grid we need to decrease the size of our grid items Remember Grid item has a grid area equal to x which is equal to x pixels Grid item has a grid area equal to x which is equal to x pixels To ensure that the grid items are smaller than their grid areas let s make them x and x pixels respectively exactly half the size of their grid areas in each case Here s what our CSS looks like so far grid container width px height px border px solid display grid grid template rows repeat px grid template columns repeat px gi color E background color DE grid row start grid row end grid column start grid column end width px height px gi color DE background color ACD grid row start grid row end grid column start grid column end width px height px Let s throw a little curveball here to practice our grid item alignment skills Add the following CSS to your grid container grid container justify items end align items end This will reposition both items to occupy the bottom right corner of their grid areas Here s what that looks like justify content and align contentWe are finally ready to see what these two properties do Once again if the grid size is smaller than the grid container size these properties will align the ENTIRE grid within the grid container Let s go ahead and center our grid by adding these properties to the container grid container justify content center align content center Here s what we get In the image above it s obvious what is happening The entire grid is centered within the grid container and the grid items are placed at the end of their grid areas Once we turn this into code it s not so obvious But once again you can open your developer tools and hover over the grid to see a clearer picture of what s going on The developer tools do not highlight the grid areas that we talked about so I added those in manually Since we defined our grid items to be perfect multiples of the grid area sizes they fit perfectly within the grid cells More Grid Alignment ExamplesIt would be overly tedious for me to create visuals for every possible alignment combination That is what cheat sheets are for Nevertheless I want to give you a few more examples to look at to better understand these grid alignment properties Example Example Example CSS Grid Basics SummaryAt this point I ve shown you the basics of CSS Grid There is a lot more that you can do with it but we ve got the core concepts in place Before moving on with the tutorial you should feel comfortable explaining how the following CSS properties are used in the context of the CSS Grid system Container Propertiesdisplay grid activates the gridgrid template rows grid template columns Defines the number of rows columns in the gridjustify content align content Aligns the entire grid if it is smaller than its container justify items align items Aligns grid items within their grid areas which are defined at the item level Grid Item Propertiesgrid row start grid row end Defines the horizontal grid area for an itemgrid column start grid column end Defines the vertical grid area for an item A Quick CSS Grid ChallengeWith your current knowledge you should be able to create the design from the very beginning of this tutorial Here is a starter Codepen just hit the fork button to copy it to your account along with the solution Starter Solution Solution using shorthand Grid properties Intermediate CSS GridThe remainder of the tutorial will be an exploration of CSS Grid properties and how we can make the most out of this system While the following content is not required to use CSS Grid effectively I highly recommend reading all of it I do not intend to cover every remaining detail of CSS Grid but rather point out the most useful parts that we haven t touched on thus far CSS Grid Gutters When you make a grid on a web page you re most likely going to want some spacing between your grid items We could create this spacing with padding margin or even some Flexbox magic but there is no need to when you have the power of CSS Grid We call this spacing gutters and it is easy to do with the row gap and column gap properties Let s start with a basic x grid Here are the CSS Grid properties you need to create this lt div class grid container gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div gt grid container display grid grid template rows repeat fr grid template columns repeat fr Let s add some gutters grid container row gap px column gap px Yep it s really that easy Just add your desired gutter width and your grid items will magically space themselves out in a responsive way To reinforce some concepts from earlier let s reduce the size of our grid and center it in its container Remember we have px of space available within the grid container so if we set the width height of each grid cell to pixels the total grid size will now be px After doing that we can use justify content and align content to center our grid in the grid container Here are the changes I m making to achieve this grid container REMOVE THIS grid template rows repeat fr grid template columns repeat fr ADD THIS grid template rows repeat px grid template columns repeat px justify content center align content center CSS Grid Automatic FlowDo you remember from the Flexbox tutorial where we talked about the flex direction property If you set the value to row your flex items would be horizontally aligned If set to column they would be vertically aligned With CSS Grid we don t have the concept of a main axis and cross axis but we do have the ability to change the natural flow of grid elements Let s say you have a basic grid with the following HTML and CSS lt div class grid container gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div gt grid container display grid grid template rows repeat fr grid template columns repeat fr Since we haven t explicitly defined where each grid item goes on the grid yet where would you expect them to be By default they are aligned horizontally on the grid and overflow to the next row if there are too many items In this case we have columns defined in our grid and items so the first three will line up horizontally and the final item will break to the next row If we wanted we could explicitly place each grid item to stack on top of each other vertically but that s a lot of work If you wanted to change the flow of these grid items all you need is the grid auto flow property which acts similarly to the Flexbox flex direction property Most commonly you will be using either row the default value or column Let s change it to column and see what happens grid container grid auto flow column Just like that our grid looks completely different You can also set this to dense which will look for empty spaces in your grid and place smaller grid items in them even if they are not in the right order I won t be covering this here but feel free to experiment with it as it could be good use case for picture grids Explicit vs Implicit GridLet s say we have this grid lt div class grid container gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div class grid item gi gt lt div gt lt div gt grid container display grid grid template rows fr grid template columns repeat fr We have not explicitly placed or sized the grid items which means they will do two things by default Flow in the row direction thanks to the default value of the grid auto flow property set to row Each item will stretch to fill its grid area thanks to the default value of justify items which is stretch Since we defined columns and row the first grid items will occupy the first row and the th grid item will Occupy the nd row But wait we didn t define a second row The fourth grid item is part of what we call the Implicit Grid Let s back up Our Explicit Grid is a x row x col grid defined by these properties grid container display grid grid template rows fr Defines row that fills the entire grid space grid template columns repeat fr Defines columns of equal space Naturally these allows items to fit nicely in the grid If we have or more items they will start occupying the Implicit Grid By default extra items will flow according to the grid auto flow property and will take up space equal to the size of their content We can change this behavior with the grid auto rows and grid auto columns properties Instead of sizing the Implicit Grid according to content size let s give it some dimensions grid container display grid Explicit Grid grid template rows fr grid template columns repeat fr Implicit Grid Behavior grid auto flow row This is the default but setting it anyways for demonstration grid auto rows px grid auto columns px This means that any grid item placed on the Implicit Grid will have a height of px row height and width of px column width Let s go ahead and place our th grid item on this Implicit Grid gi grid row start grid row end grid column start grid column end Remember our explicit grid looks like this In the CSS above we are saying place grid item between RL and RL and between CL and CL But wait those don t exist Sure they don t exist but we can still place grid items on them The explicit grid will shrink and our grid item will be placed and sized on the Implicit Grid according to the grid auto rows and grid auto columns properties which are px and px respectively in this situation Therefore our th grid item will be px tall and px wide See below Below I have highlighted these concepts in more detail After seeing this you may have the question Why would we ever need this If you are ever building a grid where you don t know how many items you will have it is a good practice to set the grid auto rows and grid auto columns properties If you want some flexibility you can add something like this grid container grid auto rows minmax px auto grid auto columns minmax px auto By doing this you are declaring that all grid items that fill the Implicit Grid will have a minimum width and height of px and px respectively If those grid items have content larger then these dimensions then their width and height will be set to auto A Different Way to Use CSS GridWe are almost to the finish line The only property that we have not yet covered is the grid template areas property I saved this for last because it is not necessary to use but provides an easy way to define grid areas Up to this point we placed grid items using the following method We first define the grid grid container width px height px border px solid display grid grid template rows repeat fr grid template columns repeat fr Then we explicitly place each grid item using the grid lines gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end gi grid row start grid row end grid column start grid column end With the grid template areas we can achieve the same result in a different way grid container grid template areas item item item item item item gi grid area item gi grid area item gi grid area item The syntax here looks odd but it is a much more visual way to use CSS Grid In the grid container styles notice how we have quotation groups separated by spaces Since we have defined a x grid the quotation groups represent the rows while the individual items represent the columns Furthermore the represents empty space In each grid item style we are defined that item s alias which as you can see is used above in the grid template areas Let me format this so it is clearer what is happening item item item item item item Notice how item fills the entire rd column Take a look at the Codepen above You can quickly see what s going on here and for some this is a more intuitive way to create grids Naming your Grid LinesIn the above section we talked about a more intuitive way to create a CSS Grid This section will offer another alternative You ve seen this already For educational purposes I have been labeling the grid lines as CL n and RL n to indicate Column Line and Row Line but when we translate this into CSS it looks like this gi grid row start grid row end grid column start grid column end If we needed a way to remember the line names we could assign them on the grid container grid container display grid grid template rows RL fr RL fr RL fr RL grid template columns CL fr CL fr CL fr CL And then use them on the grid items gi grid row start RL grid row end RL grid column start CL grid column end CL Here s a demo CSS Grid and Flexbox Work TogetherI said at the beginning of this tutorial that we would go through an example so you can see how Flexbox and CSS Grid play nicely together As a refresher here are a few rules of thumb to go by when deciding between Flexbox and Grid Use Grid when You need full control of rows AND columns examples full page layouts gallery items You want to explicitly define the layout regardless of content size i e if you are using Flexbox and it starts to get really complicated with a bunch of heights and widths you probably should be using Grid Use Flexbox when Your content is a row OR column examples horizontal navbar vertical sidebar You want the size of items to determine layoutBelow I have created two examples that use CSS Grid and Flexbox interchangeably I suggest spending minutes reading through the CSS of each Picture GalleryA simple picture gallery with a sticky navbar and footer This layout would require a few hacky CSS tricks to achieve before but with Grid and Flexbox it is relatively straightforward In particular there are a few critical pieces to this that you should focus on while reading through the code Notice how I have placed a grid inside a grid This is perfectly okay Notice that the main grid container has a vh height and has set the main content the pictures to a unit of fr This means that the navbar and footer will get their explicitly defined heights of px and px and the picture grid will take up the remaining space in the viewport visible screen Notice that I set the pictures grid to have an overflow scroll setting This ensures that adding pictures to the grid will not cause our navbar or footer to disappear on scroll The Holy Grail LayoutThis is the final project for our CSS Grid tutorial You will have to build this or something very similar many times in your web dev career so I wanted to give you a template to start with If you would like to build this with me I created a YouTube video showing you how Here s the final product Before you leaveThanks for reading If you liked this and want to support me you can do two things that I would really appreciate Follow me on Twitter zg devSubscribe to my email list below |
2021-05-24 10:14:34 |
海外TECH |
DEV Community |
NUnit vs. XUnit vs. MSTest: Comparing Unit Testing Frameworks In C# |
https://dev.to/himanshusheth004/nunit-vs-xunit-vs-mstest-comparing-unit-testing-frameworks-in-c-24ha
|
NUnit vs XUnit vs MSTest Comparing Unit Testing Frameworks In C One of the most challenging things to do is making the right choice Arriving at a decision becomes even more complicated when there are multiple options in front of you The same is the case with choosing a testing framework for NET Core The three major C Unit testing frameworks are MSTest NUnit and xUnit Net You should select the most appropriate test framework that suits your project requirements In this blog we will see a detailed comparison between NUnit vs XUnit vs MSTest We have earlier covered all the three frameworks independently and recommend you to refer to those articles for detailed information on these test frameworks In this article we will briefly go through the features and compare the frameworks NUnit vs XUnit vs MSTest so that you can arrive at a decision to select the best suited framework All three frameworks use annotations attributes to inform the underlying framework about how the source code should be interpreted Attributes are meta tags that give more information about the test methods and classes defined in the source code We would be demonstrating NUnit vs XUnit vs MSTest comparison using cross browser testing using the Selenium framework When choosing a test framework you should check the in house expertise and check whether the framework is well suited for the type of project your team is working on NUnitNUnit is an open source testing framework ported from JUnit The latest version of NUnit is NUnit that is rewritten with many new features and has support for a wide range of NET platforms NUnit has been downloaded more than million times from NuGet org This shows the popularity of NUnit within the NET user community As of writing this article there were close to questions tagged as NUnit on Stackoverflow It is a popular test framework used for Selenium automation testing If you are planning to perform Test Driven Development TDD with C you should have a close look at the NUnit framework Automation testing in NUnit can be performed using the Visual Studio GUI and the NUnit console NUnit ConsoleRunner NUnit framework uses an attribute annotation style system like other test frameworks shown below are the most popular NUnit attributes used for Selenium automation testing The attributes Test and TestCase are not extensible as those attributes are sealed Using NUnit framework tests can be executed serially as well as parallel Parallel test execution is possible at assembly class or method level When parallelism is enabled by default four tests can be executed in parallel As Parallel test execution is supported in NUnit it becomes a compelling option for Selenium automation testing and cross browser testing XUnitxUnit Net is an open source testing framework based on the NET framework x stands for the programming language e g JUnit NUnit etc The creators of NUnit created xUnit as they wanted to build a better framework rather than adding incremental features to the NUnit framework xUnit is created with more focus on the community hence it is easy to expand upon You can download xUnit from NuGet gallery So far there are close to questions tagged as xUnit on Stackoverflow Below are some of the core reasons why the creators of NUnit decided to reconsider the framework and built xUnit Net As of writing this article the latest version of xUnit was The framework follows a unique style of testing and tags like Test amp TestFixture a part of the NUnit framework are no longer used in the xUnit framework The popular attributes SetUp and TearDown are also not a part of the xUnit framework As per the creators of NUnit and xUnit usage of SetUp and TearDown led to code duplication and they wanted to implement the same features in a much more optimized manner in xUnit For initialization constructor of the test class is used whereas for de initialization IDisposable interface is used This also encourages writing much cleaner tests This makes this C unit testing framework a much better option when it comes to Selenium automation testing as it is more robust and extensible As far as NUnit vs XUnit vs MSTest is concerned the biggest difference between xUnit and the other two test frameworks NUnit and MSTest is that xUnit is much more extensible when compared to NUnit and MSTest The Fact attribute is used instead of the Test attribute Non parameterized tests are implemented under the Fact attribute whereas the Theory attribute is used if you plan to use parameterized tests In NUnit and MSTest the class that contains the tests is under the TestClass attribute This was not a very robust approach hence TestClass attribute was also removed in xUnit Instead intelligence is built in the xUnit framework so that it can locate the test methods irrespective of the location of the tests Shown below are the most popular attributes annotations used in the xUnit framework MSTestMSTest is the default test framework that is shipped along with Visual Studio The initial version of MSTest V was not open source however MSTest V is open source The project is hosted on GitHub Like other test frameworks it can also be used for data driven testing You can download MSTest V from Nuget org As of writing this article there are close to questions with the tag MSTest on Stackoverflow Below are the most commonly used MSTest attributes MSTest V has cross platform support and can be extended using custom test attributes amp custom asserts Parallel test execution is supported by the MSTest framework where parallelism is possible at the Method level or Class level The test framework has evolved from being an “in box testing framework to a framework that is gaining wide adoption from the developer community NUnit vs XUnit vs MSTestWe now compare the C unit testing frameworks from an attribute usage point of view along with a simple example which demonstrates the code flow Attributes in test frameworksIrrespective of the C unit testing framework attributes are used to describe class methods properties etc Attributes are meta tags that provide additional information about the implementation under that particular tag To make the NUnit vs XUnit vs MSTest comparison clearer we cover the important attributes in each of these frameworks The NUnit vs XUnit vs MSTest attributes comparison will also help in porting the test implementation from one test framework to another To demonstrate the usage of attributes and the sequence in which the test code is executed we take the example of simple test implementation NUnit Test FrameworkIn the example shown above the implementation under SetUp and TearDown attributes will be called for each test case using NUnit Framework using System using System Collections Generic using System Linq using System Text using System Threading namespace NUnit Test class NUnit Demo SetUp public void Initialize Console WriteLine Inside SetUp TearDown public void DeInitialize Console WriteLine Inside TearDown public class TestClass OneTimeSetUp public static void ClassInitialize Console WriteLine Inside OneTimeSetUp OneTimeTearDown public static void ClassCleanup Console WriteLine Inside OneTimeTearDown Test Order public void Test Console WriteLine Inside TestMethod Test Test Order public void Test Console WriteLine Inside TestMethod Test Shown below is the execution log Inside SetUpInside TestMethod Test Inside TearDownInside SetUpInside TestMethod Test Inside TearDown xUnit Test FrameworkAs seen in the example shown below the SetUp and TearDown attributes from the NUnit framework are not present Instead a constructor is used for initialization and a Dispose method is used for de initialization xUnit creates a new instance of the test class for every test In some time critical test scenarios execution of creation amp cleanup code may take time and make the tests slower Class fixtures can be used in such situations where a fixture instance is created before any of the tests are executed and once the tests have completed execution cleanup of the fixture object by calling Dispose if it is present In the example we make use of Class Fixtures which means that even though there are two test classes initialization and cleanup code will be called only once using System using Xunit namespace xUnit Test public class xUnit Tests IDisposable public xUnit Tests Console WriteLine Inside SetUp Constructor public void Dispose Console WriteLine Inside CleanUp or Dispose method public class UnitTest IClassFixture lt xUnit Tests gt Fact public void Test Console WriteLine Inside Test public class UnitTest IClassFixture lt xUnit Tests gt Fact public void Test Console WriteLine Inside Test Shown below is the output log Inside SetUp ConstructorInside Test Inside Test Inside CleanUp or Dispose method MSTest Test FrameworkThe test code only contains Console WriteLine which is put to trace the execution flow Most of the widely used MSTest attributes are used in the demonstrated test code using Microsoft VisualStudio TestTools UnitTesting using System using System Collections Generic using System Linq using System Text using System Threading namespace MsTest TestClass public class Initialize AssemblyInitialize public static void AssemblyInitialize TestContext context Console WriteLine Inside AssemblyInitialize public class DeInitialize AssemblyCleanup public static void AssemblyCleanup Console WriteLine Inside AssemblyCleanup TestClass public class TestClass ClassInitialize public static void ClassInitialize TestContext context Console WriteLine Inside ClassInitialize ClassCleanup public static void ClassCleanup Console WriteLine Inside ClassCleanup TestMethod public void Test Console WriteLine Inside TestMethod Test TestClass public class TestClass TestInitialize public void TestInitialize Console WriteLine Inside TestInitialize TestMethod public void Test Console WriteLine Inside TestMethod Test TestCleanup public void TestCleanup Console WriteLine Inside TestCleanup Shown below is the execution log Inside ClassInitializeInside TestMethod Test Inside AssemblyInitializeInside TestInitializeInside TestMethod Test Inside TestCleanupThe implementation under ClassInitialize amp ClassCleanup attributes are called respectively once before the methods are executed and once after the execution of the test methods The implementation under TestInitialize and TestCleanup attributes are respectively called once before amp after executing tests in each class Core Differences between NUnit XUnit and MSTestxUnit framework is different from NUnit and MSTest frameworks on multiple fronts Let s look at the core differences Isolation of TestsxUnit framework provides much better isolation of tests in comparison to NUnit and MSTest frameworks For each test case the test class is instantiated executed and is discarded after the execution This ensures that the tests can be executed in any order as there is reduced no dependency between the tests Executing each test as a separate instance minimizes the chances of one test causing the other tests to fail There is also an option to share setup cleanup code that can be shared between different tests without the need to share object instances One way of doing this is via Class Fixtures which we demonstrated earlier xUnit has excellent documentation on how to share contexts between tests ExtensibilityWhen we do NUnit vs XUnit vs MSTest extensibility plays an important role in choosing a particular test framework The choice might depend on the needs of the project but in some scenarios extensibility can turn the tables around for a particular test framework When compared to MSTest and NUnit frameworks xUnit framework is more extensible since it makes use of Fact and Theory attributes Many attributes that were present in NUnit framework e g TestFixture TestFixtureSetup TestFixtureTearDown ClassCleanup ClassInitialize TestCleanup etc are not included in the xUnit framework Introduction of the Theory attribute for parameterized tests is one of the prime examples of the extensibility of the framework This also makes the implementation of custom functionality much easier in the xUnit framework Initialization and De initializationThe NUnit uses SetUp TearDown pairs whereas MSTest uses TestInitialize TestCleanup pairs for setting up the activities related to initialization amp de initialization of the test code On the other hand xUnit uses the class constructor for the implementation of steps related to test initialization and IDisposable interface for the implementation of steps related to de initialization xUnit starts a new instance per test whereas in NUnit amp MSTest frameworks all the tests execute in the same Fixture Class Assertion mechanismxUnit framework makes use of Assert Throws instead of ExpectedException which is used in NUnit and MSTest The drawback of using ExpectedException is that the errors might not be reported if they occur in the wrong part of the code For example if assert has to be raised for Security Exception but Authentication Exception occurs ExpectedCondition will not raise assert On the other hand Assert Throws raises assert even if the exception is generic This ensures that assert is raised even after the exception is raised Parallel test executionAll the three C unit testing frameworks support parallel test execution and are well suited for Selenium automation testing as throughput plays a major role in automation testing Below are the ways in which parallelism can be achieved in each of the test frameworks NUnit Parallelism is possible at the level of Children child tests are executed in parallel with other tests Fixtures descendants of test till the level of Test Fixtures can execute in parallel Self test itself can be executed in parallel with other tests and All test amp its descendants can execute in parallel with others at the same level Parallelizable ParallelScope Children Parallelizable ParallelScope Fixtures Parallelizable ParallelScope Self Parallelizable ParallelScope All xUnit Parallelism by putting the test classes into a single test collection or by executing an n number of threads in parallel assembly CollectionBehavior CollectionBehavior CollectionPerAssembly assembly CollectionBehavior MaxParallelThreads n MSTest Parallelism at Method level as well as Class level assembly Parallelize Workers Scope ExecutionScope MethodLevel assembly Parallelize Workers Scope ExecutionScope ClassLevel Note Workers indicate the number of threads that can be executed in parallel NUnit vs XUnit vs MSTest Demonstration using Remote Selenium GridFor the initial rounds of cross browser testing can be performed on the local Selenium as it aids in verifying the functionalities of the test code on certain combinations of browsers amp operating systems Selenium automation testing can be performed using either of the three C unit testing frameworks Automation testing using the local Selenium Grid is a good start to cross browser testing activity but local testing may not be sufficient to attain good test coverage Having in house infrastructure with machines having different web browsers and operating systems installed is not a scalable amp economic idea When cross browser testing is performed using local Selenium WebDriver the activity can hit a roadblock as you cannot perform Selenium automation testing using innumerable combinations of web browsers operating systems and devices Instead of the local Selenium Grid the capabilities of the remote Selenium Grid on the cloud can be leveraged so that testing is more fool proof LambdaTest is a cross browser testing platform on the cloud where you can verify the test code on combinations of browsers devices and operating systems The effort to port the code from the local Selenium Grid to LambdaTest s remote Selenium Grid is not much as major changes are infrastructure related After creating an account on LambdaTest make a note of the user name and access key from the Profile Section The Dashboard consists of all the relevant information about the tests status logs video recordings of the tests etc LambdaTest capabilities generator is used to generate the desired browser capabilities against which the cross browser tests will be performed Shown below are the capabilities for Safari on the macOS Mojave platform DesiredCapabilities capabilities new DesiredCapabilities capabilities SetCapability user Your Lambda Username capabilities SetCapability accessKey Your Lambda Access Key capabilities SetCapability build your build name capabilities SetCapability name your test name capabilities SetCapability platform MacOS Mojave capabilities SetCapability browserName Safari capabilities SetCapability version Implementation using NUnit C unit testing framework To demonstrate the usage of Remote Selenium WebDriver on LambdaTest Grid we implement the below test case Below are the browser and operating system combinations on which the test has to be performed BrowserBrowser versionPlatform Operating SystemChromeWindows Internet ExplorerWindows SafarimacOS High SierraMicrosoft EdgeWindows The browser capabilities are generated using the LambdaTest capabilities generator The combination of user name amp access key is used to access LambdaTest s remote Selenium Grid using System using OpenQA Selenium using OpenQA Selenium Remote using NUnit Framework using System Threading using System Collections Generic namespace ParallelLTSelenium TestFixture chrome Windows TestFixture internet explorer Windows TestFixture Safari macOS High Sierra TestFixture MicrosoftEdge Windows Parallelizable ParallelScope All public class ParallelLTTests ThreadLocal lt IWebDriver gt driver new ThreadLocal lt IWebDriver gt private String browser private String version private String os public ParallelLTTests String browser String version String os this browser browser this version version this os os SetUp public void Init String username user name String accesskey access key String gridURL hub lambdatest com wd hub DesiredCapabilities capabilities new DesiredCapabilities capabilities SetCapability user username capabilities SetCapability accessKey accesskey capabilities SetCapability browserName browser capabilities SetCapability version version capabilities SetCapability platform os driver Value new RemoteWebDriver new Uri https username accesskey gridURL capabilities TimeSpan FromSeconds System Threading Thread Sleep Test public void LT ToDo Test String test url driver Value Url test url String itemName Adding item to the list System Threading Thread Sleep Click on First Check box IWebElement firstCheckBox driver Value FindElement By Name li firstCheckBox Click Click on Second Check box IWebElement secondCheckBox driver Value FindElement By Name li secondCheckBox Click Enter Item name IWebElement textfield driver Value FindElement By Id sampletodotext textfield SendKeys itemName Click on Add button IWebElement addButton driver Value FindElement By Id addbutton addButton Click Verified Added Item name IWebElement itemtext driver Value FindElement By XPath html body div div div ul li span String getText itemtext Text Check if the newly added item is present or not using Condition constraint Boolean Assert That itemName Contains getText Is True Perform wait to check the output System Threading Thread Sleep TearDown public void Cleanup bool passed TestContext CurrentContext Result Outcome Status NUnit Framework Interfaces TestStatus Passed try Logs the result to Lambdatest IJavaScriptExecutor driver Value ExecuteScript lambda status passed passed failed finally Terminates the remote webdriver session driver Value Quit Parallel test execution is enabled using the Parallelizable attribute and test combinations are passed via TestFixtures The actual logic of the test code is under the Test attribute Shown below is the snapshot from the Automation Tab on LambdaTest and Visual Studio Implementation using xUnit C unit testing framework For demonstrating parallel test execution using xUnit framework on remote Selenium Grid we test the following scenarios Test Case LamdaTest ToDo AppNavigate to the to do app using the Firefox WebDriver Mark the first two items as Done i e Check those two items Add a new item Adding an item to the list Click the Add button to add that new item to the list Browsers on which cross browser testing is performed are Test Case BrowserBrowser versionPlatform Operating SystemChromeWindows Microsoft EdgeWindows FirefoxmacOS High SierraSafarimacOS MojaveTest Case amp Google Search for LambdaTestNavigate to Google com Search for LambdaTest Quit the browser window Both the test cases are the same but the execution will be performed on different web browsers Test Case BrowserBrowser versionPlatform Operating SystemChromeWindows Microsoft EdgeWindows FirefoxmacOS High SierraTest Case BrowserBrowser versionPlatform Operating SystemMicrosoft EdgeWindows FirefoxmacOS High SierraSafarimacOS Mojaveusing Xunit using System using System Collections Generic using System Linq using System Text using OpenQA Selenium using OpenQA Selenium Chrome using OpenQA Selenium Firefox using System Threading Tasks using System Text RegularExpressions using OpenQA Selenium Support UI using OpenQA Selenium Interactions For using Remote Selenium WebDriver using OpenQA Selenium Remote assembly CollectionBehavior MaxParallelThreads namespace ParallelLTSelenium public class GlobalVar static int globalValue public static int GlobalValue get return globalValue set globalValue value public static String username user name public static String accesskey access key public static String gridURL hub lambdatest com wd hub public static DesiredCapabilities capabilities new DesiredCapabilities public static IWebDriver driver public class ParallelLTTests IDisposable public ParallelLTTests GlobalVar capabilities SetCapability user GlobalVar username GlobalVar capabilities SetCapability accessKey GlobalVar accesskey public void Dispose Closure handled in each test case public class UnitTest IClassFixture lt ParallelLTTests gt Theory InlineData chrome Windows InlineData MicrosoftEdge Windows InlineData Firefox Windows InlineData Safari macOS Mojave public void LT ToDo Test String browser String version String os String itemName Yey Let s add it to list IWebDriver driver GlobalVar capabilities SetCapability browserName browser GlobalVar capabilities SetCapability version version GlobalVar capabilities SetCapability platform os GlobalVar capabilities SetCapability build xUnit LT ToDoApp using Xunit in Parallel on LambdaTest GlobalVar capabilities SetCapability name xUnit LT ToDoApp using Xunit in Parallel on LambdaTest driver new RemoteWebDriver new Uri https GlobalVar username GlobalVar accesskey GlobalVar gridURL GlobalVar capabilities TimeSpan FromSeconds driver Url Assert Equal Sample page lambdatest com driver Title Click on First Check box IWebElement firstCheckBox driver FindElement By Name li firstCheckBox Click Click on Second Check box IWebElement secondCheckBox driver FindElement By Name li secondCheckBox Click Enter Item name IWebElement textfield driver FindElement By Id sampletodotext textfield SendKeys itemName Click on Add button IWebElement addButton driver FindElement By Id addbutton addButton Click Verified Added Item name IWebElement itemtext driver FindElement By XPath html body div div div ul li span String getText itemtext Text Assert True itemName Contains getText Perform wait to check the output System Threading Thread Sleep Console WriteLine LT ToDo Test Passed driver Close driver Quit public class UnitTest IClassFixture lt ParallelLTTests gt Theory InlineData chrome Windows InlineData MicrosoftEdge Windows InlineData Firefox Windows public void Google Test String browser String version String os IWebDriver driver GlobalVar capabilities SetCapability browserName browser GlobalVar capabilities SetCapability version version GlobalVar capabilities SetCapability platform os GlobalVar capabilities SetCapability build xUnit Google search using XUnit in Parallel on LambdaTest GlobalVar capabilities SetCapability name xUnit Google search using XUnit in Parallel on LambdaTest driver new RemoteWebDriver new Uri https GlobalVar username GlobalVar accesskey GlobalVar gridURL GlobalVar capabilities TimeSpan FromSeconds driver Url System Threading Thread Sleep IWebElement element driver FindElement By XPath id tsf div div div div div input element SendKeys LambdaTest Submit the Search element Submit Perform wait to check the output System Threading Thread Sleep Console WriteLine Google Test Passed driver Close driver Quit public class UnitTest IClassFixture lt ParallelLTTests gt Theory InlineData chrome Windows InlineData MicrosoftEdge Windows InlineData Firefox macOS High Sierra InlineData Safari macOS Mojave public void Google Test String browser String version String os IWebDriver driver GlobalVar capabilities SetCapability browserName browser GlobalVar capabilities SetCapability version version GlobalVar capabilities SetCapability platform os GlobalVar capabilities SetCapability build xUnit Google Search using XUnit in Parallel on LambdaTest GlobalVar capabilities SetCapability name xUnit Google Search using XUnit in Parallel on LambdaTest driver new RemoteWebDriver new Uri https GlobalVar username GlobalVar accesskey GlobalVar gridURL GlobalVar capabilities TimeSpan FromSeconds driver Url System Threading Thread Sleep IWebElement element driver FindElement By XPath id tsf div div div div div input element SendKeys LambdaTest Submit the Search element Submit Perform wait to check the output System Threading Thread Sleep Console WriteLine Google Test Passed driver Close driver Quit The setup initialization code is a part of the constructor whereas the implementation under IDisposable i e public void Dispose can be used to perform the de initialization For simplification de initialization is moved to the individual test cases Shown below is the output snapshot from LambdaTest and Visual Studio Implementation using MSTest C unit testing framework To demonstrate the usage of parallelism with the MSTest framework we implement the test cases used for the xUnit framework The browser and operating system combinations for testing are also the same using Microsoft VisualStudio TestTools UnitTesting using OpenQA Selenium For using Remote Selenium WebDriver using OpenQA Selenium Remote using System using System Threading assembly Parallelize Workers Scope ExecutionScope MethodLevel namespace ParallelLTSelenium TestClass public class ParallelLTTests IWebDriver driver String username user name String accesskey access key String gridURL hub lambdatest com wd hub DesiredCapabilities capabilities TestInitialize public void setupInit capabilities new DesiredCapabilities capabilities SetCapability user username capabilities SetCapability accessKey accesskey DataTestMethod DataRow chrome Windows DataRow MicrosoftEdge Windows DataRow Firefox macOS High Sierra DataRow Safari macOS Mojave TestMethod public void LT ToDo Test String browser String version String os String itemName Yey Let s add it to list capabilities SetCapability browserName browser capabilities SetCapability version version capabilities SetCapability platform os capabilities SetCapability build LT ToDoApp using MsTest in Parallel on LambdaTest capabilities SetCapability name LT ToDoApp using MsTest in Parallel on LambdaTest driver new RemoteWebDriver new Uri https username accesskey gridURL capabilities TimeSpan FromSeconds driver Url Assert AreEqual Sample page lambdatest com driver Title Click on First Check box IWebElement firstCheckBox driver FindElement By Name li firstCheckBox Click Click on Second Check box IWebElement secondCheckBox driver FindElement By Name li secondCheckBox Click Enter Item name IWebElement textfield driver FindElement By Id sampletodotext textfield SendKeys itemName Click on Add button IWebElement addButton driver FindElement By Id addbutton addButton Click Verified Added Item name IWebElement itemtext driver FindElement By XPath html body div div div ul li span String getText itemtext Text Assert IsTrue itemName Contains getText Perform wait to check the output System Threading Thread Sleep Console WriteLine LT ToDo Test Passed DataTestMethod DataRow chrome Windows DataRow MicrosoftEdge Windows DataRow Firefox macOS High Sierra TestMethod public void Google Test String browser String version String os capabilities SetCapability browserName browser capabilities SetCapability version version capabilities SetCapability platform os capabilities SetCapability build Google search using MsTest in Parallel on LambdaTest capabilities SetCapability name Google search using MsTest in Parallel on LambdaTest driver new RemoteWebDriver new Uri https username accesskey gridURL capabilities TimeSpan FromSeconds System Threading Thread Sleep driver Url IWebElement element driver FindElement By XPath id tsf div div div div div input element SendKeys LambdaTest Submit the Search element Submit Perform wait to check the output System Threading Thread Sleep Console WriteLine Google Test Passed DataTestMethod DataRow chrome Windows DataRow MicrosoftEdge Windows DataRow Firefox macOS High Sierra DataRow Safari macOS Mojave TestMethod public void Google Test String browser String version String os capabilities SetCapability browserName browser capabilities SetCapability version version capabilities SetCapability platform os capabilities SetCapability build Google Search using MsTest in Parallel on LambdaTest capabilities SetCapability name Google Search using MsTest in Parallel on LambdaTest driver new RemoteWebDriver new Uri https username accesskey gridURL capabilities TimeSpan FromSeconds System Threading Thread Sleep driver Url IWebElement element driver FindElement By XPath id tsf div div div div div input element SendKeys LambdaTest Submit the Search element Submit Perform wait to check the output System Threading Thread Sleep Console WriteLine Google Test Passed TestCleanup public void Cleanup if driver null driver Quit Each test case is under a separate TestMethod attribute Since we have implemented three tests LT ToDo Test Google Test and Google Test three concurrent sessions will be executed till the time the number of pending tests are less than three The DataRow attribute is used to create parameterized tests Shown below is the output snapshot from the Automation tab on LambdaTest and Visual Studio ConclusionEach of the NET frameworks that we have discussed so far has evolved over a period of time All these frameworks are well suited for cross browser testing as they have support for Selenium MSTest V is a giant leap in terms of usability when compared to MSTest V The xUnit framework is more sophisticated as it is more community focused and the creators had immense learning while building the NUnit framework To conclude the NUnit vs XUnit vs MSTest comparison is more about which C test framework is well suited to perform your job and the test expertise that your team possesses If I had an option to select a framework I would go with xUnit since it is more extensible and has fewer attributes making the code clean amp easy to maintain What is your favorite C test framework do leave your choice amp relevant explanation in the comments section |
2021-05-24 10:05:46 |
Apple |
AppleInsider - Frontpage News |
Apple refuses removal of Facebook App Pro-Palestinian 'review bomb' |
https://appleinsider.com/articles/21/05/24/apple-refuses-removal-of-facebook-app-pro-palestinian-review-bomb?utm_medium=rss
|
Apple refuses removal of Facebook App Pro Palestinian x review bomb x A coordinated effort giving Facebook one star reviews on the App Store and elsewhere is being treated as severe by the social media giant Facebook s average rating on the App Store is reportedly going downFacebook s app on both Apple s App Store and the Google Play Store have reportedly been targeted by activists protesting against the company s alleged censorship of Palestinian posts The campaign has been sparked by claims that existing censorship has increased during May s conflict between Israel and Hamas Read more |
2021-05-24 10:49:54 |
Apple |
AppleInsider - Frontpage News |
New Siri Remote touch behavior inconsistent, cause unknown |
https://appleinsider.com/articles/21/05/23/new-siri-remote-touch-behavior-inconsistent-cause-unknown?utm_medium=rss
|
New Siri Remote touch behavior inconsistent cause unknownThe new Siri Remote for the Apple TV K is causing problems for some users with the new circular gesture periodically not scrubbing through media as advertised The update to the Apple TV introduced a new design of Siri Remote that uses a circular trackpad as well as a new gesture that turns the trackpad into a large scroll wheel By using a circular motion around the edge of the trackpad users can scrub forward and back through content However posts to Twitter and Reddit show users trying out the gesture but getting unexpected results Even using the tap and hold method waiting for the proper user interface affirmation of the gesture one complete circuit of the trackpad scrubs through a video timeline in one direction then returns it back to where it was previously Read more |
2021-05-24 10:52:09 |
海外TECH |
Engadget |
Researchers boost robotic arm movement by adding a sense of touch |
https://www.engadget.com/robotic-arm-movement-sense-of-touch-105041922.html
|
feedback |
2021-05-24 10:50:41 |
海外TECH |
Engadget |
Ford's F-150 Lightning Pro comes with a $50,000 extended range option |
https://www.engadget.com/ford-f-150-lightning-pro-electric-pickup-100041871.html
|
Ford x s F Lightning Pro comes with a extended range optionFord has unveiled the F Lightning Pro a more utilitarian version of the F Lightning electric pickup aimed at commercial customers |
2021-05-24 10:00:41 |
ニュース |
BBC News - Home |
Western powers voice outrage as Belarus accused of hijacking plane |
https://www.bbc.co.uk/news/world-europe-57224452
|
dissident |
2021-05-24 10:48:12 |
ニュース |
BBC News - Home |
Sasha Johnson: Black Lives Matter activist critical after shooting, party says |
https://www.bbc.co.uk/news/uk-england-57223755
|
intensive |
2021-05-24 10:39:50 |
ニュース |
BBC News - Home |
Samoa's first female PM locked out of parliament by losing opponent |
https://www.bbc.co.uk/news/world-asia-57227240
|
locks |
2021-05-24 10:00:56 |
ニュース |
BBC News - Home |
Arundel Castle: Mary Queen of Scots beads stolen in raid |
https://www.bbc.co.uk/news/uk-57224777
|
artefacts |
2021-05-24 10:42:31 |
ニュース |
BBC News - Home |
Mottarone cable car crash: Italy investigates cause of accident |
https://www.bbc.co.uk/news/world-europe-57226273
|
maggiore |
2021-05-24 10:35:35 |
ニュース |
BBC News - Home |
£300m investment to fuel electric car take-up |
https://www.bbc.co.uk/news/business-57225856
|
ofgem |
2021-05-24 10:32:32 |
ニュース |
BBC News - Home |
Charlie Bit My Finger video to be taken off YouTube after selling for £500,000 |
https://www.bbc.co.uk/news/newsbeat-57227290
|
youtube |
2021-05-24 10:07:05 |
ニュース |
BBC News - Home |
What are the rules for travelling to green, amber and red list countries? |
https://www.bbc.co.uk/news/explainers-52544307
|
rules |
2021-05-24 10:38:43 |
ニュース |
BBC News - Home |
Lockdown rules: What are the restrictions in your area? |
https://www.bbc.co.uk/news/uk-54373904
|
coronavirus |
2021-05-24 10:56:36 |
ニュース |
BBC News - Home |
Covid: When will I get the vaccine? |
https://www.bbc.co.uk/news/health-55045639
|
covid |
2021-05-24 10:15:02 |
ビジネス |
不景気.com |
新潟・三条の飲食店経営「ウエイブ」に破産開始決定 - 不景気.com |
https://www.fukeiki.com/2021/05/wave-niigata.html
|
新潟県三条市 |
2021-05-24 10:05:29 |
LifeHuck |
ライフハッカー[日本版] |
【Amazonタイムセール祭り】緊急時に備えておきたい非常食・防災グッズまとめ |
https://www.lifehacker.jp/2021/05/235320amazon-timesale.html
|
防災グッズ |
2021-05-24 20:00:00 |
LifeHuck |
ライフハッカー[日本版] |
【Amazonタイムセール祭り】始めるなら今!USB MIDIキーボードが4,189円、ウクレレが2,439円とお買い得 |
https://www.lifehacker.jp/2021/05/amazon-timesale-fes-2021-0524-3.html
|
amazon |
2021-05-24 19:45:00 |
北海道 |
北海道新聞 |
HTB減収増益 3月期 |
https://www.hokkaido-np.co.jp/article/547431/
|
北海道テレビ放送 |
2021-05-24 19:14:00 |
IT |
週刊アスキー |
『レインボーシックス シージ』YEAR6の第2シーズン「North Star」の詳細を発表 |
https://weekly.ascii.jp/elem/000/004/056/4056153/
|
northstar |
2021-05-24 19:50:00 |
IT |
週刊アスキー |
『ラクガキ キングダム』で5月27日より「レオレオのオレオレ!ミュージカルナイト」を開催!! |
https://weekly.ascii.jp/elem/000/004/056/4056155/
|
期間限定 |
2021-05-24 19:45:00 |
IT |
週刊アスキー |
旭化成、資源循環社会の実現のため「BLUE Plastics」プロジェクトを発足。2022年3月末までに実証実験を開始 |
https://weekly.ascii.jp/elem/000/004/056/4056140/
|
plastics |
2021-05-24 19:30:00 |
IT |
週刊アスキー |
エプソン、学校向けサービス「アカデミックプラン」を岡山県の県公立・特別支援学校に導入 |
https://weekly.ascii.jp/elem/000/004/056/4056147/
|
学校向けサービス |
2021-05-24 19:30:00 |
IT |
週刊アスキー |
LG、ハイエンドモデルの「LG UltraGearシリーズ」から31.5型ゲーミングモニターを発売 |
https://weekly.ascii.jp/elem/000/004/056/4056152/
|
lgultragear |
2021-05-24 19:30:00 |
コメント
コメントを投稿