投稿時間:2023-06-02 22:26:56 RSSフィード2023-06-02 22:00 分まとめ(31件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… Satechi、「Amazonタイムセール祭り」でUSB-Cハブなど5製品を25%オフで販売するセールを開催中 https://taisy0.com/2023/06/02/172447.html amazon 2023-06-02 12:44:02
AWS AWS Management Tools Blog Managing CloudWatch Synthetics canaries at scale https://aws.amazon.com/blogs/mt/managing-cloudwatch-synthetics-canaries-at-scale/ Managing CloudWatch Synthetics canaries at scaleAmazon CloudWatch Synthetics offers an automated approach to monitoring the performance and availability of your application endpoints REST APIs and website content allowing you to discover issues before your customers do As your applications and suite of accompanying canaries grows over time it becomes more challenging and time consuming to manage them at scale This … 2023-06-02 12:37:39
AWS AWS Management Tools Blog Perform A/B testing and dark launches of your IoT applications using AWS IoT Core and Amazon CloudWatch Evidently https://aws.amazon.com/blogs/mt/perform-a-b-testing-and-dark-launches-of-your-iot-applications-using-aws-iot-core-and-amazon-cloudwatch-evidently/ Perform A B testing and dark launches of your IoT applications using AWS IoT Core and Amazon CloudWatch EvidentlyThe development of Internet of Things IoT applications is accelerating as companies build and maintain these applications at a faster pace to meet the needs of their customers and to continuously deliver valuable business results In addition to scheduled updates pushed to IoT devices feature flags allow you to activate dormant code present in your … 2023-06-02 12:29:58
python Pythonタグが付けられた新着投稿 - Qiita PythonのOpencv 自分用メモ https://qiita.com/nakazi0635/items/427cf8b8ec1068fab25c cvimread 2023-06-02 21:01:34
js JavaScriptタグが付けられた新着投稿 - Qiita ESLintのenv、extends、overrides、parser、parserOptions、plugins、rulesをざっくり理解する https://qiita.com/i2i3i/items/330e78cc3a83f21aaae8 eslint 2023-06-02 21:15:02
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Ruby on Rails】データ変更前の値を取得する https://qiita.com/Uts/items/b5a20f85ae043fa9bd97 active 2023-06-02 21:49:25
AWS AWSタグが付けられた新着投稿 - Qiita AWSコスト最適化:実践編(EBSボリュームのgp3化) https://qiita.com/pohd_ccoe/items/04aff521dae192472769 背景 2023-06-02 21:08:18
Git Gitタグが付けられた新着投稿 - Qiita GitLFSを使いたい時に見る(Mac) https://qiita.com/nakazi0635/items/f8d0c3a6e8be6fcbb658 githubdesktop 2023-06-02 21:00:55
Ruby Railsタグが付けられた新着投稿 - Qiita 【Ruby on Rails】データ変更前の値を取得する https://qiita.com/Uts/items/b5a20f85ae043fa9bd97 active 2023-06-02 21:49:25
Ruby Railsタグが付けられた新着投稿 - Qiita deviseを導入し、ログアウトするためのpath https://qiita.com/sa109/items/f99d44c70e5c2480149b destroyusersessionpath 2023-06-02 21:09:43
Ruby Railsタグが付けられた新着投稿 - Qiita gem 'dotenv-rails'の使い方 https://qiita.com/yamazaki2357/items/1ca91fdd8167da3738cc gemxdotenvrailsx 2023-06-02 21:02:45
技術ブログ Developers.IO 独自な強みを持つ人の評価 https://dev.classmethod.jp/articles/strength-and-evaluation/ 評価基準 2023-06-02 12:08:52
海外TECH MakeUseOf What Netflix's Crackdown on Password Sharing Means for You https://www.makeuseof.com/netflix-crackdown-password-sharing-what-it-means/ younetflix 2023-06-02 12:01:17
海外TECH MakeUseOf Best iPhone Car Chargers in 2023 https://www.makeuseof.com/best-iphone-car-chargers/ great 2023-06-02 12:01:17
海外TECH DEV Community 7 Forbidden Secrets of Git: Master the Most Important Commands Now! https://dev.to/muhmmadawd/7-forbidden-secrets-of-git-master-the-most-important-commands-now-o2m Forbidden Secrets of Git Master the Most Important Commands Now Hold onto your hats folks Today we re about to uncover the hidden secrets of Git that will transform you into a coding wizard in no time Git init The Ancient Ritual Step into the mystical world of Git with the sacred command git init It s like summoning a magical repository out of thin air infusing life into your project The ancients whispered that this command held the key to immortality or at least to version control Dive into the realm of Git young padawan Git clone The Cloning Conspiracy You re about to discover a scandalous secret the truth about git clone It s the ultimate act of digital espionage enabling you to copy an entire repository with a single command Imagine having access to all the secrets and code of others But remember with great power comes great responsibility or at least some cool code snippets Git add The Selective Superpower Behold the superpower to choose With git add you become the ultimate selector of files handpicking the chosen ones for the next big commit It s like assembling your dream team of code warriors ready to conquer the coding battleground Harness this power wisely for not all files are worthy of the commit hall of fame Git commit Leave Your Mark Prepare to embark on a journey of self expression with git commit It s your chance to leave your mark on the codebase forever etching your name in commit history Think of it as the coding equivalent of signing the Declaration of Independence but with fewer quills and more keyboard strokes Get ready to make history one commit at a time Git push Release the Kraken Break free from the chains of your local repository with the mighty git push It s time to release your code into the vast ocean of remote repositories where it will traverse uncharted servers and brave the treacherous waves of network traffic Watch as your code conquers new territories leaving a trail of digital footprints in its wake Git pull The Synchronized Symphony Prepare for a harmonious symphony of collaboration with git pull It s like joining hands with your fellow coders synchronizing your work and dancing to the beat of the latest updates With a simple command you ll be in perfect harmony avoiding conflicts and ensuring a smooth coding experience It s teamwork at its finest Git blame The Detective s Toolkit Become a coding Sherlock Holmes with the enigmatic git blame Unveil the true culprits behind those pesky lines of code that caused mayhem and confusion Track down the guilty parties armed with the power to assign blame and solve coding mysteries It s time to put on your detective hat and let the truth be revealed Conclusion Congratulations dear reader for unlocking the forbidden secrets of Git Armed with these powerful commands you re ready to conquer the coding realm and emerge as a true coding wizard 2023-06-02 12:39:25
海外TECH DEV Community Unit Testing with C# and .NET (Full Guide) https://dev.to/bytehide/unit-testing-with-c-and-net-full-guide-5c7p Unit Testing with C and NET Full Guide In this section we ll explore the world of unit testing in C and NET learn what unit testing is why it s important and the landscape of testing frameworks and tools available to developers Unit testing is the process of verifying the correctness of individual units of code typically methods or functions in isolation from the rest of the system This ensures that each unit performs as expected and helps to catch potential bugs or issues early in the development process Unit tests are automated self contained and focused on specific aspects of a unit They should be easy to understand maintain and execute providing a solid foundation for any developer who wants to ensure the quality of their code Importance of Unit Testing in Software DevelopmentUnit testing is a crucial practice in modern software development Its importance can t be overstated since it Ensures functionality It verifies that each unit of code works as expected avoiding bugs and other issues Enhances maintainability Well written tests act as a safety net allowing developers to refactor or change the code with confidence Improves code quality It encourages best practices like SOLID principles and makes developers better at writing more testable code Accelerates development Testing early and often allows developers to detect and fix issues faster reducing the overall time spent on debugging Facilitates collaboration Shared test suites give developers a common understanding of the code and enable smooth collaboration and better communication C and NET Unit Test Landscape Testing Frameworks and ToolsThere are several testing frameworks and tools available for unit testing in C and NET but the most popular ones are xUnit A modern extensible testing framework that focuses on simplicity and ease of use It is often considered the de facto choice for unit testing in NET Core NUnit A widely used well established testing framework with a rich feature set and extensive plugin ecosystem It has a long history and many legacy NET projects use it MSTest The default testing framework provided by the Microsoft Visual Studio suite offering tight integration with Visual Studio and backed by Microsoft support Moq A powerful mocking library specifically designed for NET allowing developers to create mock objects for isolated testing of units that interact with external dependencies Each framework has its strengths and weaknesses but in this article we ll focus on xUnit and Moq popular choices among C developers for unit testing Getting Started with xUnit A Modern Testing Framework for C Now that we re introduced to the landscape of C unit testing let s dive into xUnit learn its advantages and set up our first unit test using the framework Why Choose xUnit over Other Testing Frameworks xUnit has emerged as a preferred choice in the NET community for several reasons Modernity It was designed specifically for NET Core bringing a contemporary approach and new features to the table Simplicity xUnit emphasizes simplicity making it easy to learn and use even for developers new to unit testing Extensibility xUnit provides many extensibility points such as its attributes assertions and conventions allowing developers to tailor it to their needs Strong community support With broad adoption in the NET community xUnit has a wealth of resources documentation and answers to common questions Integration It boasts integrations with popular tools like Visual Studio VSCode ReSharper and NET CLI streamlining the testing experience Given these advantages we ll show you how to get started with xUnit in the sections below Installing and Setting up xUnit in Your NET ProjectTo get started with xUnit follow these easy steps Begin by creating a new NET Core test project using your preferred method such as Visual Studio JetBrains Rider or the NET CLI dotnet new xunit n MyUnitTestProject Next navigate to the project directory and then run the following command to restore the project dependencies dotnet restore Finally execute your first example test with the following command dotnet testWith setup complete you re now ready to write your own unit tests using xUnit Your First C Unit Test Case with xUnitIn this section we ll walk through creating a simple unit test using xUnit For our example let s say we have the following implementation of an Add method inside a Calculator class public class Calculator public int Add int a int b return a b To write a unit test for the Add method create a new test class in your test project called CalculatorTests Inside this class add a method called Add PositiveNumbers ReturnsExpectedResult decorated with the Fact attribute as follows using Xunit using MyProject public class CalculatorTests Fact public void Add PositiveNumbers ReturnsExpectedResult Arrange var calculator new Calculator int a int b int expectedResult Act int actualResult calculator Add a b Assert Assert Equal expectedResult actualResult When running the tests with dotnet test the test suite will now execute this test and provide a pass fail result based on whether the method behaves as expected xUnit Test Attributes Conventions and Execution FlowxUnit uses a variety of attributes and conventions in its execution flow Fact A Fact attribute indicates a method as a test case The method should neither have any return type nor any input parameters Theory A Theory attribute signifies a data driven test method allowing multiple inputs each of which results in a separate test execution InlineData InlineData attribute provides inline data for Theory tests simplifying test data management MemberData MemberData allows sharing data across test methods by specifying a member from which to pull the test data Additionally xUnit has an optional convention for test execution order control which can be customized to control test execution flow according to specific requirements Now that we ve covered the basics we re ready to move on to more advanced unit testing techniques with xUnit and C Writing Effective and Maintainable C Unit TestsAn essential aspect of unit testing is creating tests that are easy to understand maintain and extend In this section we ll explore the anatomy of a well structured test apply SOLID principles in test design encapsulate test setup and teardown and more Anatomy of a Well Structured Test Arrange Act AssertA good unit test follows the “Arrange Act Assert pattern which makes the code simple easy to understand and maintainable To explain this pattern let s break it down Arrange Set up the test environment and instantiate the system under test or its dependencies In practical terms this might mean creating mock objects setting up exception handlers or initializing state Act Invoke the target method using the prepared environment Assert Check if the expected outcome equals the actual result If not the test fails Try to keep your assertion count to one per test This pattern helps ensure that tests are logically organized and accessible facilitating better test maintainability Applies SOLID Principles in Test DesignTo ensure unit tests remain manageable maintainable and easy to understand they should adhere to the SOLID principles just like production code Single Responsibility Principle SRP Each test should focus on one specific unit or behavior Avoid mixing multiple assertions in a single test making it easier to comprehend and troubleshoot Open Closed Principle OCP Ensure that tests are open for extension meaning that adding new test cases doesn t require modifying the existing ones Liskov Substitution Principle LSP When using test inheritance or shared fixtures make sure the base classes or fixtures are replaceable by their derived types without compromising test integrity Interface Segregation Principle ISP If a test requires a specific interface it should depend solely on that interface rather than a larger more complex one This helps in narrowing down the dependencies and scope of the test Dependency Inversion Principle DIP Depend on abstractions rather than concrete implementations In tests this means using mocking frameworks like Moq to isolate tests from the actual implementation of dependencies Encapsulating Test Setup and TeardownIn many testing scenarios we need to perform setup or cleanup code before or after the test execution xUnit supports encapsulating test setup and teardown code through Constructor and IDisposable In xUnit the test class s constructor is used for setup and the IDisposable interface implementation is used for teardown This is the most common and recommended approach public class MyTestFixture IDisposable public MyTestFixture Test setup code here public void Dispose Test teardown code here IAsyncLifetime For async setup and teardown code xUnit provides the IAsyncLifetime interface which has InitializeAsync and DisposeAsync methods public class MyTestFixture IAsyncLifetime public async Task InitializeAsync Async test setup code here public async Task DisposeAsync Async test teardown code here C Unit Test Best Practices Naming Organization and GranularityTo maintain clean and maintainable test code it s essential to pay attention to the organization and naming conventions Some best practices include Naming Give your test method names descriptive titles that convey their purpose Using a convention like MethodName Scenario ExpectedBehavior helps in understanding the test s intent quickly Organization Group related tests in the same class or namespace making it easier to locate relevant tests Granularity Aim to test a single behavior per test case Smaller tests reduce the debugging effort if a test fails Readability Write clean and easy to understand tests making it straightforward for developers to grasp the intention and expectations of a test Incorporating Test Driven Development TDD in Your WorkflowTest Driven Development TDD is a powerful development methodology that revolves around writing tests first followed by the implementation It follows a cyclical process of Write a failing test Implement the functionality to pass the test Refactor the code while keeping the test greenTDD fosters better code quality maintainability and overall development efficiency as the focus is on writing simple clear and tested code from the start Advanced xUnit Techniques for Robust Test CasesNext let s expand our knowledge of xUnit and explore advanced techniques to create robust test cases Embracing Data Driven Tests with InlineData and MemberDataxUnit s Theory attribute allows creating data driven tests using InlineData or MemberData to supply input values InlineData Supplies inline data values directly in the test method attribute Theory InlineData InlineData public void Add TwoNumbers ReturnsSum int a int b int expectedResult Test implementation MemberData Specifies a member property or method that returns an enumeration of test data which should return an object array for each test case public static IEnumerable lt object gt TestData get yield return new object yield return new object Theory MemberData nameof TestData public void Add TwoNumbers ReturnsSum int a int b int expectedResult Test implementation Sharing Test Contexts Using Class and Collection FixturesIn xUnit test context sharing is achieved via fixtures helping avoid code duplication and ensuring consistent setup teardown Class Fixture Shares a single instance of a context across all tests in a class To use a class fixture create a class implementing the IClassFixture lt T gt interface where T is the context type public class MyTestFixture IClassFixture lt MyContext gt Test implementation Collection Fixture Shares a context instance across multiple test classes useful for resource intensive setups Create a collection definition class implementing the ICollectionFixture lt T gt interface and then apply the CollectionDefinition attribute CollectionDefinition MyCollection public class MyCollection ICollectionFixture lt MyContext gt Collection MyCollection public class MyTest Test implementation Collection MyCollection public class MyTest Test implementation Skipping Tests and Conditional Test Execution in xUnitSometimes we may want to skip tests or execute them conditionally based on specific circumstances xUnit provides options to facilitate this Skipping tests Use the Skip parameter on the Fact or Theory attributes to skip a test Fact Skip Skipping this test due to public void MySkippedTest Test implementation Conditional test execution The ConditionalFact and ConditionalTheory attributes let you conditionally execute tests controlled by a boolean value which can be obtained through a custom method or property ConditionalFact nameof IsFeatureEnabled public void MyConditionalTest Test implementation private static bool IsFeatureEnabled Return true if feature is enabled Customizing Test Output xUnit Loggers and ReportersIn some scenarios you may want to customize test output to generate reports or logs in various formats xUnit supports this through a system of loggers and reporters Loggers Implement the ITestOutputHelper interface to redirect test output to custom locations or append additional information public class MyTests private readonly ITestOutputHelper output public MyTests ITestOutputHelper output output output Fact public void TestWithCustomOutput output WriteLine Custom log message Test implementation Reporters Custom reporters can be created by implementing the IMessageSinkWithTypes interface allowing for more fine grained control over test output and formatting public class MyCustomReporter IMessageSinkWithTypes public bool OnMessageWithTypes IMessageSinkMessage message HashSet lt string gt messageTypes Custom test report logic here Tips for Dealing with Flaky and Non deterministic TestsFlaky tests can cause headaches and wasted time as their pass fail outcome may change depending on external factors or timing Some tips for handling non deterministic tests include Mocking Use mocking frameworks like Moq to replace external dependencies that might cause flakiness Timeouts Use timeouts to ensure tests don t run indefinitely due to faulty synchronization mechanisms or long delays Test stability Make your tests resilient to minor changes in the system ensuring consistency while still checking for correctness Retry Implement retry logic for tests that intermittently fail due to transient issues Introduction to Mocking and Moq for C Unit TestsIn this part we ll introduce the concept of mocking its benefits and one of the most popular mocking libraries in the NET ecosystem Moq Understanding the Purpose of Mocking and Its BenefitsMocking is the practice of creating “fake implementations of objects or dependencies that a system under test interacts with This allows developers to isolate their tests from the actual implementation enabling increased control stability and isolation The benefits of mocking include Test isolation Mocks allow for complete control of test behavior and avoid side effects caused by real implementations Greater flexibility With mocks testing becomes more flexible by enabling edge cases or exceptional scenarios that might be difficult to reproduce with actual dependencies Reduced complexity Mocks let you focus on the behavior of the system under test instead of dealing with the complexities of real world dependencies Speed Mocking can significantly speed up test execution by reducing resource intensive operations or network interactions Moq A Powerful and Popular Mocking Library for NET DevelopersMoq is a popular and powerful NET mocking library that provides a simple and intuitive API for creating and managing mock objects Key features of Moq include Strong typing Moq leverages C s strong typing providing compile time checking of mocked method calls and behavior Expressive API Moq s API is designed to be expressive and easy to use allowing developers to specify expectations and behaviors with minimal code LINQ querying Moq supports LINQ queries making it simple to define complex mock behaviors and expectations Integration Moq works seamlessly with popular testing frameworks like xUnit making it easier to create robust and maintainable unit tests Integrate Moq in Your NET ProjectTo get started with Moq follow these steps Add the Moq NuGet package to your test project using your preferred method such as Visual Studio JetBrains Rider or the NET CLI dotnet add package Moq Add the using Moq statement in your test classes where you plan to use mocks Use Moq s Mock lt T gt class to create and configure mock objects in your tests where T is the interface or class being mocked Mastering Moq Writing Isolated Unit Tests with Mock ObjectsIn this section let s dive into Moq learn how to create and configure mock objects set up expectations responses and return values as well as verify interactions and behaviors Creating and Configuring Mock Objects with MoqTo create a mock object with Moq instantiate a Mock lt T gt object where T is the interface or class being mocked Consider the following example with an IOrderService interface public interface IOrderService bool PlaceOrder Order order To create a mock object of this interface use the following code var mockOrderService new Mock lt IOrderService gt Once you ve created a mock object you can configure its behavior and expectations using Moq s methods such as Setup Returns Throws and more Setting up Expectations Responses and Return Values with MoqMoq allows you to specify expectations and responses for your methods Let s explore a few common scenarios Returns To specify a return value for a mocked method use the Returns method mockOrderService Setup x gt x PlaceOrder It IsAny lt Order gt Returns true Throws To throw an exception when the mocked method is called use the Throws method mockOrderService Setup x gt x PlaceOrder It IsAny lt Order gt Throws new InvalidOperationException Callbacks If you wish to execute specific code when a mocked method is called use the Callback method mockOrderService Setup x gt x PlaceOrder It IsAny lt Order gt Callback lt Order gt order gt Console WriteLine Order placed order Id Returns true Verifying Interactions and Behaviors Asserting Mock CallsAnother powerful feature of Moq is the ability to verify the interactions between the system under test and the mocked dependencies To do this use the Verify method mockOrderService Verify x gt x PlaceOrder It IsAny lt Order gt Times Once In this example we re verifying that the PlaceOrder method was called exactly once with any Order object Going Beyond Basics Moq Callbacks Sequences and Event RaisingMoq offers more advanced options for advanced scenarios Callbacks As already mentioned you can use Callback to execute specific code when a mock method is called You can even capture method arguments for further validation mockOrderService Setup x gt x PlaceOrder It IsAny lt Order gt Callback lt Order gt order gt Assert NotNull order Returns true Sequences If a mocked method gets called multiple times you can set up a sequence of responses or actions using the Sequence extension mockOrderService SetupSequence x gt x PlaceOrder It IsAny lt Order gt Returns true Throws new InvalidOperationException Returns false Event Raising Moq allows you to mock events and raise them from the mocked object public interface IOrderNotifier event EventHandler lt OrderEventArgs gt OrderPlaced var mockOrderNotifier new Mock lt IOrderNotifier gt Raise the event mockOrderNotifier Raise x gt x OrderPlaced null new OrderEventArgs Order myOrder Moq and xUnit Integration Use Cases and GotchasIntegrating Moq with xUnit is straightforward since they work well together Both libraries emphasize simplicity and usability However there are potential pitfalls such as Test Fixture Lifetimes When using shared test fixtures with Moq be aware that the fixtures lifetime affects the state of your mock objects Resetting or reconfiguring them might be necessary Async Await If your tests involve asynchronous methods be sure to setup and verify the mock objects behavior accordingly Enhancing Unit Tests with DI and Mocking Best PracticesNow that we are more acquainted with Moq let s explore best practices for combining Dependency Injection DI and mocking in our tests Embracing Dependency Injection for Greater Test FlexibilityDependency Injection DI is a design pattern that promotes greater test flexibility By injecting dependencies as constructor or method parameters rather than directly instantiating them we achieve Easier mocking Mock objects can be injected more easily leading to better test isolation Reduced coupling Dependencies are expressed explicitly making code easier to understand and maintain Try to apply DI wherever possible particularly when working with external dependencies allowing you to work with Moq more effectively When to Use Mocks Stubs and Fakes in Your TestsWhen dealing with dependencies in your tests it s essential to understand when to use each type Mocks Use mocks when you need to verify interactions or behavior between the system under test and its dependencies Useful for asserting that specific methods were called with particular parameters or a certain number of times Stubs Use stubs when you need to provide fixed responses or data from a dependency without asserting the behavior They re excellent for supplying inputs and simulating state transitions Fakes Fakes are lightweight in memory implementations of dependencies that replicate their essential behavior Use them when you need more control over the dependency s behavior or state and when mocking or stubbing isn t sufficient Striking a Balance Effective Mock Usage for Maintainable TestsOverusing mocks can lead to brittle tests that break easily and are hard to maintain It s essential to strike a balance between mocking and other techniques like stubbing or fakes Key tips include Don t over mock Only mock the necessary dependencies and avoid mocking everything Mock only parts of a dependency Sometimes you can mock parts of a dependency rather than the whole object Simplicity is key Assess whether a mock is really necessary Using simpler alternatives such as stubs or fakes can simplify your tests Building Modular Tests with Factories and BuildersTo further enhance the maintainability of your tests employ factories and builders to generate mock objects test data or instances of your system under test Factories Create factory methods or classes that instantiate or configure common objects used throughout your test suite This encapsulates object creation and reduces code duplication Builders Use the builder pattern to construct complex objects by allowing the incremental setting of properties or configuration This results in more readable and flexible test code Measuring and Improving Test Quality with MetricsFinally let s discuss how to measure test quality and make improvements using metrics such as code coverage test quality metrics and handling edge cases The Importance of Code Coverage in C Unit TestsCode coverage is a valuable metric that helps you understand how well your tests exercise your production code While it doesn t provide a complete picture of test quality it does offer insights into potential gaps in your test suite Aim for a reasonable context specific level of code coverage Aiming for coverage isn t always practical or efficient Instead determine which parts of your code require more thorough testing and ensure that critical code paths are well tested Leveraging Visual Studio and NET CLI for Code Coverage AnalysisVisual Studio and NET CLI support analyzing code coverage enabling you to measure the coverage of your tests effortlessly Visual Studio The Visual Studio Enterprise edition provides built in support for code coverage analysis featuring an easy to use interface and results visualization You can also use extensions like ReSharper or dotCover for code coverage analysis in other Visual Studio editions NET CLI You can use the dotnet test command to generate code coverage reports in various formats Cobertura OpenCover etc by installing a coverage tool like coverlet and analyzing results with an external tool like ReportGenerator Beyond Code Coverage Test Quality Metrics and HeuristicsWhile code coverage is useful it s essential to measure other aspects of test quality including Test effectiveness Evaluate how well your tests detect actual issues in your code High quality tests are better at detecting defects and minimizing false negatives or positives Ease of maintenance Assess how easy your tests are to understand modify and extend High quality tests promote maintainability reducing the cost of development over time Test execution time Monitor the time it takes to run your tests Slow tests can hinder development and feedback cycles reducing overall productivity Consider these factors when evaluating the quality of your test suite and making improvements Handling Edge Cases and Corner Cases Strategies for Comprehensive TestingLastly it s vital to consider edge cases and corner cases when designing your tests These scenarios can lead to unexpected behavior or defects and should be tested thoroughly to ensure system stability Some strategies for handling edge cases include Boundary value analysis Test inputs or conditions at the edges of acceptable ranges These cases often reveal problems with edge conditions or limit checks Equivalence class partitioning Divide input data into groups or classes that are expected to behave similarly testing each group with representative values This can help you discover issues with specific input groups Error conditions Test various ways your code can fail or encounter errors especially in handling exceptions and error reporting Ensure that your code gracefully handles these scenarios Performance limits Identify performance or resource constraints and test accordingly Find out how your system behaves under high load limited memory or other constrained conditions User behavior Finally consider how users interact with your application and test any unusual usage patterns or inputs Doing so can help you uncover issues that arise from unexpected user input or actions In conclusion C and NET offer a rich ecosystem for unit testing with a variety of powerful frameworks and libraries like xUnit and Moq By following the principles patterns and best practices discussed in this article you can develop comprehensive and maintainable unit tests that ensure the quality stability and reliability of your C applications Keep learning practicing and refining your unit testing skills to become an ever more effective developer 2023-06-02 12:32:31
海外TECH DEV Community Rancher & MicroK8s https://dev.to/nunix/rancher-microk8s-5h4e Rancher amp MicroKs IntroductionThis blog is an answer to the The New Stack article and the goal is to see how few changes based on the Rancher official documentation could help run the example in the article PrerequisitesI m working on Windows and to have a comparable environment I created an Hyper V virtual machine VM instead of using WSL Here s the configuration details VM cores Go Ram Go diskOS Ubuntu server Option OpenSSH server installedI decided to not install MicroKs from the installer and will instead make it part of the environment configuration steps see below Memory consumptionOne of the points pointed out by the author is that Rancher requires at least Go RAM as mentioned in the docs So while there s some sort of misunderstanding in the requirements I ve taken up to the challenge and created the VM with only Go Note the misunderstanding is that the requirements are only for Rancher on Docker in a standalone server The author tried to put everything in the same server This means that only the Rancher requirements were looked into and discarded the MicroKs own requirements For the time being let s see what a fresh install of Ubuntu server uses As displayed the OS footprint is about Mo which represents only of the RAM available ConfigurationOnce the OS is installed we can SSH with the user and password created during the installation MicroKsThe first part will be to update the system and install MicroKs Update the repositoriessudo apt update Update the packagessudo apt upgrade y Install MicroKssudo snap install microks classic Optional Install Kubectlsudo snap install kubectl classic Option Create an alias to microks kubectl sudo snap alias microks kubectl mk Add the user to the microks groupsudo usermod a G microks USERsudo chown R USER kube Apply the group change by starting a new session Optional Create the kube directorymkdir kube Get the Kubeconfigmicroks config gt kube configAttention MicroKs shows different cluster IP depending on which kubectl is used Attention As of May the version installed by default is from the channel stable However the current version of Rancher Manager only supports Kubernetes Source Support matrix SUSEMemory consumptionAs stated in MicroKs official documentation the cluster doesn t need much RAM about Mo which fully correlates with the RAM usage once MicroKs has been installed As displayed the current RAM used is around Mo which represents the Mo from the OS and the Mo from MicroKs So we re about of RAM usage which seems plenty to continue DockerThe second part and which relates now to the article is the installation of Docker which will be used to run the Rancher container Install the dependenciessudo apt get install apt transport https ca certificates curl gnupg lsb release y Install the Docker repository GPG keycurl fsSL sudo gpg dearmor o usr share keyrings docker archive keyring gpg Add the Docker repositoryecho deb arch dpkg print architecture signed by usr share keyrings docker archive keyring gpg etc os release amp amp echo VERSION CODENAME stable sudo tee etc apt sources list d docker list gt dev null Update the repositoriessudo apt update Install dockersudo apt get install docker ce docker ce cli containerd io y Add the user to the docker groupsudo usermod aG docker USER Apply the group change by starting a new sessionMemory consumptionDocker install doesn t consume much around Mo only This is normal as the daemon is idle with no containers running Let s try to run a minimal Nginx container from the Chainguard image Even with such minimal container running the RAM usage is about Mo Note before continuing I stopped all the containers running and rebooted the server This brought bach the RAM usage to Mo Rancher ManagerHere s the final component and so far the RAM usage seems to handle pretty well the workloads I ll start a new container based on the latest Rancher version instead of as described in the article The reason why the author faced issues between Rancher and MicroKs is due to the version mismatch The current version of Rancher only supports Kubernetes versions up to as described in the official Rancher Support Matrix However the default MicroKs version is I ll explain later how we can easily change the MicroKs version but let s go back to the Rancher container The command to start the container is the following Start a new Rancher containerdocker run d name rancher server restart unless stopped p p privileged rancher rancher latestOnce the container started Rancher is available via the web on the address of the server Example Memory consumptionThe Rancher container contains a Ks single node cluster the containerD runtime and Rancher Manager installed This is reflected in the memory usage As displayed this is a clear jump in RAM usage as it went from almost Mo to Go which represents of the total RAM Still there s plenty of RAM to continue and perform the last task Add MicroKs to RancherAs stated above one of the issue the author ran into was due to a version mismatch The current default version installed by MicroKs is So to ensure the compatibility between Rancher and MicroKs the version needs to be downgraded to Thanks to the concept of snap channels this can be achieved in one command Optional Check the current MicroKs versionmicroks version Change the channel to the stablesudo snap refresh microks channel stable Optional Check the current MicroKs versionmicroks versionNow that all the components have compatible versions MicroKs can be imported into Rancher in the web interface as follow In the welcome page once logged in click on Import ExistingChoose GenericWrite a name all lowercase and click CreateOn the registration page click on the second option curl insecure to copy the textNote Based on how Rancher was installed with the Docker command it created a self signed certificate This means that MicroKs will not have the corresponding certificate and would generate an error if the first option was usedOnce the registration completes the node will appear as activeMemory consumptionAfter all the tasks were done and which were successful the final RAM usage is around Go which represents ConclusionAs stated in a tweet this article comes with a bitter sweet taste for me In one end I can totally relate to the learning in public by writing blog posts trying new technology and making many mistakes while doing so However when I face specific issues that others don t seem to have then I tend to ask for help on different community channels and of course I go back to the products projects official documentation This is also where I don t relate at all with the article as a whole and have some questions about the publishing process of The New Stack The article ends abruptly by stating Portainer is better use it Well because the article is somewhat incorrect in certain points again due to the lack of documentation checking the article actually brought a shade on both Portainer and MicroKs which never asked for it I got DMs from both companies So here s my advice to anyone reading this blog post please continue learning in public ask questions and if you face issues ask for help But sincerely avoid doing unwanted comparisons and READ THE DOCS I m a Tech Writer if my docs are not good complete open an issue they re ALL open sourced The Corsair ‍ ️ 2023-06-02 12:10:33
海外TECH DEV Community Svelte TimeTable Game https://dev.to/vulcanwm/svelte-timetable-game-24fl Svelte TimeTable GameA few days ago I decided to learn Svelte and SvelteKit Now I ve made a simple TimeTable game with Svelte You can check out it s GitHub repo here VulcanWM timetable game TimeTable GameWhat features does it have This is a game where you have a minute to answer as many timetable questions as you can You have an option to select which timetables you want to appear At the end of the game you can see how many questions you got right and wrong and a graph which shows how many questions you have answered each second also appears How was it made This game is made using Svelte and SvelteKit so it uses HTML CSS and JavaScript It is hosted by Netlify How did you get the idea of making this Since I first played TTRockstars I ve always wanted to make a game like this So when I started learning Svelte and needed a project idea I decided to make this Where can I play it You can play the game here Or you can… View on GitHub What features does it have This is a game where you have a minute to answer as many timetable questions as you can You have an option to select which timetables you want to appear At the end of the game you can see how many questions you got right and wrong and a graph which shows how many questions you have answered each second also appears How was it made This game is made using Svelte and SvelteKit so it uses HTML CSS and JavaScript It is hosted by Netlify How did you get the idea of making this Since I first played TTRockstars I ve always wanted to make a game like this So when I started learning Svelte and needed a project idea I decided to make this Where can I play it You can play the game here Or you can clone this repository and run npm run dev to play it locally 2023-06-02 12:04:19
Apple AppleInsider - Frontpage News WWDC 2023 is near, M2 Macs are coming, and Meta Quest 3 on the AppleInsider Podcast https://appleinsider.com/articles/23/06/02/wwdc-2023-is-near-m2-macs-are-coming-and-meta-quest-3-on-the-appleinsider-podcast?utm_medium=rss WWDC is near M Macs are coming and Meta Quest on the AppleInsider PodcastApple continues to hype WWDC new M Macs could launch soon while a Meta Quest announcement tries to overshadow Apple and your hosts examine anticipated iOS features all on this week s episode of the AppleInsider podcast Render of Apple s upcoming headsetAfter all this time and all this speculation it s peculiar to be able to say that WWDC is just next Monday On practically the eve of Apple s announcement of a headset its time to see which rumors are worth putting any stock in Read more 2023-06-02 12:38:27
Apple AppleInsider - Frontpage News Apple petitioned India for slacker labor laws, and unions are fighting back https://appleinsider.com/articles/23/06/02/apple-petitioned-india-for-slacker-labor-laws-and-unions-are-fighting-back?utm_medium=rss Apple petitioned India for slacker labor laws and unions are fighting backApple and Foxconn successfully lobbied India s Karnataka region to extend legal working hours in factories but labor unions are starting to push back Foxconn has now had formal approval for its new iPhone factory by the Karnataka authorities and it follows an earlier change in Indian law over conditions Both Foxconn and Apple lobbied for the change which sees longer working hours and also overnight work for women Previously women were not allowed to work night shifts and factories were limited to a maximum of nine hours per day The new law change implemented in Karnataka and being pressed for across India means factories can now run two hour shifts Read more 2023-06-02 12:14:32
海外TECH Engadget The 4K Chromecast with Google TV is cheaper than ever at Amazon https://www.engadget.com/the-4k-chromecast-with-google-tv-is-cheaper-than-ever-at-amazon-125601913.html?src=rss The K Chromecast with Google TV is cheaper than ever at AmazonThere s no better way to make a dumb TV smart than Chromecast with Google TV thanks to the breadth of streaming options Dolby Vision support and relative affordability Now you can grab one for even less at Amazon thanks to a new sale The K version is available for just percent off tied for the lowest price we ve ever seen And if HD resolution is fine the Chromecast with Google TV HD is just for a savings of percent ーalso back down to an all time low The Chromecast with Google TV isn t as small as some streaming sticks but it s still a nice compact and attractive solution and the cable makes it easy to plug into most TVs or projectors It also comes with a nice remote control that s comfortable in hand offers controls that are pleasant to use nbsp The design along with the solid feature set helped the K version earn an score in our Engadget review and top pick in this year s streaming devices buyer s guide For compatible TVs it offers support for Dolby Vision and Dolby Atmos along with regular HDR It also offers excellent Google Assistant integration that makes voice commands a breeze And while past Chromecast devices could be laggy both the K and HD versions offer much improved performance nbsp The main downside is the lack of Apple TV but Chromecast with Google TV works just fine with Apple devices As mentioned both the K and HD devices are down to all time lows and respectively so it s best to act soon if you re interested in buying one Follow EngadgetDeals on Twitter and subscribe to the Engadget Deals newsletter for the latest tech deals and buying advice This article originally appeared on Engadget at 2023-06-02 12:56:01
海外TECH Engadget Engadget Podcast: Apple WWDC 2023 preview https://www.engadget.com/engadget-podcast-apple-wwdc-2023-preview-123020712.html?src=rss Engadget Podcast Apple WWDC previewIt s only a few days until the beginning of Apple s Worldwide Developers Conference next week and we re eager to see what the iPhone maker is cooking up This week Cherlynn and Devindra are joined by Engadget Senior Writer Sam Rutherford to dive into all of the Apple rumors That fabled mixed reality headset a potential inch MacBook Air and more But really all eyes are on the headset Is Apple setting itself up for failure or for a future where smart glasses are actually a thing Also we discuss the late breaking news about Meta s Quest headset which sounds like it will offer better VR and color mixed reality support for Listen below or subscribe on your podcast app of choice If you ve got suggestions or topics you d like covered on the show be sure to email us or drop a note in the comments And be sure to check out our other podcasts the Morning After and Engadget News Subscribe iTunesSpotifyPocket CastsStitcherGoogle PodcastsTopicsApple s AR Headset iOS MacOS and everything else we expect to see at WWDC Meta Quest details drop ahead of Apple s developer conference next week Oppo debuts MR Glass Developer Edition AI leaders issue dire warning on its risks neglecting their own responsibility in its development Chatbot rolled out by National Eating Disorders Association taken offline after giving bad advice Working on Listener mailbag Pop culture picks LivestreamCreditsHosts Cherlynn Low and Devindra HardawarGuest Sam RutherfordProducer Ben EllmanMusic Dale North and Terrence O BrienLivestream producers Julio BarrientosGraphic artist Luke Brooks and Joel ChokkattuThis article originally appeared on Engadget at 2023-06-02 12:30:20
海外TECH Engadget The best laptops for 2023 https://www.engadget.com/best-laptops-120008636.html?src=rss The best laptops for You may want to upgrade your tech soon but buying a new laptop computer can be confusing There have never been more brands features and configurations to consider and given that we re still dealing with inflation you may also be concerned about rising prices The good news is companies are still making a ton of new laptops and there are a wide range of models for you to choose from the budget HP Pavilion Aero to the convertible Microsoft Surface Pro to our best overall pick of the Apple MacBook Air M We ve made it less complicated for you to pick out the best laptop for your needs What to expectYou probably have an idea of your budget here but just so you know most modern laptops with top of the line specs can cost you around to these days That doesn t mean you won t find a good system for under ーa grand is the base price for a lot of high end ultraportables in the inch category with chips like Intel s Core i or i series And if that s too expensive you ll still have respectable options in the to range but they might come with older slower processors and dimmer screens I ve included our favorite budget friendly model in this best laptop roundup but we have a list of more affordable laptops that you can check out as well After working out how much money you want to spend the laptop s operating system is usually the first thing you have to narrow down As always the decision is slightly easier for people who prefer an Apple MacBook Now that the company has brought its M series chips to its whole lineup ーyour only real considerations are budget screen size and how much power you need Over on Team Windows however the shift to ARM based chips hasn t been as smooth Though Apple laptops have been able to bring huge increases in battery life while maintaining and in some cases improving performance with their own silicon PC makers have been limited by Windows shortcomings Microsoft released Windows last year and it s supposed to run better on ARM powered machines Since the first of these laptops like Lenovo s ThinkPad Xs or w tablet haven t been available for review yet we can t tell how well the system runs Of course you can upgrade to Windows on existing ARM based PCs but for now it s still safer to stick with an Intel or AMD processor Devindra Hardawar Engadget Let s not forget there s a third and fairly popular laptop operating system Chrome OS If you do most of your work in a browser lots of online research emails and Google Drive then a Chromebook might be a suitable and often more affordable option As for other things to look out for when shopping for the best laptop it s worth pointing out that some of the latest models coming out this year have done away with headphone jacks Though this doesn t seem to be a prevalent trend yet it s a good reminder to check that a machine has all the connectors you need Most laptops in offer WiFi or E and Bluetooth or later which should mean faster and more stable connections if you have compatible routers and devices While G coverage is more widespread this year whether you need support for that depends on how much you travel See Also Best Gaming Laptops for Best Cheap Windows LaptopsBest in Laptops for Best ChromebooksBest Laptops for College StudentsWhere you plan on taking your laptop also helps in deciding what size to get Many companies launched new inch machines in the last year straddling the line between ultraportable and bulkier inch offerings For most people a inch screen is a great middle ground But if you re worried about weight a or inch model will be better Those that want more powerful processors and larger displays will prefer or inch versions Best overall MacBook Air MAs a Windows user I find myself reluctant to name an Apple MacBook the best overall laptop But I can t deny that Apple s transition to its own Silicon has made its machines better The latest MacBook Air M is a worthy sequel to the M that came out in bringing a fresh design and a performance boost that all users will appreciate That s not to say the M was a sluggish machine ーquite the contrary We found it to be impressively fast and the M only builds on top of that excellent performance It s probably overkill for a MacBook Air but that means it will serve most people well for both work and play Plus its impressive hour long battery life should be enough for anyone to get a day s worth of work and then some As for its design we like that Apple took a more uniformly thin approach here and retired the wedge shape of the previous model The M Air also has a lovely inch Liquid Retina display interrupted only by the top notch which holds its p webcam Its quad speaker setup is an improvement as well and all of these small hardware changes add up to a machine that looks and feels more different than you may expect from its predecessor However both the Apple M and M MacBook Air laptops remain solid machines Considering the M starts at those with tight budgets may be willing to forgo the new design improvements in order to save some cash and get a still speedy laptop Read our Full Review of MacBook Air M Best Windows Dell XPS PlusThe best PC has long been Dell s well rounded XPS series and it remains the best laptop for anyone that doesn t want a Mac Yes the new XPS Plus lacks a headphone jack and we haven t got one in to test yet But the XPS is a well rounded Windows laptop and still one of the best looking PCs out there Like its predecessors the Dell XPS Plus offers a lovely OLED display with impressively thin bezels and packs a roomy comfortable keyboard It also features a new minimalist design that looks more modern I m not sure about the row of capacitive keys at the top in lieu of traditional function keys but I m confident that the laptop s th gen Intel Core processors will provide a healthy performance boost from the last model If you re not sure about the changes Dell has made to the XPS or if you definitely need a headphone jack the older generations are still solid options There s also the Samsung Galaxy Book Pro series which feature beautiful OLED screens and sharper webcams in thin and light frames I also like Microsoft s Surface Laptops and the most recent edition offers great performance versatility and battery life albeit in an outdated design Read our Full Review of Dell XPS PlusBest for gaming Razer Blade Gamers should look for machines with solid build quality responsive screens and ample port selection for their favorite accessories that can best help them defeat their virtual enemies My colleague Devindra Hardawar goes into more detail about what to consider in his guide to buying a gaming laptop which you should read to learn about different CPUs and GPUs minimum specs and more Our pick for the best gaming laptop is the Razer Blade It s a high end model and the most expensive item on this list but you get a inch quad HD screen with a Hz refresh rate th gen Intel processors and NVIDIA GeForce series graphics Different configurations are available depending on your preference including a Full HD Hz and a K Hz version The Blade series is also one of the most polished and powerful gaming laptops around Those looking for a budget gaming laptop should consider the ASUS ROG Zephyrus G which was our favorite model last year The main reason it got bumped down a notch is because the refresh is almost more expensive It s still a solid gaming laptop though with an excellent display roomy trackpad and plenty of ports in spite of its thin profile Read our Full Review of Razer Blade Best Chromebook Lenovo IdeaPad Flex i ChromebookOur favorite Chromebook is Lenovo s Flex Chromebook which Engadget s resident Chrome OS aficionado Nathan Ingraham described as “a tremendous value This laptop nails the basics with a inch Full HD touchscreen a fantastic keyboard and a th generation Intel Core i processor Its GB of RAM and GB SSD may sound meager but in our testing the Flex held up in spite of this constraint It s also nice to see one USB A and two USB C ports eight hours of battery life and a degree hinge that makes it easy to use the Flex as a tablet That s a bonus especially now that Chrome OS supports Android apps Though the Flex is almost two years old by now this Lenovo Chromebook is a solid deal at around In fact you can sometimes find it on sale for as little as making it a great option for someone looking for a basic browser based machine on a tight budget Best budget HP Pavilion Aero If you re looking for a budget laptop priced around your best bet is the HP Pavilion Aero For around or often less when on sale you ll get a Full HD screen with a aspect ratio and surprisingly thin bezels as well as a comfortable keyboard and spacious touchpad Importantly the Aero provides relatively powerful components compared to others in this price range with an AMD Ryzen series processor and Radeon graphics Plus it has a generous array of ports and enough battery life to last you the entire work day and then some Read our Full Review of HP Pavilion Aero Best convertible Microsoft Surface Pro For those who need their laptops to occasionally double as tablets the Surface Pro series is a good option Compared to notebooks with rotating hinges tablets with kickstands are often much slimmer and lighter The Surface Pro is Microsoft s latest in laptop model and if you ve had your eye on a Surface for a while just know to get the Intel version of this machine rather than the ARM model In our testing we found that the G ARM version of the Pro was much slower than a flagship convertible should be and that s mostly due to the fact that lots of the Windows apps readily available on Intel s x hardware have to be emulated to work on Microsoft s custom ARM SoC Considering you ll pay at least for any Surface Pro model you might as well get a configuration that has as few limitations as possible While we have our gripes about the Pro s overall ergonomics it s undoubtedly one of the thinnest and lightest laptop alternatives you can get It s attractive and has a gorgeous inch display and we still consider Microsoft s Type Cover to be one of the best you can get period They will cost you extra though so be prepared to shell out another to for one Microsoft s Slim Pen is another highlight and it will be a must buy stylus for anyone that loves to draw or prefers to take handwritten notes Overall if you want a machine that can switch seamlessly from being a laptop to being a tablet the Intel Surface Pro is one of your best bets Of course if you re married to the Apple ecosystem you should consider an iPad Pro Read our Full Review of Microsoft Surface Pro This article originally appeared on Engadget at 2023-06-02 12:16:24
Cisco Cisco Blog Cisco Secure Firewall Integration with Amazon Security Lake https://feedpress.me/link/23532/16159159/cisco-secure-firewall-integration-with-amazon-security-lake amazon 2023-06-02 12:00:47
海外科学 NYT > Science Sparrows Are the Main Suspects in a Bird-Nest Murder https://www.nytimes.com/2023/06/02/climate/bird-nest-sparrows.html murdera 2023-06-02 12:38:07
海外ニュース Japan Times latest articles Heavy rain lashes Japan as tropical storm passes south of archipelago https://www.japantimes.co.jp/news/2023/06/02/national/heavy-rain-storm-warnings/ Heavy rain lashes Japan as tropical storm passes south of archipelagoThe rain disrupted travel along the country s busiest shinkansen line and prompted one city in Aichi Prefecture to issue a level warning over imminent 2023-06-02 21:54:33
ニュース BBC News - Home Alison Hammond breaks down on This Morning over Phillip Schofield interview https://www.bbc.co.uk/news/entertainment-arts-65785570?at_medium=RSS&at_campaign=KARANGA alison 2023-06-02 12:38:39
ニュース BBC News - Home Boris Johnson to bypass government on Covid WhatsApps https://www.bbc.co.uk/news/uk-politics-65787617?at_medium=RSS&at_campaign=KARANGA covid 2023-06-02 12:54:17
ニュース BBC News - Home Dame Elan Closs Stephens appointed acting BBC chairwoman https://www.bbc.co.uk/news/uk-65787514?at_medium=RSS&at_campaign=KARANGA richard 2023-06-02 12:06:44
ニュース BBC News - Home Geraint Davies: Three MPs say they were warned about him https://www.bbc.co.uk/news/uk-wales-65783805?at_medium=RSS&at_campaign=KARANGA labour 2023-06-02 12:17:33
ニュース BBC News - Home Spanish Grand Prix: Max Verstappen sets pace in first practice https://www.bbc.co.uk/sport/formula1/65789668?at_medium=RSS&at_campaign=KARANGA Spanish Grand Prix Max Verstappen sets pace in first practiceMax Verstappen set the pace in a first practice session that gave little insight into the true competitive picture at the Spanish Grand Prix 2023-06-02 12:44:40

コメント

このブログの人気の投稿

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

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

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