简体   繁体   English

Fitnesse登录测试

[英]Fitnesse login test

I'm working on a delivery pipeline.我正在研究交付管道。 I want to integrate multiple test-automation frameworks in it.我想在其中集成多个测试自动化框架。 One of them is Fitnesse.其中之一是Fitnesse。 On the web I see lots of examples that test a Java class using the wikiserver.在网络上,我看到很多使用 wikiserver 测试 Java 类的示例。 But what I don't see is if it is possible to test a simple (jsp) login form.但是我没有看到是否可以测试一个简单的(jsp)登录表单。 Also I want to start this test from within a Juni test, without installing the wikiserver.此外,我想从 Juni 测试中开始此测试,而无需安装 wikiserver。 Just adding the Fitnesse maven dependcency.只需添加 Fitnesse maven 依赖项。

Is there anyone who can give me an example of how to do this?有没有人可以给我一个如何做到这一点的例子?

Thanks!谢谢!

Your question seems to be twofold:你的问题似乎是双重的:

  • how do I write a FitNesse test for a login web page, and:我如何为登录网页编写 FitNesse 测试,以及:
  • how do I run this test inside a delivery pipeline (where I want it to act as a jUnit test)我如何在交付管道中运行此测试(我希望它在其中充当 jUnit 测试)

From your question it is not really clear to me whether you already managed to write the test you are looking for.从您的问题来看,我不太清楚您是否已经设法编写了您正在寻找的测试。 Like mentioned in comments to your question: FitNesse itself does not offer any way to test a web form directly.就像对您的问题的评论中提到的那样:FitNesse 本身不提供任何直接测试网络表单的方法。 You either need to write your own code to connect the wiki to the web page to be tested (a fixture) or use a library which contains such a fixture.您要么需要编写自己的代码将 wiki 连接到要测试的网页(夹具),要么使用包含此类夹具的库。

To run a FitNesse test inside a delivery pipeline, like a jUnit test, you can write a jUnit test with a RunWith annotation and then specifying FitNesse's FitNesseRunner .要在交付管道内运行 FitNesse 测试,例如 jUnit 测试,您可以使用RunWith注释编写 jUnit 测试,然后指定 FitNesse 的FitNesseRunner Something like the test below from FitNesse's own tests :类似于下面来自FitNesse 自己的测试的测试

package fitnesse.junit;

import org.junit.runner.RunWith;

@RunWith(FitNesseRunner.class)
@FitNesseRunner.Suite("FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestScriptTable")
@FitNesseRunner.FitnesseDir(".")
@FitNesseRunner.OutputDir("./build/fitnesse-results")
public class FitNesseRunnerTest {
}

I've create an (open source) project which contains both fixtures to use a web login form (either via a browser, with Selenium, or directly send a http POST to the server) and to run tests you define in the wiki from a build server (providing a jUnit test which you can configure to run a specific test/suite by adding a system property).我创建了一个(开源)项目,其中包含两个夹具以使用 Web 登录表单(通过浏览器、Selenium 或直接向服务器发送 http POST)并运行您在 wiki 中定义的测试构建服务器(提供一个 jUnit 测试,您可以通过添加系统属性将其配置为运行特定的测试/套件)。 So if you don't have a setup yet, that might be a good starting point.因此,如果您还没有设置,这可能是一个很好的起点。

Using that project a login form test (for instance called MyTests.LoginTest) might look something like:使用该项目登录表单测试(例如称为 MyTests.LoginTest)可能如下所示:

|script|browser test|
|open|https://example.com/myprofile|
|enter|johndoe|as|Username|
|enter|secret|as|Password|
|click|Login|
|check|value of|Firstname|John|
|check|value of|Lastname|Doe|

And the call to run test (using Maven), which would be embedded in your pipeline:以及运行测试的调用(使用 Maven),它将嵌入到您的管道中:

mvn clean test-compile failsafe:integration-test -DfitnesseSuiteToRun=MyTests.LoginTest -DseleniumGridUrl=http://${SAUCE_USERNAME}:${SAUCE_ACCESS_KEY}@ondemand.saucelabs.com:80/wd/hub -DseleniumCapabilities="browserName:chrome,platform:Windows 7,screenResolution:1680x1050"

Hi please answer this question. 嗨,请回答这个问题。 how-to-include-dynamic-image-url-in-fitnesse-slim-tests 如何在fitnesse中包含动态图像URL的苗条测试

How to include dynamic image URL in Fitnesse SLIM tests? 如何在Fitnesse SLIM测试中包括动态图像URL?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM