我正在为工作中使用的测试框架编写一些文档,并使用动词框来显示代码并添加与该代码特别相关的注释/标题。但我收到了错误:
Undefined control sequence. ...{Get Current Date} from the \testbf {DateTime} library, you ca... l.65 ...fore calling the function.}}}{\theverbbox}
由于某种原因,我不能有多个动词框?如果我删除产生错误的框,错误只会发生在下一个动词框中。我写的方式有问题吗,还是这是一个潜在的错误?
\begin{verbbox}
*** Settings ***
Documentation A resource file with reusable keywords and variables. #This is the description of the resource file
Library Selenium2Library
Library FakerLibrary WITH NAME faker
Library DateTime WITH NAME DateTime
\end{verbbox}
\stackinset{c}{}{t}{-.1cm}{\textcolor{red}{\sffamily\tiny\parbox{2.2in}{
The \textit{Library} keyword tells Robot that it needs to make sure that this is installed and available to use, otherwise it will tell you that importing the library failed. Selenium is needed in \textbf{all} of our resource files.}}}{\theverbbox}\\[1\baselineskip]
In the above example I have imported two optional libraries (faker and DateTime). faker creates random data that can be used to populate fields, DateTime allows me to get the current date among other helpful functions. I have also used the \textit{WITH NAME} argument, I have done so because it will make it more obvious to anyone new to Robot Framework tests which functions are being called from these libraries. I did \textbf{not} do this for Selenium because Selenium is the base of most Robot Framework functionality and would not serve to clarify the function of our tests.
Example of library keywords:
\begin{verbbox}
\${DATE}= | DateTime.Get Current Date | result_format=%Y-%m-%d
\end{verbbox}
\stackinset{c}{}{c}{-.1cm}{\textcolor{red}{\sffamily\tiny\parbox{2.2in}{ This variable uses the function \textit{Get Current Date} from the \testbf{DateTime} library, you can tell because it uses the prefix that I defined in my earlier example before calling the function.}}}{\theverbbox}
答案1
错误信息与 verbatim 无关
Undefined control sequence. ...{Get Current Date} from the \testbf
\testbf
应该是\textbf