Should I bother to write unit test for UI/UX Components?

So I am building an application with Angular and have started to get into UI testing with DalekJS (http://dalekjs.com). As I have been writing these tests I have been thinking to myself, should I even bother with writing unit test that that are UI/UX components.

Now my angular services generally don’t have anything to do with the DOM or directly rendering stuff on the page so those I unit test and it make sense however angular directives are components that render things directly to the page and writing unit tests seems like 1. It is not an effective way to test UI/UX components and 2. It would overlap with UI/UX Tests.

For point #1, unit test (at least ones I have seen) don’t actually write anything to a browser and render it. For thing that require DOM, you generally mock the DOM in a variable and use that to test whatever you need to test. If you have an error with a test, you can’t load it up in a browser and play around with it like you could with UI/UX tests (which in my experience runs against code that is the true application that renders and everything).

For point #2, one of my directives has a property called contentVisible. Now I can write a unit test that make sure that property is the correct value at certain points but that really don’t not test what I truly want to test because even if contentVisible is set to false, the content still might be rendering to the screen which UI/UX test would pick up.

Is it still worth the effort to write unit test for UI/UX Components where UI tests would be able to pick up everything the unit test would plus also do a better job since it can test what is actually rendered?

Exception
The one exception case where I would need a unit test is for certain ajax requests. For example, making sure an ajax request is not made of that an ajax request that does not make and changes to the UI are things that can only be tested with unit tests.

2

My fuzzy answer is that sometimes having UI unit tests is a good idea, for some parts of the UI. In my experience:

  1. Often the people responsible for functional and integration testing are different people than those responsible for unit testing (typically, QA vs. Dev). As such, each may spot different areas (and have different blind spots) as to what ought to be covered by tests.

  2. Related to this, programmers should be responsible for testing their own code, and not defer some aspects simply because someone else is theoretically testing that code.

  3. Unit tests are more targeted than full functional tests. While the latter might tell you that an expected button is not clickable, it won’t instantly tell you that this is because it’s enabled property is false vs. it’s z-index is wrong vs. its layout coordinates are outside the viewport, etc. Likewise, as you point out, the unit test can tell you that the visible property is set correctly, but does not necessarily tell you if the object is actually visible (though such tests are possible). In other words, even with trivial examples you can see that the two types of tests are not interchangeable.

  4. Belt and suspenders approaches are often fine [for software engineers].

  5. Trying to test any aspect of code — GUI, time-based, async — will tend to improve one’s thinking about that code and its design. The trade-off is that too many tests or testing the wrong level of abstraction can slow refactoring. But imho it’s high-value to try to test any part and learn from experience what types of tests add the most value.

I’ve worked on a couple of large projects where having the programmers unit test a lot of parts of the UI saved a LOT of time and made the QA folks happier (and able to focus more on things programmers could not have spotted as easily). I should add, I do not like testing UI code because it’s time-consuming and hard. In general writing tests is time-consuming but pays for itself rapidly, and good UI unit tests that add specificity to what functional tools can test are no exception.

0

It would be completely useless to write unit tests for UI/UX components. For UI/UX components you should be writing UI tests using some browser recording tool like Selenium or something. If you are making AJAX calls to the back-end those methods that are called should have unit tests. Always test you app from the user perspective then work backwards.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Should I bother to write unit test for UI/UX Components?

So I am building an application with Angular and have started to get into UI testing with DalekJS (http://dalekjs.com). As I have been writing these tests I have been thinking to myself, should I even bother with writing unit test that that are UI/UX components.

Now my angular services generally don’t have anything to do with the DOM or directly rendering stuff on the page so those I unit test and it make sense however angular directives are components that render things directly to the page and writing unit tests seems like 1. It is not an effective way to test UI/UX components and 2. It would overlap with UI/UX Tests.

For point #1, unit test (at least ones I have seen) don’t actually write anything to a browser and render it. For thing that require DOM, you generally mock the DOM in a variable and use that to test whatever you need to test. If you have an error with a test, you can’t load it up in a browser and play around with it like you could with UI/UX tests (which in my experience runs against code that is the true application that renders and everything).

For point #2, one of my directives has a property called contentVisible. Now I can write a unit test that make sure that property is the correct value at certain points but that really don’t not test what I truly want to test because even if contentVisible is set to false, the content still might be rendering to the screen which UI/UX test would pick up.

Is it still worth the effort to write unit test for UI/UX Components where UI tests would be able to pick up everything the unit test would plus also do a better job since it can test what is actually rendered?

Exception
The one exception case where I would need a unit test is for certain ajax requests. For example, making sure an ajax request is not made of that an ajax request that does not make and changes to the UI are things that can only be tested with unit tests.

2

My fuzzy answer is that sometimes having UI unit tests is a good idea, for some parts of the UI. In my experience:

  1. Often the people responsible for functional and integration testing are different people than those responsible for unit testing (typically, QA vs. Dev). As such, each may spot different areas (and have different blind spots) as to what ought to be covered by tests.

  2. Related to this, programmers should be responsible for testing their own code, and not defer some aspects simply because someone else is theoretically testing that code.

  3. Unit tests are more targeted than full functional tests. While the latter might tell you that an expected button is not clickable, it won’t instantly tell you that this is because it’s enabled property is false vs. it’s z-index is wrong vs. its layout coordinates are outside the viewport, etc. Likewise, as you point out, the unit test can tell you that the visible property is set correctly, but does not necessarily tell you if the object is actually visible (though such tests are possible). In other words, even with trivial examples you can see that the two types of tests are not interchangeable.

  4. Belt and suspenders approaches are often fine [for software engineers].

  5. Trying to test any aspect of code — GUI, time-based, async — will tend to improve one’s thinking about that code and its design. The trade-off is that too many tests or testing the wrong level of abstraction can slow refactoring. But imho it’s high-value to try to test any part and learn from experience what types of tests add the most value.

I’ve worked on a couple of large projects where having the programmers unit test a lot of parts of the UI saved a LOT of time and made the QA folks happier (and able to focus more on things programmers could not have spotted as easily). I should add, I do not like testing UI code because it’s time-consuming and hard. In general writing tests is time-consuming but pays for itself rapidly, and good UI unit tests that add specificity to what functional tools can test are no exception.

0

It would be completely useless to write unit tests for UI/UX components. For UI/UX components you should be writing UI tests using some browser recording tool like Selenium or something. If you are making AJAX calls to the back-end those methods that are called should have unit tests. Always test you app from the user perspective then work backwards.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Should I bother to write unit test for UI/UX Components?

So I am building an application with Angular and have started to get into UI testing with DalekJS (http://dalekjs.com). As I have been writing these tests I have been thinking to myself, should I even bother with writing unit test that that are UI/UX components.

Now my angular services generally don’t have anything to do with the DOM or directly rendering stuff on the page so those I unit test and it make sense however angular directives are components that render things directly to the page and writing unit tests seems like 1. It is not an effective way to test UI/UX components and 2. It would overlap with UI/UX Tests.

For point #1, unit test (at least ones I have seen) don’t actually write anything to a browser and render it. For thing that require DOM, you generally mock the DOM in a variable and use that to test whatever you need to test. If you have an error with a test, you can’t load it up in a browser and play around with it like you could with UI/UX tests (which in my experience runs against code that is the true application that renders and everything).

For point #2, one of my directives has a property called contentVisible. Now I can write a unit test that make sure that property is the correct value at certain points but that really don’t not test what I truly want to test because even if contentVisible is set to false, the content still might be rendering to the screen which UI/UX test would pick up.

Is it still worth the effort to write unit test for UI/UX Components where UI tests would be able to pick up everything the unit test would plus also do a better job since it can test what is actually rendered?

Exception
The one exception case where I would need a unit test is for certain ajax requests. For example, making sure an ajax request is not made of that an ajax request that does not make and changes to the UI are things that can only be tested with unit tests.

2

My fuzzy answer is that sometimes having UI unit tests is a good idea, for some parts of the UI. In my experience:

  1. Often the people responsible for functional and integration testing are different people than those responsible for unit testing (typically, QA vs. Dev). As such, each may spot different areas (and have different blind spots) as to what ought to be covered by tests.

  2. Related to this, programmers should be responsible for testing their own code, and not defer some aspects simply because someone else is theoretically testing that code.

  3. Unit tests are more targeted than full functional tests. While the latter might tell you that an expected button is not clickable, it won’t instantly tell you that this is because it’s enabled property is false vs. it’s z-index is wrong vs. its layout coordinates are outside the viewport, etc. Likewise, as you point out, the unit test can tell you that the visible property is set correctly, but does not necessarily tell you if the object is actually visible (though such tests are possible). In other words, even with trivial examples you can see that the two types of tests are not interchangeable.

  4. Belt and suspenders approaches are often fine [for software engineers].

  5. Trying to test any aspect of code — GUI, time-based, async — will tend to improve one’s thinking about that code and its design. The trade-off is that too many tests or testing the wrong level of abstraction can slow refactoring. But imho it’s high-value to try to test any part and learn from experience what types of tests add the most value.

I’ve worked on a couple of large projects where having the programmers unit test a lot of parts of the UI saved a LOT of time and made the QA folks happier (and able to focus more on things programmers could not have spotted as easily). I should add, I do not like testing UI code because it’s time-consuming and hard. In general writing tests is time-consuming but pays for itself rapidly, and good UI unit tests that add specificity to what functional tools can test are no exception.

0

It would be completely useless to write unit tests for UI/UX components. For UI/UX components you should be writing UI tests using some browser recording tool like Selenium or something. If you are making AJAX calls to the back-end those methods that are called should have unit tests. Always test you app from the user perspective then work backwards.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật