简体   繁体   English

测试硒,TESTNG问题

[英]TESTING SELENIUM, TESTNG Questions

I am an entry level tester, mainly been doing manual testing for a company in the UK following scripts on a spreadsheet which I have written in the BDD format, however, I have been learning some automation on the side as that's what I want to move into full time. 我是一名入门级测试员,主要是按照我用BDD格式编写的电子表格中的脚本对英国公司进行手动测试,但是,我一直在学习一些自动化,因为我想要移动全职。 I have some questions though which are as follows. 我有一些问题,但如下。

I've been using Selenium web driver + java bindings to make simple tests such as logging in or filling out a registration form, i've also set up log4j but only basic to record low level recording. 我一直在使用Selenium web驱动程序+ java绑定来进行简单的测试,例如登录或填写注册表单,我还设置了log4j,但只记录了低级记录。 I have now come across testNG. 我现在遇到了testNG。 My main question is this framework used by testers? 我的主要问题是测试人员使用的这个框架? or developers? 还是开发商? Is testNG only for unit tests? testNG仅用于单元测试吗? or UI tests? 还是UI测试?

From what i've learnt so far the developer does the unit and component tests and the tester does the services/ui tests is this correct? 从我到目前为止所学到的,开发人员进行单元和组件测试,测试人员对服务/ ui测试是否正确?

Unfortunately I was put into a team of developers and not testers as this is my first job outside of university. 不幸的是,我被安排在一个开发人员而不是测试人员的团队中,因为这是我在大学之外的第一份工作。 So I haven't had the chance to learn from other testers. 所以我没有机会向其他测试人员学习。 There was no plan for me when I started just that I was going to be the first tester in this development team without any prior testing knowledge. 当我开始时,没有任何计划让我成为这个开发团队中第一个没有任何先前测试知识的测试人员。

Which is why I need a bit of guidance on these issues. 这就是为什么我需要对这些问题提出一些指导。

My main question is this framework used by testers? 我的主要问题是测试人员使用的这个框架? or developers? 还是开发商? Is testNG only for unit tests? testNG仅用于单元测试吗? or UI tests? 还是UI测试?

TestNG can be used for both, developers and automation testers, it is a tool that can operate over and together with Junit, basically in some cases is being used to create the concept of test suite, that allows to split all the test cases based on specific criteria (time, module, complexity). TestNG可以用于开发人员和自动化测试人员,它是一个可以与Junit一起操作的工具,基本上在某些情况下用于创建测试套件的概念,允许基于的分割所有测试用例具体标准(时间,模块,复杂性)。 Also this framework can be used in unit testing and integration testing as well as ui-testing. 此框架也可用于单元测试和集成测试以及ui测试。

TestNG also in some cases replaced Junit entirely, whit this approach you will have a framework with some out of the box capabilities as DataProviders, Multi threading support and other, you could check this link , consider this as and powerful option for Junit. TestNG在某些情况下也完全取代了Junit,这种方法你将拥有一个具有一些开箱即用功能的框架,如DataProviders,Multi threading支持等,你可以查看这个链接 ,考虑这个和Junit的强大选项。

From what i've learnt so far the developer does the unit and component tests and the tester does the services/ui tests is this correct? 从我到目前为止所学到的,开发人员进行单元和组件测试,测试人员对服务/ ui测试是否正确?

Unit testing which I consider very similar as "component test" is being done by the developers. 我认为与“组件测试”非常相似的单元测试由开发人员完成。 If you have web services or a REST API, developers sometimes are in charge of create some test using integration testing, basically verify that services are working as we expected, returning JSON/XML with the correct format and other kind of validations. 如果您有Web服务或REST API,开发人员有时负责使用集成测试创建一些测试,基本上验证服务是否按预期工作,以正确的格式和其他类型的验证返回JSON / XML。

Testers also could check services, using tools such as Jmeter, SOAP-UI, they check more things related to the business logic. 测试人员还可以使用Jmeter,SOAP-UI等工具检查服务,他们会检查与业务逻辑相关的更多内容。 Finally I would said UI test is being done in most of the places by the manual and automation testing team, in places where is no QA department this tasks also belongs to the DEV team. 最后我会说手动和自动化测试团队在大多数地方都进行了UI测试,在没有QA部门的地方,这个任务也属于DEV团队。

TestNG is basically used by developers for doing unit testing, I agree. 我同意,TestNG基本上被开发人员用于进行单元测试。 But it is also widely used by system test automation using Selenium. 但它也被使用Selenium的系统测试自动化广泛使用。 This framework is inspired by JUnit framework, and most of the automation test developers use this framework because of its advantages and more added features to support reporting. 该框架受JUnit框架的启发,大多数自动化测试开发人员使用此框架,因为它具有支持报告的优势和更多附加功能。

I can say following advantages I got by using this framework: 我可以说通过使用这个框架获得了以下优势:

1.Support for parameters. 1.支持参数。

2.Supports dependent methods testing. 2.支持依赖方法测试。

3.Test configuration flexible. 3.测试配置灵活。 Supports powerful execution model. 支持强大的执行模型。

4.Embeds BeanShell for further flexibility. 4.Embeds BeanShell进一步提高灵活性。

5.TestNG has a more elegant way of handling parameterized tests with the data-provider concept. 5.TestNG使用数据提供程序概念处理参数化测试的方式更为优雅。

6.For the same test class TestNG support for multiple instances. 6.对于同一测试类TestNG支持多个实例。

7.Extendibility of using different Tools and plug-ins like Eclipse, Maven, IDEA etc. 7.使用Eclipse,Maven,IDEA等不同工具和插件的可扩展性。

8.Default JDK functions for runtime and logging (no dependencies). 8.默认JDK函数用于运行时和日志记录(无依赖关系)。

9.Supported different Annotations like @BeforeSuite, @AfterSuite, @BeforeClass, @AfterClass, @BeforeTest, @AfterTest, @BeforeGroups, @AfterGroups, @BeforeMethod, @AfterMethod, @DataProvider, @Factory, @Listeners, @Parameters, @Test. 9.支持不同的注释,如@ BeforeSuite,@ AfterSuite,@ ByClass,@ AfterClass,@ BerthTest,@ AfterTest,@ BeforeGroups,@ AfterGroups,@ BeforeMethod,@ AfterMethod,@ DataProvider,@ Factory,@ Listeners,@ Parameters,@ Test 。

The most beautiful part I found in testNG is, using data provider, i can easily read test inputs and expected results from excel. 我在testNG中找到的最美丽的部分是,使用数据提供程序,我可以轻松读取excel的测试输入和预期结果。 And I can able to see the Results of Pass/Fail and skip test cases in an emailable format. 我可以看到通过/失败的结果,并以可通过电子邮件格式跳过测试用例。

For testing a system, we don't need any training/extra classes. 对于测试系统,我们不需要任何培训/额外课程。 Just if we know the system requirements, and this as a end user what they want from the system and start testing. 只要我们知道系统要求,并将其作为最终用户从系统中获得他们想要的东西并开始测试。 If any deviations found in the system behavior and are not as per the expectations of user. 如果在系统行为中发现任何偏差并且不符合用户的期望。 Then mark it as an issue and raise a defect and track it until it get resolved. 然后将其标记为问题并引发缺陷并跟踪它直到它得到解决。 Retest the same and confirm that the system is working as per the expectations. 重新测试并确认系统按预期工作。 even at the Unit test level this principle holds the same. 即使在单元测试级别,这个原则也是如此。 But only the difference is that we can do Structure based testing there. 但唯一的区别是我们可以在那里进行基于结构的测试。

In order to run tests you need to have a test runner it could be anything, most common in java world is JUnit and TestNG, with those frameworks you can run the tests which annotated by @Test tag, also you can group the tests the way you want it and run them in parallel. 为了运行测试,你需要有一个测试运行器,它可以是任何东西,在Java世界中最常见的是JUnit和TestNG,这些框架你可以运行由@Test标签注释的测试,你也可以按照方式对测试进行分组你想要它并且并行运行它们。

Testers use it to run Selenium tests and do assertions, even though for assertions it is good to have knowledge of hamcrest matchers. 测试人员使用它来运行Selenium测试并进行断言,即使对于断言,了解hamcrest匹配器也是一件好事 Also it providing you reports after tests been completed. 它还在测试完成后为您提供报告。

Developers would use same frameworks for unit testing purposes. 开发人员将使用相同的框架进行单元测试。

Check out guys from toolsqa.com they have pretty comprehensive tutorials on using Selenium with TestNG. 查看来自toolsqa.com的人他们有关于使用Selenium和TestNG的相当全面的教程。

To your questions .. 对你的问题..

1.My main question is this framework used by testers? 1.我的主要问题是测试人员使用的这个框架? or developers? 还是开发商? Is testNG only for unit tests? testNG仅用于单元测试吗? or UI tests? 还是UI测试?

Answer = Test NG can be used for unit testing as well as UI testing. 答案=测试NG可用于单元测试以及UI测试。 the advantage of test NG over JUNIT is that you dont need to write code for test result reporting. 测试NG优于JUNIT的优点是您不需要为测试结果报告编写代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 TestNG 和 Java (Selenium) 进行并行测试 - Parallel Testing with TestNG and Java (Selenium) 使用TestNG在不同浏览器上进行Selenium测试 - Selenium testing on different browsers using TestNG 使用POI和TestNG ..code的Selenium中的数据驱动测试出错 - Data driven testing in Selenium using POI and TestNG ..code getting error 手动测试/自动化-Selenium webdriver / TestNG / Nightwatch.js - Manual Testing/Automation - Selenium webdriver/TestNG/Nightwatch.js 如何通过打开多个窗口一次使用Selenium TestNG进行负载测试 - How to Perform load Testing with Selenium TestNG at a time by opening multiple windows 硒网格+ Maven + TestNG +范围报告+并行测试 - Selenium Grid + Maven + TestNG + Extent Reports + Parallel Testing 使用Selenium和TestNG并行交叉浏览器测试,而不使用testng.xml - Parallel cross browser testing with Selenium and TestNG without using testng.xml 如何使用硒网格测试数据提供程序执行并行跨浏览器测试 - How to perform parallel cross browser testing with selenium grid testng data provider Java Selenium 测试:如何从 CSV 中读取特定行和/或行以将数据提供给 TestNG 测试 - Java Selenium testing: How to read in a specific line and or row from a CSV to feed in data to a TestNG test 硒多浏览器测试。 只有最后一个浏览器会接收Cookie。 TestNG的 - Selenium multiple browser testing. Only last browser receives cookies. TestNG
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM